Skip to content

Commit

Permalink
test: Rename invalid_doctest to disable_comments
Browse files Browse the repository at this point in the history
This test uses a invalid doctest to confirm `disable_comments` works as expected. Rename the test to what is tested.
  • Loading branch information
caspermeijn committed Nov 1, 2024
1 parent 75b7e7a commit 85bd418
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 15 deletions.
12 changes: 4 additions & 8 deletions tests/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,14 +132,10 @@ fn main() {
.compile_protos(&[src.join("proto3_presence.proto")], includes)
.unwrap();

{
let mut config = prost_build::Config::new();
config.disable_comments(["."]);

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

config
.bytes(["."])
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
syntax = "proto3";

package invalid.doctest;
package disable_comments;

// ```
// invalid
Expand Down
3 changes: 3 additions & 0 deletions tests/src/disable_comments.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
//! MessageWithInvalidDoctest would generate a invalid doc test if
//! `Config::disable_comments` doesn't work correctly.
include!(concat!(env!("OUT_DIR"), "/disable_comments.rs"));
9 changes: 3 additions & 6 deletions tests/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ mod boxed_field;
#[cfg(test)]
mod custom_debug;

// Must be `pub` as doc tests are only executed on public types.
pub mod disable_comments;

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

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

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

0 comments on commit 85bd418

Please sign in to comment.