Skip to content

Commit

Permalink
unit-test added to replicate issue #905
Browse files Browse the repository at this point in the history
  • Loading branch information
anstylian committed Sep 7, 2023
1 parent 7b15ffd commit 30c800d
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 2 deletions.
8 changes: 8 additions & 0 deletions tests/src/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,14 @@ fn main() {
.compile_protos(&[src.join("custom_debug.proto")], includes)
.unwrap();

config
.compile_protos(&[src.join("result_enum.proto")], includes)
.unwrap();

config
.compile_protos(&[src.join("result_struct.proto")], includes)
.unwrap();

prost_build::Config::new()
.protoc_arg("--experimental_allow_proto3_optional")
.compile_protos(&[src.join("proto3_presence.proto")], includes)
Expand Down
10 changes: 8 additions & 2 deletions tests/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,14 @@ mod no_unused_results;
#[cfg(test)]
#[cfg(feature = "std")]
mod skip_debug;
#[cfg(test)]
mod well_known_types;

mod test_enum_named_value {
include!(concat!(env!("OUT_DIR"), "/myenum.result.rs"));
}

mod test_result_named_value {
include!(concat!(env!("OUT_DIR"), "/mystruct.result.rs"));
}

pub mod foo {
pub mod bar_baz {
Expand Down
3 changes: 3 additions & 0 deletions tests/src/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@

include!(concat!(env!("OUT_DIR"), "/myenum.result.rs"));
include!(concat!(env!("OUT_DIR"), "/mymessage.result.rs"));
11 changes: 11 additions & 0 deletions tests/src/result_enum.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
syntax = "proto3";
package myenum.result;


enum Result {
HELLO = 0;
}

message FailMessage {
Result result = 1;
}
8 changes: 8 additions & 0 deletions tests/src/result_struct.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
syntax = "proto3";
package mystruct.result;


message Result {
string msg = 1;
}

0 comments on commit 30c800d

Please sign in to comment.