Skip to content

Commit 60abdc9

Browse files
authored
test(default_string_escape): Move tests to separate module (#1239)
- Move related tests to separate module - Make config dependency explicit in `build.rs`
1 parent 35e3f28 commit 60abdc9

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

tests/build.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ fn main() {
9999
.compile_protos(&[src.join("derive_copy.proto")], includes)
100100
.unwrap();
101101

102-
config
102+
prost_build::Config::new()
103103
.compile_protos(&[src.join("default_string_escape.proto")], includes)
104104
.unwrap();
105105

tests/src/default_string_escape.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
include!(concat!(env!("OUT_DIR"), "/default_string_escape.rs"));
2+
3+
#[test]
4+
fn test_default_string_escape() {
5+
let msg = Person::default();
6+
assert_eq!(msg.name, r#"["unknown"]"#);
7+
}

tests/src/lib.rs

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,9 @@ mod recursive_oneof;
7878
#[cfg(test)]
7979
mod groups;
8080

81+
#[cfg(test)]
82+
mod default_string_escape;
83+
8184
mod test_enum_named_option_value {
8285
include!(concat!(env!("OUT_DIR"), "/myenum.optionn.rs"));
8386
}
@@ -115,10 +118,6 @@ pub mod proto3 {
115118
}
116119
}
117120

118-
pub mod default_string_escape {
119-
include!(concat!(env!("OUT_DIR"), "/default_string_escape.rs"));
120-
}
121-
122121
#[cfg(not(feature = "std"))]
123122
use alloc::vec::Vec;
124123

@@ -394,12 +393,6 @@ mod tests {
394393
<() as Message>::decode(&buf[..]).err().unwrap();
395394
}
396395

397-
#[test]
398-
fn test_default_string_escape() {
399-
let msg = default_string_escape::Person::default();
400-
assert_eq!(msg.name, r#"["unknown"]"#);
401-
}
402-
403396
#[test]
404397
fn test_proto3_presence() {
405398
let msg = proto3::presence::A {

0 commit comments

Comments
 (0)