Skip to content

Commit fe72d10

Browse files
authored
test(option_struct): Move tests to separate module (#1345)
- Create a explicit test in separate module - Rename package to match the filename - Make config dependency explicit in `build.rs`
1 parent 034908f commit fe72d10

File tree

4 files changed

+12
-6
lines changed

4 files changed

+12
-6
lines changed

tests/build.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ fn main() {
121121
.compile_protos(&[src.join("option_enum.proto")], includes)
122122
.unwrap();
123123

124-
config
124+
prost_build::Config::new()
125125
.compile_protos(&[src.join("option_struct.proto")], includes)
126126
.unwrap();
127127

tests/src/lib.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,8 @@ mod option_enum;
8989
#[cfg(test)]
9090
mod result_enum;
9191

92-
mod test_result_named_option_value {
93-
include!(concat!(env!("OUT_DIR"), "/mystruct.optionn.rs"));
94-
}
92+
#[cfg(test)]
93+
mod option_struct;
9594

9695
#[cfg(test)]
9796
mod result_struct;

tests/src/option_struct.proto

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
syntax = "proto3";
2-
package mystruct.optionn;
3-
2+
package option_struct;
43

54
message Option {
65
string msg = 1;

tests/src/option_struct.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
include!(concat!(env!("OUT_DIR"), "/option_struct.rs"));
2+
3+
#[test]
4+
fn test_struct_named_option_value() {
5+
let _ = Option {
6+
msg: "Can I create?".into(),
7+
};
8+
}

0 commit comments

Comments
 (0)