Skip to content

Commit eb4b2c6

Browse files
authored
test: Rename invalid_doctest to disable_comments (#1183)
This test uses a invalid doctest to confirm `disable_comments` works as expected. Rename the test to what is tested.
1 parent 75b7e7a commit eb4b2c6

File tree

4 files changed

+11
-15
lines changed

4 files changed

+11
-15
lines changed

tests/build.rs

+4-8
Original file line numberDiff line numberDiff line change
@@ -132,14 +132,10 @@ fn main() {
132132
.compile_protos(&[src.join("proto3_presence.proto")], includes)
133133
.unwrap();
134134

135-
{
136-
let mut config = prost_build::Config::new();
137-
config.disable_comments(["."]);
138-
139-
config
140-
.compile_protos(&[src.join("invalid_doctest.proto")], includes)
141-
.unwrap();
142-
}
135+
prost_build::Config::new()
136+
.disable_comments(["."])
137+
.compile_protos(&[src.join("disable_comments.proto")], includes)
138+
.unwrap();
143139

144140
config
145141
.bytes(["."])

tests/src/invalid_doctest.proto tests/src/disable_comments.proto

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
syntax = "proto3";
22

3-
package invalid.doctest;
3+
package disable_comments;
44

55
// ```
66
// invalid

tests/src/disable_comments.rs

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
//! MessageWithInvalidDoctest would generate a invalid doc test if
2+
//! `Config::disable_comments` doesn't work correctly.
3+
include!(concat!(env!("OUT_DIR"), "/disable_comments.rs"));

tests/src/lib.rs

+3-6
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@ mod boxed_field;
5959
#[cfg(test)]
6060
mod custom_debug;
6161

62+
// Must be `pub` as doc tests are only executed on public types.
63+
pub mod disable_comments;
64+
6265
mod test_enum_named_option_value {
6366
include!(concat!(env!("OUT_DIR"), "/myenum.optionn.rs"));
6467
}
@@ -126,12 +129,6 @@ pub mod proto3 {
126129
}
127130
}
128131

129-
pub mod invalid {
130-
pub mod doctest {
131-
include!(concat!(env!("OUT_DIR"), "/invalid.doctest.rs"));
132-
}
133-
}
134-
135132
pub mod default_string_escape {
136133
include!(concat!(env!("OUT_DIR"), "/default_string_escape.rs"));
137134
}

0 commit comments

Comments
 (0)