Skip to content

Commit

Permalink
test(default_string_escape): Move tests to separate module (#1239)
Browse files Browse the repository at this point in the history
- Move related tests to separate module
- Make config dependency explicit in `build.rs`
  • Loading branch information
caspermeijn authored Feb 7, 2025
1 parent 35e3f28 commit 60abdc9
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion tests/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ fn main() {
.compile_protos(&[src.join("derive_copy.proto")], includes)
.unwrap();

config
prost_build::Config::new()
.compile_protos(&[src.join("default_string_escape.proto")], includes)
.unwrap();

Expand Down
7 changes: 7 additions & 0 deletions tests/src/default_string_escape.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
include!(concat!(env!("OUT_DIR"), "/default_string_escape.rs"));

#[test]
fn test_default_string_escape() {
let msg = Person::default();
assert_eq!(msg.name, r#"["unknown"]"#);
}
13 changes: 3 additions & 10 deletions tests/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ mod recursive_oneof;
#[cfg(test)]
mod groups;

#[cfg(test)]
mod default_string_escape;

mod test_enum_named_option_value {
include!(concat!(env!("OUT_DIR"), "/myenum.optionn.rs"));
}
Expand Down Expand Up @@ -115,10 +118,6 @@ pub mod proto3 {
}
}

pub mod default_string_escape {
include!(concat!(env!("OUT_DIR"), "/default_string_escape.rs"));
}

#[cfg(not(feature = "std"))]
use alloc::vec::Vec;

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

#[test]
fn test_default_string_escape() {
let msg = default_string_escape::Person::default();
assert_eq!(msg.name, r#"["unknown"]"#);
}

#[test]
fn test_proto3_presence() {
let msg = proto3::presence::A {
Expand Down

0 comments on commit 60abdc9

Please sign in to comment.