1 // Protocol Buffers - Google's data interchange format 2 // Copyright 2023 Google LLC. All rights reserved. 3 // 4 // Use of this source code is governed by a BSD-style 5 // license that can be found in the LICENSE file or at 6 // https://developers.google.com/open-source/licenses/bsd 7 8 use bad_names_rust_proto::*; 9 use googletest::prelude::*; 10 11 #[gtest] test_reserved_keyword_in_accessors()12fn test_reserved_keyword_in_accessors() { 13 let msg = Self__mangled_because_ident_isnt_a_legal_raw_identifier::new(); 14 let res = msg.self__mangled_because_ident_isnt_a_legal_raw_identifier().r#for(); 15 assert_that!(res, eq(0)); 16 } 17 18 #[gtest] test_reserved_keyword_in_messages()19fn test_reserved_keyword_in_messages() { 20 let _ = r#enum::new(); 21 let _ = Ref::new().r#const(); 22 } 23 24 #[gtest] test_collision_in_accessors()25fn test_collision_in_accessors() { 26 let mut m = AccessorsCollide::new(); 27 m.set_x_mut_5(false); 28 assert_that!(m.x_mut_5(), eq(false)); 29 assert_that!(m.has_x_mut_5(), eq(true)); 30 assert_that!(m.has_x(), eq(false)); 31 assert_that!(m.has_set_x_2(), eq(false)); 32 } 33