Skip to content

Commit

Permalink
tests: ensure Box<str> is a valid string type
Browse files Browse the repository at this point in the history
  • Loading branch information
poliorcetics committed Jul 1, 2023
1 parent ff3e270 commit 1525688
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions tests/src/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,10 @@ fn main() {
.unwrap();

config
.boxed_str([".string_types.StringTypes.is_boxed_str"])
.compile_protos(&[src.join("string_types.proto")], includes)
.unwrap();

let out = std::env::var("OUT_DIR").unwrap();
let out_path = PathBuf::from(out).join("wellknown_include");

Expand Down
1 change: 1 addition & 0 deletions tests/src/string_types.proto
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ package string_types;

message StringTypes {
string is_string = 1;
string is_boxed_str = 2;
}
1 change: 1 addition & 0 deletions tests/src/string_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ fn test_string_types() {
// Successful compilation means the types and generated code are correct
let _ = StringTypes {
is_string: ::prost::alloc::string::String::default(),
is_boxed_str: ::prost::alloc::boxed::Box::<str>::default(),
};
}

0 comments on commit 1525688

Please sign in to comment.