Add test ensuring that rust keywords can be message names

PiperOrigin-RevId: 561057538
pull/13721/head
Hong Shin 1 year ago committed by Copybara-Service
parent ecd106bd49
commit bbe389eb72
  1. 3
      rust/test/reserved.proto
  2. 6
      rust/test/shared/reserved_test.rs

@ -34,4 +34,7 @@ package naming;
message Reserved {
optional int32 for = 1; // for is a reserved word in rust, let's make sure we can compile it
message Inner {}
optional Inner pub = 2; // pub is reserved too!
}

@ -37,3 +37,9 @@ fn test_reserved_keyword_in_accessors() {
let res = msg.r#for();
assert_eq!(res, 0);
}
#[test]
fn test_reserved_keyword_in_messages() {
let msg = Reserved::new();
let _ = msg.r#pub();
}

Loading…
Cancel
Save