Skip to content

Commit

Permalink
Rust: set ignore on code example in comment
Browse files Browse the repository at this point in the history
I found that `cargo test` fails without this, because even with `no_run`, Cargo
will still try to compile the code. It would be nice to have a working example
here, but unfortunately it's non-trivial to set that up since we would need a
real generated proto.

I also tweaked cargo_test.sh to run the doc tests so that we have CI coverage
for those.

PiperOrigin-RevId: 703611549
  • Loading branch information
acozzette authored and copybara-github committed Dec 6, 2024
1 parent 0a3cd5f commit ac6852b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion rust/proto_macro.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
/// require another call to this macro in order to return a submessage
/// literal.
///
/// ```rust,no_run
/// ```rust,ignore
/// /*
/// Given the following proto definition:
/// message Data {
Expand Down
5 changes: 2 additions & 3 deletions rust/release_crates/cargo_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,11 @@ echo "Expanding protobuf_example crate tar"
tar -xvf $EXAMPLE_TAR -C $EXAMPLE_ROOT

cd $CRATE_ROOT
# Run all tests except doctests
CARGO_HOME=$CARGO_HOME cargo test --lib --bins --tests
CARGO_HOME=$CARGO_HOME cargo test
CARGO_HOME=$CARGO_HOME cargo publish --dry-run

cd $CODEGEN_ROOT
CARGO_HOME=$CARGO_HOME cargo test --lib --bins --tests
CARGO_HOME=$CARGO_HOME cargo test
CARGO_HOME=$CARGO_HOME cargo publish --dry-run

cd $EXAMPLE_ROOT
Expand Down

0 comments on commit ac6852b

Please sign in to comment.