diff --git a/rust/cargo/Cargo-template.toml b/rust/cargo/Cargo-template.toml index b29e58f8b4..35dbce555e 100644 --- a/rust/cargo/Cargo-template.toml +++ b/rust/cargo/Cargo-template.toml @@ -21,7 +21,7 @@ path = "src/shared.rs" paste = "1.0.15" [dev-dependencies] -googletest = {git = "https://github.com/google/googletest-rust.git" } +googletest = "0.12.0" [build-dependencies] cc = "1.1.6" diff --git a/rust/cpp.rs b/rust/cpp.rs index 6bfcd37f59..8362bdb1f3 100644 --- a/rust/cpp.rs +++ b/rust/cpp.rs @@ -1301,14 +1301,14 @@ mod tests { (content.as_mut_ptr(), content.len()) } - #[gtest] + #[googletest::test] fn test_serialized_data_roundtrip() { let (ptr, len) = allocate_byte_array(b"Hello world"); let serialized_data = SerializedData { data: NonNull::new(ptr).unwrap(), len }; assert_that!(&*serialized_data, eq(b"Hello world")); } - #[gtest] + #[googletest::test] fn test_empty_string() { let empty_str: String = RustStringRawParts { data: std::ptr::null(), len: 0 }.into(); assert_that!(empty_str, eq("")); diff --git a/rust/map.rs b/rust/map.rs index 386b562144..9df11f52d2 100644 --- a/rust/map.rs +++ b/rust/map.rs @@ -527,7 +527,7 @@ mod tests { use crate::{ProtoBytes, ProtoStr, ProtoString}; use googletest::prelude::*; - #[gtest] + #[googletest::test] fn test_proxied_scalar() { let mut map: Map = Map::new(); let mut map_mut = map.as_mut(); @@ -553,7 +553,7 @@ mod tests { assert_that!(map_view_4.is_empty(), eq(false)); } - #[gtest] + #[googletest::test] fn test_proxied_str() { let mut map: Map = Map::new(); let mut map_mut = map.as_mut(); @@ -578,7 +578,7 @@ mod tests { assert_that!(map_view_4.is_empty(), eq(false)); } - #[gtest] + #[googletest::test] fn test_proxied_iter() { let mut map: Map = Map::new(); let mut map_mut = map.as_mut(); @@ -625,7 +625,7 @@ mod tests { ); } - #[gtest] + #[googletest::test] fn test_overwrite_insert() { let mut map: Map = Map::new(); let mut map_mut = map.as_mut(); @@ -635,7 +635,7 @@ mod tests { assert_that!(map.as_mut(), unordered_elements_are![eq((0, ProtoStr::from_str("buzz"))),]); } - #[gtest] + #[googletest::test] fn test_extend() { let mut map: Map = Map::new(); let mut map_mut = map.as_mut(); @@ -672,7 +672,7 @@ mod tests { ); } - #[gtest] + #[googletest::test] fn test_copy_from() { let mut map: Map = Map::new(); let mut map_mut = map.as_mut(); @@ -703,7 +703,7 @@ mod tests { ); } - #[gtest] + #[googletest::test] fn test_all_maps_can_be_constructed() { macro_rules! gen_proto_values { ($key_t:ty, $($value_t:ty),*) => { @@ -725,7 +725,7 @@ mod tests { gen_proto_keys!(i32, u32, i64, u64, bool, ProtoString); } - #[gtest] + #[googletest::test] fn test_dbg() { let mut map = Map::::new(); assert_that!(format!("{:?}", map.as_view()), eq("MapView(\"i32\", \"f64\")")); diff --git a/rust/proxied.rs b/rust/proxied.rs index 07c1753a85..0393d6a429 100644 --- a/rust/proxied.rs +++ b/rust/proxied.rs @@ -372,7 +372,7 @@ mod tests { impl<'msg> MutProxy<'msg> for MyProxiedMut<'msg> {} - #[gtest] + #[googletest::test] fn test_as_view() { let my_proxied = MyProxied { val: "Hello World".to_string() }; @@ -387,7 +387,7 @@ mod tests { x.into_view() // OK: we return the same lifetime as we got in. } - #[gtest] + #[googletest::test] fn test_mut_into_view() { let mut my_proxied = MyProxied { val: "Hello World".to_string() }; reborrow_mut_into_view(my_proxied.as_mut()); @@ -395,7 +395,7 @@ mod tests { fn require_unified_lifetimes<'msg>(_x: Mut<'msg, MyProxied>, _y: View<'msg, MyProxied>) {} - #[gtest] + #[googletest::test] fn test_require_unified_lifetimes() { let mut my_proxied = MyProxied { val: "Hello1".to_string() }; let my_mut = my_proxied.as_mut(); @@ -420,7 +420,7 @@ mod tests { [x.as_view(), y.as_view()] } - #[gtest] + #[googletest::test] fn test_reborrow_generic_as_view() { let mut my_proxied = MyProxied { val: "Hello1".to_string() }; let mut my_mut = my_proxied.as_mut(); @@ -447,7 +447,7 @@ mod tests { [x.into_view(), y] } - #[gtest] + #[googletest::test] fn test_reborrow_generic_into_view() { let my_proxied = MyProxied { val: "Hello1".to_string() }; let my_view = my_proxied.as_view(); @@ -467,7 +467,7 @@ mod tests { [x.into_view(), y] } - #[gtest] + #[googletest::test] fn test_reborrow_generic_mut_into_view() { let mut my_proxied = MyProxied { val: "Hello1".to_string() }; let my_mut = my_proxied.as_mut(); @@ -491,7 +491,7 @@ mod tests { [tmp, y] } - #[gtest] + #[googletest::test] fn test_reborrow_generic_mut_into_mut() { let mut my_proxied = MyProxied { val: "Hello1".to_string() }; let my_mut = my_proxied.as_mut(); diff --git a/rust/repeated.rs b/rust/repeated.rs index b1a406b3cd..9d14faa113 100644 --- a/rust/repeated.rs +++ b/rust/repeated.rs @@ -585,7 +585,7 @@ mod tests { use super::*; use googletest::prelude::*; - #[gtest] + #[googletest::test] fn test_primitive_repeated() { macro_rules! primitive_repeated_tests { ($($t:ty => [$($vals:expr),* $(,)?]),* $(,)?) => { @@ -626,7 +626,7 @@ mod tests { ); } - #[gtest] + #[googletest::test] fn test_repeated_extend() { let mut r = Repeated::::new(); @@ -643,7 +643,7 @@ mod tests { assert_that!(r.as_mut(), elements_are![eq(0), eq(1), eq(2), eq(3)]); } - #[gtest] + #[googletest::test] fn test_repeated_iter_into_proxied() { let r: Repeated = [0, 1, 2, 3].into_iter().into_proxied(Private); assert_that!(r.as_view(), elements_are![eq(0), eq(1), eq(2), eq(3)]); diff --git a/rust/string.rs b/rust/string.rs index cc473039f0..9ff984716e 100644 --- a/rust/string.rs +++ b/rust/string.rs @@ -621,7 +621,7 @@ mod tests { // UTF-8 test cases copied from: // https://github.com/rust-lang/rust/blob/e8ee0b7/library/core/tests/str_lossy.rs - #[gtest] + #[googletest::test] fn proto_str_debug() { assert_eq!(&format!("{:?}", test_proto_str(b"Hello There")), "\"Hello There\""); assert_eq!( @@ -633,7 +633,7 @@ mod tests { ); } - #[gtest] + #[googletest::test] fn proto_str_display() { assert_eq!(&test_proto_str(b"Hello There").to_string(), "Hello There"); assert_eq!( @@ -642,7 +642,7 @@ mod tests { ); } - #[gtest] + #[googletest::test] fn proto_str_to_rust_str() { assert_eq!(test_proto_str(b"hello").to_str(), Ok("hello")); assert_eq!(test_proto_str("ศไทย中华Việt Nam".as_bytes()).to_str(), Ok("ศไทย中华Việt Nam")); @@ -662,7 +662,7 @@ mod tests { } } - #[gtest] + #[googletest::test] fn proto_str_to_cow() { assert_eq!(test_proto_str(b"hello").to_cow_lossy(), Cow::Borrowed("hello")); assert_eq!( @@ -684,7 +684,7 @@ mod tests { } } - #[gtest] + #[googletest::test] fn proto_str_utf8_chunks() { macro_rules! assert_chunks { ($bytes:expr, $($chunks:expr),* $(,)?) => { @@ -763,7 +763,7 @@ mod tests { ); } - #[gtest] + #[googletest::test] fn proto_str_chars() { macro_rules! assert_chars { ($bytes:expr, $chars:expr) => { diff --git a/rust/test/cpp/debug_test.rs b/rust/test/cpp/debug_test.rs index 7878ab6a9f..51e4d03d8a 100644 --- a/rust/test/cpp/debug_test.rs +++ b/rust/test/cpp/debug_test.rs @@ -3,7 +3,7 @@ use googletest::prelude::*; use optimize_for_lite_rust_proto::OptimizeForLiteTestMessage; #[cfg(not(lite_runtime))] -#[gtest] +#[googletest::test] fn test_debug() { let mut msg = DebugMsg::new(); msg.set_id(1); @@ -13,7 +13,7 @@ fn test_debug() { } #[cfg(lite_runtime)] -#[gtest] +#[googletest::test] fn test_debug_lite() { let mut msg = DebugMsg::new(); msg.set_id(1); @@ -25,7 +25,7 @@ fn test_debug_lite() { /// A message with the option set to optimize for lite will behave as a lite /// message regardless of the `lite_runtime` feature. Run this test not guarded /// by the cfg(lite_runtime) and ensure it functions as lite. -#[gtest] +#[googletest::test] fn test_optimize_for_lite_option() { let mut msg = OptimizeForLiteTestMessage::new(); msg.set_value("password"); diff --git a/rust/test/cpp/interop/main.rs b/rust/test/cpp/interop/main.rs index 0b7891260a..4376311787 100644 --- a/rust/test/cpp/interop/main.rs +++ b/rust/test/cpp/interop/main.rs @@ -40,7 +40,7 @@ extern "C" { fn GetConstStaticInteropTestMessage() -> *const c_void; } -#[gtest] +#[googletest::test] fn send_to_cpp() { let mut msg1 = InteropTestMessage::new(); msg1.set_i64(7); @@ -48,7 +48,7 @@ fn send_to_cpp() { assert_eq!(i, 7); } -#[gtest] +#[googletest::test] fn mutate_message_mut_in_cpp() { let mut msg1 = InteropTestMessage::new(); unsafe { @@ -63,7 +63,7 @@ fn mutate_message_mut_in_cpp() { proto_assert_eq!(msg1, msg2); } -#[gtest] +#[googletest::test] fn deserialize_in_rust() { let mut msg1 = InteropTestMessage::new(); msg1.set_i64(-1); @@ -75,7 +75,7 @@ fn deserialize_in_rust() { proto_assert_eq!(msg1, msg2); } -#[gtest] +#[googletest::test] fn deserialize_in_cpp() { let mut msg1 = InteropTestMessage::new(); msg1.set_i64(-1); @@ -92,7 +92,7 @@ fn deserialize_in_cpp() { proto_assert_eq!(msg1, msg2); } -#[gtest] +#[googletest::test] fn deserialize_in_cpp_into_mut() { let mut msg1 = InteropTestMessage::new(); msg1.set_i64(-1); @@ -110,7 +110,7 @@ fn deserialize_in_cpp_into_mut() { } } -#[gtest] +#[googletest::test] fn deserialize_in_cpp_into_view() { let mut msg1 = InteropTestMessage::new(); msg1.set_i64(-1); @@ -131,7 +131,7 @@ fn deserialize_in_cpp_into_view() { // This test ensures that random fields we (Rust) don't know about don't // accidentally get destroyed by Rust. -#[gtest] +#[googletest::test] fn smuggle_extension() { let msg1 = unsafe { InteropTestMessage::__unstable_take_ownership_of_raw_message(NewWithExtension()) }; @@ -143,7 +143,7 @@ fn smuggle_extension() { assert_eq!(bytes, b"smuggled"); } -#[gtest] +#[googletest::test] fn view_of_const_static() { let view: InteropTestMessageView<'static> = unsafe { InteropTestMessageView::__unstable_wrap_raw_message_unchecked_lifetime( diff --git a/rust/test/shared/accessors_map_test.rs b/rust/test/shared/accessors_map_test.rs index 6e71b7ec3c..942efb6efd 100644 --- a/rust/test/shared/accessors_map_test.rs +++ b/rust/test/shared/accessors_map_test.rs @@ -20,7 +20,7 @@ macro_rules! generate_map_primitives_tests { $(,)? ) => { paste! { $( - #[gtest] + #[googletest::test] fn [< test_map_ $k_field _ $v_field >]() { let mut msg = TestMap::new(); assert_that!(msg.[< map_ $k_field _ $v_field >]().len(), eq(0)); @@ -96,7 +96,7 @@ generate_map_primitives_tests!( (i32, MapEnum, int32, enum, 1, MapEnum::Baz), ); -#[gtest] +#[googletest::test] fn collect_as_hashmap() { // Highlights conversion from protobuf map to hashmap. let mut msg = TestMap::new(); @@ -115,7 +115,7 @@ fn collect_as_hashmap() { ); } -#[gtest] +#[googletest::test] fn test_string_maps() { let mut msg = TestMap::new(); msg.map_string_string_mut().insert("hello", "world"); @@ -127,7 +127,7 @@ fn test_string_maps() { assert_that!(msg.map_string_string().len(), eq(0)); } -#[gtest] +#[googletest::test] fn test_nested_enum_maps() { // Verify that C++ thunks are generated and are with the right name for strings TestMapWithNestedEnum::new() @@ -135,7 +135,7 @@ fn test_nested_enum_maps() { .insert("foo", test_map_with_nested_enum::inner_nested::NestedEnum::Foo); } -#[gtest] +#[googletest::test] fn test_bytes_and_string_copied() { let mut msg = TestMap::new(); @@ -155,7 +155,7 @@ fn test_bytes_and_string_copied() { assert_that!(msg.map_int32_bytes_mut().get(1).unwrap(), eq(b"world")); } -#[gtest] +#[googletest::test] fn test_map_setter() { // Set Map { @@ -268,7 +268,7 @@ macro_rules! generate_map_with_msg_values_tests { $(,)? ) => { paste! { $( - #[gtest] + #[googletest::test] fn [< test_map_ $k_field _all_types >]() { // We need to cover the following upb/c++ thunks: // TODO - b/323883851: Add test once Map::new is public. diff --git a/rust/test/shared/accessors_proto3_test.rs b/rust/test/shared/accessors_proto3_test.rs index c23356f404..1df120d1a1 100644 --- a/rust/test/shared/accessors_proto3_test.rs +++ b/rust/test/shared/accessors_proto3_test.rs @@ -15,7 +15,7 @@ use protobuf::Optional; use unittest_proto3_optional_rust_proto::{test_proto3_optional, TestProto3Optional}; use unittest_proto3_rust_proto::{test_all_types, TestAllTypes}; -#[gtest] +#[googletest::test] fn test_fixed32_accessors() { let mut msg = TestAllTypes::new(); assert_that!(msg.optional_fixed32(), eq(0)); @@ -30,7 +30,7 @@ fn test_fixed32_accessors() { assert_that!(msg.optional_fixed32(), eq(43)); } -#[gtest] +#[googletest::test] fn test_bool_accessors() { let mut msg = TestAllTypes::new(); assert_that!(msg.optional_bool(), eq(false)); @@ -42,7 +42,7 @@ fn test_bool_accessors() { assert_that!(msg.optional_bool(), eq(false)); } -#[gtest] +#[googletest::test] fn test_bytes_accessors() { let mut msg = TestAllTypes::new(); // Note: even though it's named 'optional_bytes', the field is actually not @@ -62,7 +62,7 @@ fn test_bytes_accessors() { assert_that!(*msg.optional_bytes(), empty()); } -#[gtest] +#[googletest::test] fn test_optional_bytes_accessors() { let mut msg = TestProto3Optional::new(); assert_that!(*msg.optional_bytes(), empty()); @@ -84,7 +84,7 @@ fn test_optional_bytes_accessors() { assert_that!(msg.optional_bytes_opt(), eq(Optional::Set(&b"\xffbinary\x85non-utf8"[..]))); } -#[gtest] +#[googletest::test] fn test_string_accessors() { let mut msg = TestAllTypes::new(); // Note: even though it's named 'optional_string', the field is actually not @@ -104,7 +104,7 @@ fn test_string_accessors() { assert_that!(*msg.optional_string().as_bytes(), empty()); } -#[gtest] +#[googletest::test] fn test_optional_string_accessors() { let mut msg = TestProto3Optional::new(); assert_that!(*msg.optional_string().as_bytes(), empty()); @@ -126,7 +126,7 @@ fn test_optional_string_accessors() { assert_that!(msg.optional_string_opt(), eq(Optional::Set("".into()))); } -#[gtest] +#[googletest::test] fn test_nested_enum_accessors() { use test_all_types::NestedEnum; @@ -140,7 +140,7 @@ fn test_nested_enum_accessors() { assert_that!(msg.optional_nested_enum(), eq(NestedEnum::Zero)); } -#[gtest] +#[googletest::test] fn test_optional_nested_enum_accessors() { use test_proto3_optional::NestedEnum; @@ -157,7 +157,7 @@ fn test_optional_nested_enum_accessors() { assert_that!(msg.optional_nested_enum_opt(), eq(Optional::Set(NestedEnum::Unspecified))); } -#[gtest] +#[googletest::test] fn test_foreign_enum_accessors() { use unittest_proto3_rust_proto::ForeignEnum; @@ -171,7 +171,7 @@ fn test_foreign_enum_accessors() { assert_that!(msg.optional_foreign_enum(), eq(ForeignEnum::ForeignZero)); } -#[gtest] +#[googletest::test] fn test_oneof_accessors() { use test_all_types::OneofField::*; @@ -200,7 +200,7 @@ fn test_oneof_accessors() { assert_that!(msg.oneof_field(), matches_pattern!(not_set(_))); } -#[gtest] +#[googletest::test] fn test_oneof_accessors_view_long_lifetime() { use test_all_types::OneofField::*; @@ -216,7 +216,7 @@ fn test_oneof_accessors_view_long_lifetime() { assert_that!(oneof, matches_pattern!(OneofUint32(eq(7)))); } -#[gtest] +#[googletest::test] fn test_oneof_enum_accessors() { use unittest_proto3_rust_proto::{ test_oneof2::{Foo, FooCase, NestedEnum}, @@ -234,7 +234,7 @@ fn test_oneof_enum_accessors() { assert_that!(msg.foo_case(), matches_pattern!(FooCase::FooEnum)); } -#[gtest] +#[googletest::test] fn test_submsg_setter() { use test_all_types::*; @@ -247,7 +247,7 @@ fn test_submsg_setter() { assert_that!(parent.optional_nested_message().bb(), eq(7)); } -#[gtest] +#[googletest::test] fn test_ctype_stringpiece() { let mut msg = TestAllTypes::new(); assert_that!(msg.optional_string_piece(), eq("")); @@ -255,7 +255,7 @@ fn test_ctype_stringpiece() { assert_that!(msg.optional_string_piece(), eq("hello")); } -#[gtest] +#[googletest::test] fn test_msg_clear() { let mut m = TestAllTypes::new(); m.set_optional_int32(42); @@ -264,7 +264,7 @@ fn test_msg_clear() { assert_that!(m.optional_int32(), eq(0)); } -#[gtest] +#[googletest::test] fn test_submsg_clear() { let mut m = TestAllTypes::new(); let mut sub = m.optional_nested_message_mut(); diff --git a/rust/test/shared/accessors_repeated_test.rs b/rust/test/shared/accessors_repeated_test.rs index 550d307f3a..3e69bebbca 100644 --- a/rust/test/shared/accessors_repeated_test.rs +++ b/rust/test/shared/accessors_repeated_test.rs @@ -13,7 +13,7 @@ use unittest_rust_proto::{test_all_types, test_all_types::NestedMessage, TestAll macro_rules! generate_repeated_numeric_test { ($(($t: ty, $field: ident)),*) => { paste! { $( - #[gtest] + #[googletest::test] fn [< test_repeated_ $field _accessors >]() { let mut msg = TestAllTypes::new(); assert_that!(msg.[< repeated_ $field >](), empty()); @@ -52,7 +52,7 @@ macro_rules! generate_repeated_numeric_test { ); } - #[gtest] + #[googletest::test] fn [< test_repeated_ $field _set >]() { let mut msg = TestAllTypes::new(); let mut msg2 = TestAllTypes::new(); @@ -70,7 +70,7 @@ macro_rules! generate_repeated_numeric_test { ); } - #[gtest] + #[googletest::test] fn [< test_repeated_ $field _exact_size_iterator >]() { let mut msg = TestAllTypes::new(); let mut mutator = msg.[](); @@ -104,7 +104,7 @@ generate_repeated_numeric_test!( (f64, double) ); -#[gtest] +#[googletest::test] fn test_repeated_bool_accessors() { let mut msg = TestAllTypes::new(); assert_that!(msg.repeated_bool(), empty()); @@ -134,7 +134,7 @@ fn test_repeated_bool_accessors() { assert_that!(msg.repeated_bool(), each(eq(false))); } -#[gtest] +#[googletest::test] fn test_repeated_enum_accessors() { use test_all_types::NestedEnum; @@ -172,7 +172,7 @@ fn test_repeated_enum_accessors() { assert_that!(msg.repeated_nested_enum(), each(eq(NestedEnum::Foo))); } -#[gtest] +#[googletest::test] fn test_repeated_enum_set() { use test_all_types::NestedEnum; @@ -184,7 +184,7 @@ fn test_repeated_enum_set() { ); } -#[gtest] +#[googletest::test] fn test_repeated_bool_set() { let mut msg = TestAllTypes::new(); let mut msg2 = TestAllTypes::new(); @@ -199,7 +199,7 @@ fn test_repeated_bool_set() { assert_that!(&view.iter().collect::>(), eq(&mutator2.iter().collect::>())); } -#[gtest] +#[googletest::test] fn test_repeated_message() { let mut msg = TestAllTypes::new(); assert_that!(msg.repeated_nested_message().len(), eq(0)); @@ -236,7 +236,7 @@ fn test_repeated_message() { assert_that!(msg2.repeated_nested_message().len(), eq(0)); } -#[gtest] +#[googletest::test] fn test_repeated_message_setter() { let mut msg = TestAllTypes::new(); let mut nested = NestedMessage::new(); @@ -245,13 +245,13 @@ fn test_repeated_message_setter() { assert_that!(msg.repeated_nested_message().get(0).unwrap().bb(), eq(1)); } -#[gtest] +#[googletest::test] fn test_repeated_message_drop() { let mut repeated = Repeated::::new(); repeated.as_mut().push(TestAllTypes::new()); } -#[gtest] +#[googletest::test] fn test_repeated_strings() { let mut older_msg = TestAllTypes::new(); { @@ -286,7 +286,7 @@ fn test_repeated_strings() { assert_that!(older_msg.repeated_string(), empty()); } -#[gtest] +#[googletest::test] fn test_repeated_bytes() { let mut older_msg = TestAllTypes::new(); { diff --git a/rust/test/shared/accessors_test.rs b/rust/test/shared/accessors_test.rs index 201e81177d..345a0b16ef 100644 --- a/rust/test/shared/accessors_test.rs +++ b/rust/test/shared/accessors_test.rs @@ -17,7 +17,7 @@ use std::rc::Rc; use std::sync::Arc; use unittest_rust_proto::{test_all_types, TestAllTypes}; -#[gtest] +#[googletest::test] fn test_default_accessors() { let msg: TestAllTypes = Default::default(); assert_that!( @@ -42,7 +42,7 @@ fn test_default_accessors() { assert_that!(msg.default_bytes(), eq("world".as_bytes())); } -#[gtest] +#[googletest::test] fn test_optional_fixed32_accessors() { let mut msg = TestAllTypes::new(); assert_that!(msg.has_optional_fixed32(), eq(false)); @@ -60,7 +60,7 @@ fn test_optional_fixed32_accessors() { assert_that!(msg.optional_fixed32(), eq(0)); } -#[gtest] +#[googletest::test] fn test_default_fixed32_accessors() { let mut msg = TestAllTypes::new(); assert_that!(msg.default_fixed32(), eq(47)); @@ -78,7 +78,7 @@ fn test_default_fixed32_accessors() { assert_that!(msg.default_fixed32_opt(), eq(Optional::Unset(47))); } -#[gtest] +#[googletest::test] fn test_optional_fixed64_accessors() { let mut msg = TestAllTypes::new(); assert_that!(msg.optional_fixed64_opt(), eq(Optional::Unset(0))); @@ -97,7 +97,7 @@ fn test_optional_fixed64_accessors() { assert_that!(msg.optional_fixed64(), eq(0)); } -#[gtest] +#[googletest::test] fn test_default_fixed64_accessors() { let mut msg = TestAllTypes::new(); assert_that!(msg.default_fixed64(), eq(48)); @@ -116,7 +116,7 @@ fn test_default_fixed64_accessors() { assert_that!(msg.default_fixed64_opt(), eq(Optional::Unset(48))); } -#[gtest] +#[googletest::test] fn test_optional_int32_accessors() { let mut msg = TestAllTypes::new(); assert_that!(msg.optional_int32_opt(), eq(Optional::Unset(0))); @@ -135,7 +135,7 @@ fn test_optional_int32_accessors() { assert_that!(msg.optional_int32(), eq(0)); } -#[gtest] +#[googletest::test] fn test_default_int32_accessors() { let mut msg = TestAllTypes::new(); assert_that!(msg.default_int32(), eq(41)); @@ -158,7 +158,7 @@ fn test_default_int32_accessors() { assert_that!(msg.default_int32_opt(), eq(Optional::Unset(41))); } -#[gtest] +#[googletest::test] fn test_optional_int64_accessors() { let mut msg = TestAllTypes::new(); assert_that!(msg.optional_int64_opt(), eq(Optional::Unset(0))); @@ -173,7 +173,7 @@ fn test_optional_int64_accessors() { assert_that!(msg.optional_int64(), eq(0)); } -#[gtest] +#[googletest::test] fn test_default_int64_accessors() { let mut msg = TestAllTypes::new(); assert_that!(msg.default_int64(), eq(42)); @@ -188,7 +188,7 @@ fn test_default_int64_accessors() { assert_that!(msg.default_int64_opt(), eq(Optional::Unset(42))); } -#[gtest] +#[googletest::test] fn test_optional_sint32_accessors() { let mut msg = TestAllTypes::new(); assert_that!(msg.optional_sint32_opt(), eq(Optional::Unset(0))); @@ -203,7 +203,7 @@ fn test_optional_sint32_accessors() { assert_that!(msg.optional_sint32(), eq(0)); } -#[gtest] +#[googletest::test] fn test_default_sint32_accessors() { let mut msg = TestAllTypes::new(); assert_that!(msg.default_sint32(), eq(-45)); @@ -218,7 +218,7 @@ fn test_default_sint32_accessors() { assert_that!(msg.default_sint32_opt(), eq(Optional::Unset(-45))); } -#[gtest] +#[googletest::test] fn test_optional_sint64_accessors() { let mut msg = TestAllTypes::new(); assert_that!(msg.optional_sint64_opt(), eq(Optional::Unset(0))); @@ -233,7 +233,7 @@ fn test_optional_sint64_accessors() { assert_that!(msg.optional_sint64(), eq(0)); } -#[gtest] +#[googletest::test] fn test_default_sint64_accessors() { let mut msg = TestAllTypes::new(); assert_that!(msg.default_sint64(), eq(46)); @@ -248,7 +248,7 @@ fn test_default_sint64_accessors() { assert_that!(msg.default_sint64_opt(), eq(Optional::Unset(46))); } -#[gtest] +#[googletest::test] fn test_optional_uint32_accessors() { let mut msg = TestAllTypes::new(); assert_that!(msg.optional_uint32_opt(), eq(Optional::Unset(0))); @@ -263,7 +263,7 @@ fn test_optional_uint32_accessors() { assert_that!(msg.optional_uint32(), eq(0)); } -#[gtest] +#[googletest::test] fn test_default_uint32_accessors() { let mut msg = TestAllTypes::new(); assert_that!(msg.default_uint32(), eq(43)); @@ -278,7 +278,7 @@ fn test_default_uint32_accessors() { assert_that!(msg.default_uint32_opt(), eq(Optional::Unset(43))); } -#[gtest] +#[googletest::test] fn test_optional_uint64_accessors() { let mut msg = TestAllTypes::new(); assert_that!(msg.optional_uint64_opt(), eq(Optional::Unset(0))); @@ -293,7 +293,7 @@ fn test_optional_uint64_accessors() { assert_that!(msg.optional_uint64(), eq(0)); } -#[gtest] +#[googletest::test] fn test_default_uint64_accessors() { let mut msg = TestAllTypes::new(); assert_that!(msg.default_uint64(), eq(44)); @@ -308,7 +308,7 @@ fn test_default_uint64_accessors() { assert_that!(msg.default_uint64_opt(), eq(Optional::Unset(44))); } -#[gtest] +#[googletest::test] fn test_optional_float_accessors() { let mut msg = TestAllTypes::new(); assert_that!(msg.optional_float_opt(), eq(Optional::Unset(0.0))); @@ -323,7 +323,7 @@ fn test_optional_float_accessors() { assert_that!(msg.optional_float(), eq(0.0)); } -#[gtest] +#[googletest::test] fn test_default_float_accessors() { let mut msg = TestAllTypes::new(); assert_that!(msg.default_float(), eq(51.5)); @@ -338,7 +338,7 @@ fn test_default_float_accessors() { assert_that!(msg.default_float_opt(), eq(Optional::Unset(51.5))); } -#[gtest] +#[googletest::test] fn test_optional_double_accessors() { let mut msg = TestAllTypes::new(); assert_that!(msg.optional_double_opt(), eq(Optional::Unset(0.0))); @@ -353,7 +353,7 @@ fn test_optional_double_accessors() { assert_that!(msg.optional_double(), eq(0.0)); } -#[gtest] +#[googletest::test] fn test_default_double_accessors() { let mut msg = TestAllTypes::new(); assert_that!(msg.default_double(), eq(52e3)); @@ -368,7 +368,7 @@ fn test_default_double_accessors() { assert_that!(msg.default_double_opt(), eq(Optional::Unset(52e3))); } -#[gtest] +#[googletest::test] fn test_optional_bool_accessors() { let mut msg = TestAllTypes::new(); assert_that!(msg.optional_bool_opt(), eq(Optional::Unset(false))); @@ -380,7 +380,7 @@ fn test_optional_bool_accessors() { assert_that!(msg.optional_bool_opt(), eq(Optional::Unset(false))); } -#[gtest] +#[googletest::test] fn test_default_bool_accessors() { let mut msg = TestAllTypes::new(); assert_that!(msg.default_bool(), eq(true)); @@ -395,7 +395,7 @@ fn test_default_bool_accessors() { assert_that!(msg.default_bool_opt(), eq(Optional::Unset(true))); } -#[gtest] +#[googletest::test] fn test_optional_bytes_accessors() { let mut msg = TestAllTypes::new(); assert_that!(*msg.optional_bytes(), empty()); @@ -421,7 +421,7 @@ fn test_optional_bytes_accessors() { assert_that!(msg.optional_bytes_opt(), eq(Optional::Set(&b""[..]))); } -#[gtest] +#[googletest::test] fn test_into_proxied_for_bytes() { let mut msg = TestAllTypes::new(); @@ -463,7 +463,7 @@ fn test_into_proxied_for_bytes() { assert_that!(msg.optional_bytes(), eq(b"ninth")); } -#[gtest] +#[googletest::test] fn test_nonempty_default_bytes_accessors() { let mut msg = TestAllTypes::new(); assert_that!(msg.default_bytes(), eq(b"world")); @@ -492,7 +492,7 @@ fn test_nonempty_default_bytes_accessors() { assert_that!(msg.default_bytes_opt(), eq(Optional::Unset(&b"world"[..]))); } -#[gtest] +#[googletest::test] fn test_optional_string_accessors() { let mut msg = TestAllTypes::new(); assert_that!(msg.optional_string(), eq("")); @@ -518,7 +518,7 @@ fn test_optional_string_accessors() { assert_that!(msg.optional_string_opt(), eq(Optional::Unset("".into()))); } -#[gtest] +#[googletest::test] fn test_into_proxied_for_string() { let mut msg = TestAllTypes::new(); @@ -567,7 +567,7 @@ fn test_into_proxied_for_string() { assert_that!(msg.optional_string(), eq("eleventh")); } -#[gtest] +#[googletest::test] fn test_nonempty_default_string_accessors() { let mut msg = TestAllTypes::new(); assert_that!(msg.default_string(), eq("hello")); @@ -593,7 +593,7 @@ fn test_nonempty_default_string_accessors() { assert_that!(msg.default_string_opt(), eq(Optional::Unset("hello".into()))); } -#[gtest] +#[googletest::test] fn test_singular_msg_field() { let mut msg = TestAllTypes::new(); let msg_view = msg.optional_nested_message(); @@ -608,7 +608,7 @@ fn test_singular_msg_field() { assert_that!(msg.has_optional_nested_message(), eq(true)); } -#[gtest] +#[googletest::test] fn test_message_opt() { let msg = TestAllTypes::new(); let opt: Optional> = @@ -617,7 +617,7 @@ fn test_message_opt() { assert_that!(opt.into_inner().bb(), eq(0)); } -#[gtest] +#[googletest::test] fn test_message_opt_set() { let mut msg = TestAllTypes::new(); let submsg = test_all_types::NestedMessage::new(); @@ -626,7 +626,7 @@ fn test_message_opt_set() { assert_that!(msg.optional_nested_message_opt().is_set(), eq(false)); } -#[gtest] +#[googletest::test] fn test_setting_submsg() { let mut msg = TestAllTypes::new(); let submsg = test_all_types::NestedMessage::new(); @@ -644,7 +644,7 @@ fn test_setting_submsg() { assert_that!(msg.optional_nested_message_opt().is_set(), eq(false)); } -#[gtest] +#[googletest::test] fn test_msg_mut_initializes() { let mut msg = TestAllTypes::new(); assert_that!(msg.has_optional_nested_message(), eq(false)); @@ -660,7 +660,7 @@ fn test_msg_mut_initializes() { assert_that!(msg.optional_nested_message_opt().is_set(), eq(false)); } -#[gtest] +#[googletest::test] fn test_optional_nested_enum_accessors() { use test_all_types::NestedEnum; @@ -680,7 +680,7 @@ fn test_optional_nested_enum_accessors() { assert_that!(msg.optional_nested_enum(), eq(NestedEnum::Foo)); } -#[gtest] +#[googletest::test] fn test_default_nested_enum_accessors() { use test_all_types::NestedEnum; @@ -697,7 +697,7 @@ fn test_default_nested_enum_accessors() { assert_that!(msg.default_nested_enum_opt(), eq(Optional::Unset(NestedEnum::Bar))); } -#[gtest] +#[googletest::test] fn test_optional_foreign_enum_accessors() { use unittest_rust_proto::ForeignEnum; @@ -714,7 +714,7 @@ fn test_optional_foreign_enum_accessors() { assert_that!(msg.optional_foreign_enum(), eq(ForeignEnum::ForeignFoo)); } -#[gtest] +#[googletest::test] fn test_default_foreign_enum_accessors() { use unittest_rust_proto::ForeignEnum; @@ -731,7 +731,7 @@ fn test_default_foreign_enum_accessors() { assert_that!(msg.default_foreign_enum_opt(), eq(Optional::Unset(ForeignEnum::ForeignBar))); } -#[gtest] +#[googletest::test] fn test_optional_import_enum_accessors() { use unittest_import_rust_proto::ImportEnum; @@ -748,7 +748,7 @@ fn test_optional_import_enum_accessors() { assert_that!(msg.optional_import_enum(), eq(ImportEnum::ImportFoo)); } -#[gtest] +#[googletest::test] fn test_default_import_enum_accessors() { use unittest_import_rust_proto::ImportEnum; @@ -765,7 +765,7 @@ fn test_default_import_enum_accessors() { assert_that!(msg.default_import_enum_opt(), eq(Optional::Unset(ImportEnum::ImportBar))); } -#[gtest] +#[googletest::test] fn test_oneof_accessors() { use unittest_rust_proto::test_oneof2::{Foo::*, FooCase, NestedEnum}; use unittest_rust_proto::TestOneof2; @@ -816,7 +816,7 @@ fn test_oneof_accessors() { // TODO: Add tests covering a message-type field in a oneof. } -#[gtest] +#[googletest::test] fn test_msg_oneof_default_accessors() { use unittest_rust_proto::test_oneof2::{Bar::*, BarCase, NestedEnum}; @@ -848,7 +848,7 @@ fn test_msg_oneof_default_accessors() { // TODO: Add tests covering a message-type field in a oneof. } -#[gtest] +#[googletest::test] fn test_group() { let mut m = TestAllTypes::new(); @@ -861,7 +861,7 @@ fn test_group() { assert_that!(m.optionalgroup().a(), eq(7)); } -#[gtest] +#[googletest::test] fn test_submsg_setter() { use test_all_types::*; @@ -874,7 +874,7 @@ fn test_submsg_setter() { assert_that!(parent.optional_nested_message().bb(), eq(7)); } -#[gtest] +#[googletest::test] fn test_clone() { let mut m = TestAllTypes::new(); m.set_optional_int32(42); @@ -886,7 +886,7 @@ fn test_clone() { assert_that!(clone.optional_int32(), eq(42)); } -#[gtest] +#[googletest::test] fn test_to_owned() { let mut m = TestAllTypes::new(); m.set_optional_int32(42); @@ -910,7 +910,7 @@ fn test_to_owned() { assert_that!(submsg_mut.bb(), eq(8)); } -#[gtest] +#[googletest::test] fn test_ctype_stringpiece() { let mut msg = TestAllTypes::new(); assert_that!(msg.optional_string_piece(), eq("")); @@ -920,7 +920,7 @@ fn test_ctype_stringpiece() { assert_that!(msg.has_optional_string_piece(), eq(true)); } -#[gtest] +#[googletest::test] fn test_msg_clear() { let mut m = TestAllTypes::new(); m.set_optional_int32(42); @@ -929,7 +929,7 @@ fn test_msg_clear() { assert_that!(m.has_optional_int32(), eq(false)); } -#[gtest] +#[googletest::test] fn test_submsg_clear() { let mut m = TestAllTypes::new(); let mut sub = m.optional_nested_message_mut(); diff --git a/rust/test/shared/bad_names_test.rs b/rust/test/shared/bad_names_test.rs index febc0dcc33..a60bfb942b 100644 --- a/rust/test/shared/bad_names_test.rs +++ b/rust/test/shared/bad_names_test.rs @@ -8,20 +8,20 @@ use bad_names_rust_proto::*; use googletest::prelude::*; -#[gtest] +#[googletest::test] fn test_reserved_keyword_in_accessors() { let msg = Self__mangled_because_ident_isnt_a_legal_raw_identifier::new(); let res = msg.self__mangled_because_ident_isnt_a_legal_raw_identifier().r#for(); assert_that!(res, eq(0)); } -#[gtest] +#[googletest::test] fn test_reserved_keyword_in_messages() { let _ = r#enum::new(); let _ = Ref::new().r#const(); } -#[gtest] +#[googletest::test] fn test_collision_in_accessors() { let mut m = AccessorsCollide::new(); m.set_x_mut_5(false); diff --git a/rust/test/shared/child_parent_test.rs b/rust/test/shared/child_parent_test.rs index f25390df9f..b1905a9cb4 100644 --- a/rust/test/shared/child_parent_test.rs +++ b/rust/test/shared/child_parent_test.rs @@ -8,7 +8,7 @@ use googletest::prelude::*; use protobuf::prelude::*; -#[gtest] +#[googletest::test] fn test_canonical_types() { let _child = child_rust_proto::Child::new(); let _parent = parent_rust_proto::Parent::new(); @@ -17,12 +17,12 @@ fn test_canonical_types() { let _parent_from_child: child_rust_proto::Parent = parent_rust_proto::Parent::new(); } -#[gtest] +#[googletest::test] fn test_parent_serialization() { assert_that!(*parent_rust_proto::Parent::new().serialize().unwrap(), empty()); } -#[gtest] +#[googletest::test] fn test_child_serialization() { assert_that!(*child_rust_proto::Child::new().serialize().unwrap(), empty()); } diff --git a/rust/test/shared/ctype_cord_test.rs b/rust/test/shared/ctype_cord_test.rs index ecaa80d93f..9c527b2cbd 100644 --- a/rust/test/shared/ctype_cord_test.rs +++ b/rust/test/shared/ctype_cord_test.rs @@ -9,7 +9,7 @@ use googletest::prelude::*; use unittest_rust_proto::{TestAllTypes, TestCord}; -#[gtest] +#[googletest::test] fn test_bytes_cord() { let mut msg = TestCord::new(); assert_that!(msg.has_optional_bytes_cord(), eq(false)); diff --git a/rust/test/shared/edition2023_test.rs b/rust/test/shared/edition2023_test.rs index 0d0ab1c670..ba31299dcc 100644 --- a/rust/test/shared/edition2023_test.rs +++ b/rust/test/shared/edition2023_test.rs @@ -11,14 +11,14 @@ use googletest::prelude::*; // is _not_ a test for Rust Edition 2023 (which doesn't exist) but instead // Protobuf Edition 2023 (which exists). -#[gtest] +#[googletest::test] fn check_edition2023_works() { let msg = edition2023_rust_proto::EditionsMessage::new(); assert_that!(msg.plain_field_opt().into_inner(), eq(0)); assert_that!(msg.implicit_presence_field(), eq(0)); } -#[gtest] +#[googletest::test] fn string_view_works() { let mut msg = edition2023_rust_proto::EditionsMessage::new(); assert_that!(msg.str_view(), eq("")); @@ -28,7 +28,7 @@ fn string_view_works() { assert_that!(msg.has_str_view(), eq(true)); } -#[gtest] +#[googletest::test] fn repeated_string_view_works() { let mut msg = edition2023_rust_proto::EditionsMessage::new(); assert_that!(msg.repeated_str_view().len(), eq(0)); diff --git a/rust/test/shared/enum_test.rs b/rust/test/shared/enum_test.rs index a6cbfd4200..b4d0900495 100644 --- a/rust/test/shared/enum_test.rs +++ b/rust/test/shared/enum_test.rs @@ -12,7 +12,7 @@ use googletest::prelude::*; use protobuf::Enum; use unittest_rust_proto::*; -#[gtest] +#[googletest::test] fn test_nested_enum_values() { assert_that!(i32::from(test_all_types::NestedEnum::Foo), eq(1)); assert_that!(i32::from(test_all_types::NestedEnum::Bar), eq(2)); @@ -20,19 +20,19 @@ fn test_nested_enum_values() { assert_that!(i32::from(test_all_types::NestedEnum::Neg), eq(-1)); } -#[gtest] +#[googletest::test] fn test_isolated_nested_enum() { // Ensure that the enum is generated even when it's the only nested type for the // message. assert_that!(i32::from(test_required_enum_no_mask::NestedEnum::Foo), eq(2)); } -#[gtest] +#[googletest::test] fn test_enum_value_name_same_as_enum() { assert_that!(i32::from(TestEnumValueNameSameAsEnum::TestEnumValueNameSameAsEnum), eq(1)); } -#[gtest] +#[googletest::test] fn test_enum_defaults() { assert_that!(TestSparseEnum::default(), eq(TestSparseEnum::SparseA)); assert_that!(TestEnumWithDupValue::default(), eq(TestEnumWithDupValue::Foo1)); @@ -44,7 +44,7 @@ fn test_enum_defaults() { assert_that!(test_all_types::NestedEnum::default(), eq(test_all_types::NestedEnum::Foo)); } -#[gtest] +#[googletest::test] #[deny(unreachable_patterns)] #[allow(clippy::let_unit_value)] fn test_closed_enum_is_nonexhaustive() { @@ -58,7 +58,7 @@ fn test_closed_enum_is_nonexhaustive() { }; } -#[gtest] +#[googletest::test] fn test_closed_enum_conversion() { assert_that!(i32::from(TestSparseEnum::SparseA), eq(123)); assert_that!(TestSparseEnum::try_from(123), ok(eq(&TestSparseEnum::SparseA))); @@ -70,7 +70,7 @@ fn test_closed_enum_conversion() { assert_that!(TestSparseEnum::try_from(1), err(anything())); } -#[gtest] +#[googletest::test] fn test_closed_aliased_enum_conversion() { assert_that!(i32::from(TestEnumWithDupValue::Foo1), eq(1)); assert_that!(i32::from(TestEnumWithDupValue::Foo2), eq(1)); @@ -88,7 +88,7 @@ fn test_closed_aliased_enum_conversion() { assert_that!(TestEnumWithDupValue::Bar1, eq(TestEnumWithDupValue::Bar2)); } -#[gtest] +#[googletest::test] #[deny(unreachable_patterns)] #[allow(clippy::let_unit_value)] fn test_open_enum_is_nonexhaustive() { @@ -100,7 +100,7 @@ fn test_open_enum_is_nonexhaustive() { }; } -#[gtest] +#[googletest::test] fn test_open_enum_conversion() { assert_that!(i32::from(TestEnumWithNumericNames::Unknown), eq(0)); assert_that!(i32::from(TestEnumWithNumericNames::_2020), eq(1)); @@ -123,7 +123,7 @@ fn test_open_enum_conversion() { assert_that!(i32::from(TestEnumWithNumericNames::from(-1)), eq(-1)); } -#[gtest] +#[googletest::test] fn test_open_aliased_enum_conversion() { assert_that!(i32::from(TestEnumWithDuplicateStrippedPrefixNames::Unknown), eq(0)); assert_that!(i32::from(TestEnumWithDuplicateStrippedPrefixNames::Foo), eq(1)); @@ -157,19 +157,19 @@ fn test_open_aliased_enum_conversion() { assert_that!(i32::from(TestEnumWithDuplicateStrippedPrefixNames::from(5)), eq(5)); } -#[gtest] +#[googletest::test] fn test_enum_conversion_failure_display() { let err = TestSparseEnum::try_from(1).unwrap_err(); assert_that!(format!("{err}"), eq("1 is not a known value for TestSparseEnum")); } -#[gtest] +#[googletest::test] fn test_enum_conversion_failure_impls_std_error() { let err = TestSparseEnum::try_from(1).unwrap_err(); let _test_compiles: &dyn std::error::Error = &err; } -#[gtest] +#[googletest::test] fn test_is_known_for_closed_enum() { assert_that!(test_all_types::NestedEnum::is_known(-2), eq(false)); assert_that!(test_all_types::NestedEnum::is_known(-1), eq(true)); @@ -180,7 +180,7 @@ fn test_is_known_for_closed_enum() { assert_that!(test_all_types::NestedEnum::is_known(4), eq(false)); } -#[gtest] +#[googletest::test] fn test_is_known_for_open_enum() { assert_that!(TestEnumWithNumericNames::is_known(-1), eq(false)); assert_that!(TestEnumWithNumericNames::is_known(0), eq(true)); diff --git a/rust/test/shared/fields_with_imported_types_test.rs b/rust/test/shared/fields_with_imported_types_test.rs index 8ac233e2ce..9fa6563da1 100644 --- a/rust/test/shared/fields_with_imported_types_test.rs +++ b/rust/test/shared/fields_with_imported_types_test.rs @@ -10,7 +10,7 @@ /// a separate proto_library target. use googletest::prelude::*; -#[gtest] +#[googletest::test] fn test_message_field_generated() { use fields_with_imported_types_rust_proto::MsgWithFieldsWithImportedTypes; use imported_types_rust_proto::ImportedMessageView; @@ -19,7 +19,7 @@ fn test_message_field_generated() { assert_that!(msg.imported_message_field(), matches_pattern!(ImportedMessageView { .. })); } -#[gtest] +#[googletest::test] fn test_enum_field_generated() { use fields_with_imported_types_rust_proto::MsgWithFieldsWithImportedTypes; use imported_types_rust_proto::ImportedEnum; @@ -28,7 +28,7 @@ fn test_enum_field_generated() { assert_that!(msg.imported_enum_field(), eq(ImportedEnum::Unknown)); } -#[gtest] +#[googletest::test] fn test_oneof_message_field_generated() { use fields_with_imported_types_rust_proto::msg_with_fields_with_imported_types::ImportedTypesOneof::not_set; use fields_with_imported_types_rust_proto::MsgWithFieldsWithImportedTypes; diff --git a/rust/test/shared/gtest_matchers_test.rs b/rust/test/shared/gtest_matchers_test.rs index 18931267a9..793342d745 100644 --- a/rust/test/shared/gtest_matchers_test.rs +++ b/rust/test/shared/gtest_matchers_test.rs @@ -16,7 +16,7 @@ use unittest_rust_proto::TestAllTypes; macro_rules! generate_eq_msgs_tests { ($(($type: ident, $name_ext: ident)),*) => { paste! {$( - #[gtest] + #[googletest::test] fn []() { let mut msg = [< $type >]::new(); let mut msg2 = [< $type >]::new(); @@ -33,7 +33,7 @@ macro_rules! generate_eq_msgs_tests { macro_rules! generate_not_eq_msgs_tests { ($(($type: ident, $name_ext: ident)),*) => { paste! {$( - #[gtest] + #[googletest::test] fn []() { let mut msg = [< $type >]::new(); let mut msg2 = [< $type >]::new(); @@ -51,7 +51,7 @@ generate_eq_msgs_tests!((TestAllTypes, editions), (TestAllTypesProto3, proto3)); generate_not_eq_msgs_tests!((TestAllTypes, editions), (TestAllTypesProto3, proto3)); -#[gtest] +#[googletest::test] fn proto_eq_works_on_view() { // This exercises the `impl Matcher for MessageMatcher // where T: MatcherEq + Copy` implementation. diff --git a/rust/test/shared/import_public_test.rs b/rust/test/shared/import_public_test.rs index 253e8fba19..9878ebfc5f 100644 --- a/rust/test/shared/import_public_test.rs +++ b/rust/test/shared/import_public_test.rs @@ -9,7 +9,7 @@ use googletest::prelude::*; -#[gtest] +#[googletest::test] fn test_import_public_types_are_reexported() { let _: import_public_rust_proto::PrimarySrcPubliclyImportedMsg; let _: import_public_rust_proto::PrimarySrcPubliclyImportedMsgView; diff --git a/rust/test/shared/merge_from_test.rs b/rust/test/shared/merge_from_test.rs index e3e4a6940f..feb9e1ad4e 100644 --- a/rust/test/shared/merge_from_test.rs +++ b/rust/test/shared/merge_from_test.rs @@ -2,7 +2,7 @@ use googletest::prelude::*; use protobuf::prelude::*; use unittest_rust_proto::{NestedTestAllTypes, TestAllTypes}; -#[gtest] +#[googletest::test] fn merge_from_empty() { let mut dst = TestAllTypes::new(); let src = TestAllTypes::new(); @@ -10,7 +10,7 @@ fn merge_from_empty() { assert_that!(dst.as_view().has_optional_int32(), eq(false)); } -#[gtest] +#[googletest::test] fn merge_from_non_empty() { let mut dst = TestAllTypes::new(); let src = proto!(TestAllTypes { optional_int32: 42 }); @@ -18,7 +18,7 @@ fn merge_from_non_empty() { assert_eq!(dst.as_view().optional_int32(), 42); } -#[gtest] +#[googletest::test] fn merge_repeated_empty() { let mut dst = TestAllTypes::new(); let mut src = TestAllTypes::new(); @@ -30,7 +30,7 @@ fn merge_repeated_empty() { ); } -#[gtest] +#[googletest::test] fn merge_repeated_non_empty() { let mut dst = TestAllTypes::new(); let mut src = TestAllTypes::new(); @@ -43,7 +43,7 @@ fn merge_repeated_non_empty() { ); } -#[gtest] +#[googletest::test] fn merge_from_sub_message() { let mut dst = NestedTestAllTypes::new(); let src = proto!(NestedTestAllTypes { diff --git a/rust/test/shared/nested_types_test.rs b/rust/test/shared/nested_types_test.rs index 8077cb38d3..75b97825bd 100644 --- a/rust/test/shared/nested_types_test.rs +++ b/rust/test/shared/nested_types_test.rs @@ -9,7 +9,7 @@ use googletest::prelude::*; -#[gtest] +#[googletest::test] fn test_nested_messages_accessible() { let _parent: unittest_rust_proto::TestAllTypes; let _child: unittest_rust_proto::test_all_types::NestedMessage; @@ -17,7 +17,7 @@ fn test_nested_messages_accessible() { nested_test_all_extensions_data::NestedDynamicExtensions::new(); } -#[gtest] +#[googletest::test] fn test_nested_enums_accessible() { let _parent: unittest_rust_proto::TestAllTypes; let _child: unittest_rust_proto::test_all_types::NestedEnum; diff --git a/rust/test/shared/no_internal_access_test.rs b/rust/test/shared/no_internal_access_test.rs index e110b86483..4470faf445 100644 --- a/rust/test/shared/no_internal_access_test.rs +++ b/rust/test/shared/no_internal_access_test.rs @@ -1,7 +1,7 @@ -use googletest::gtest; + use protobuf::{__internal, __runtime}; -#[gtest] +#[googletest::test] #[allow(clippy::unit_cmp)] fn test_no_internal_access() { // This test is to ensure that the `__internal` and `__runtime` mods are diff --git a/rust/test/shared/package_test.rs b/rust/test/shared/package_test.rs index 1cbbab126b..e4c9fb4c1f 100644 --- a/rust/test/shared/package_test.rs +++ b/rust/test/shared/package_test.rs @@ -9,7 +9,7 @@ use googletest::prelude::*; -#[gtest] +#[googletest::test] fn test_message_packages() { // empty package, message declared in the first .proto source let _: no_package_rust_proto::MsgWithoutPackage; @@ -28,7 +28,7 @@ fn test_message_packages() { let _: package_rust_proto::ImportedMsgWithPackage; } -#[gtest] +#[googletest::test] fn test_enum_packages() { // empty package, enum declared in the first .proto source let _: no_package_rust_proto::EnumWithoutPackage; diff --git a/rust/test/shared/proto_macro_test.rs b/rust/test/shared/proto_macro_test.rs index 45ba49ddff..1462bbe2c3 100644 --- a/rust/test/shared/proto_macro_test.rs +++ b/rust/test/shared/proto_macro_test.rs @@ -20,7 +20,7 @@ struct TestValue { val: i64, } -#[gtest] +#[googletest::test] fn test_setting_literals() { let fixed64 = || 108; let test_ref = |x: &i64| *x; @@ -69,7 +69,7 @@ fn test_setting_literals() { assert_that!(msg.optional_nested_enum(), eq(test_all_types::NestedEnum::Baz)); } -#[gtest] +#[googletest::test] fn single_nested_message() { let msg = proto!(TestAllTypes { optional_nested_message: NestedMessage { bb: 42 } }); assert_that!(msg.optional_nested_message().bb(), eq(42)); @@ -124,7 +124,7 @@ fn single_nested_message() { assert_that!(msg.has_optional_nested_message(), eq(true)); } -#[gtest] +#[googletest::test] fn test_recursive_msg() { let msg = proto!(NestedTestAllTypes { child: NestedTestAllTypes { @@ -141,7 +141,7 @@ fn test_recursive_msg() { assert_that!(msg.child().child().child().payload().optional_int32(), eq(43)); } -#[gtest] +#[googletest::test] fn test_spread_msg() { let msg = proto!(TestAllTypes { optional_nested_message: NestedMessage { bb: 42 } }); let msg2 = proto!(TestAllTypes { ..msg.as_view() }); @@ -151,7 +151,7 @@ fn test_spread_msg() { assert_that!(msg3.optional_int32(), eq(1)); } -#[gtest] +#[googletest::test] fn test_spread_nested_msg() { let msg = proto!(NestedTestAllTypes { child: NestedTestAllTypes { @@ -170,7 +170,7 @@ fn test_spread_nested_msg() { assert_that!(msg2.child().child().child().payload().optional_int32(), eq(43)); } -#[gtest] +#[googletest::test] fn test_repeated_i32() { let msg = proto!(TestAllTypes { repeated_int32: [1, 1 + 1, 3] }); assert_that!(msg.repeated_int32().len(), eq(3)); @@ -179,7 +179,7 @@ fn test_repeated_i32() { assert_that!(msg.repeated_int32().get(2).unwrap(), eq(3)); } -#[gtest] +#[googletest::test] fn test_repeated_msg() { let msg2 = proto!(NestedTestAllTypes { payload: TestAllTypes { optional_int32: 1 } }); let msg = proto!(NestedTestAllTypes { @@ -205,7 +205,7 @@ fn test_repeated_msg() { assert_that!(msg.repeated_child().get(1).unwrap().payload().optional_int32(), eq(2)); } -#[gtest] +#[googletest::test] fn test_string_maps() { let msg = proto!(TestMap { map_string_string: [("foo", "bar"), ("baz", "qux"), ("quux", "quuz")] }); @@ -215,7 +215,7 @@ fn test_string_maps() { assert_that!(msg.map_string_string().get("quux").unwrap(), eq("quuz")); } -#[gtest] +#[googletest::test] fn test_message_maps() { let msg3 = proto!(TestAllTypes { optional_int32: 3 }); let kv3 = ("quux", msg3); diff --git a/rust/test/shared/serialization_test.rs b/rust/test/shared/serialization_test.rs index 04ae833b64..c164c65477 100644 --- a/rust/test/shared/serialization_test.rs +++ b/rust/test/shared/serialization_test.rs @@ -17,7 +17,7 @@ use unittest_rust_proto::TestAllTypes; macro_rules! generate_parameterized_serialization_test { ($(($type: ident, $name_ext: ident)),*) => { paste! { $( - #[gtest] + #[googletest::test] fn [< serialization_zero_length_ $name_ext >]() { let mut msg = [< $type >]::new(); @@ -31,13 +31,13 @@ macro_rules! generate_parameterized_serialization_test { assert_that!(serialized.len(), eq(0)); } - #[gtest] + #[googletest::test] fn [< serialize_default_view $name_ext>]() { let default = View::<[< $type >]>::default(); assert_that!(default.serialize().unwrap().len(), eq(0)); } - #[gtest] + #[googletest::test] fn [< serialize_deserialize_message_ $name_ext>]() { let mut msg = [< $type >]::new(); msg.set_optional_int64(42); @@ -52,17 +52,17 @@ macro_rules! generate_parameterized_serialization_test { assert_that!(msg.optional_bytes(), eq(msg2.optional_bytes())); } - #[gtest] + #[googletest::test] fn [< deserialize_empty_ $name_ext>]() { assert!([< $type >]::parse(&[]).is_ok()); } - #[gtest] + #[googletest::test] fn [< deserialize_error_ $name_ext>]() { assert!([< $type >]::parse(b"not a serialized proto").is_err()); } - #[gtest] + #[googletest::test] fn [< set_bytes_with_serialized_data_ $name_ext>]() { let mut msg = [< $type >]::new(); msg.set_optional_int64(42); @@ -72,7 +72,7 @@ macro_rules! generate_parameterized_serialization_test { assert_that!(msg2.optional_bytes(), eq(msg.serialize().unwrap())); } - #[gtest] + #[googletest::test] fn [< deserialize_on_previously_allocated_message_ $name_ext>]() { let mut msg = [< $type >]::new(); msg.set_optional_int64(42); @@ -102,7 +102,7 @@ macro_rules! generate_parameterized_int32_byte_size_test { ($(($type: ident, $name_ext: ident)),*) => { paste! { $( - #[gtest] + #[googletest::test] fn [< test_int32_byte_size_ $name_ext>]() { let args = vec![(0, 1), (127, 1), (128, 2), (-1, 10)]; for arg in args { diff --git a/rust/test/shared/simple_nested_test.rs b/rust/test/shared/simple_nested_test.rs index ed2ce03dca..2fefc466de 100644 --- a/rust/test/shared/simple_nested_test.rs +++ b/rust/test/shared/simple_nested_test.rs @@ -10,7 +10,7 @@ use nested_rust_proto::outer::inner::InnerEnum; use nested_rust_proto::outer::InnerView; use nested_rust_proto::*; -#[gtest] +#[googletest::test] fn test_deeply_nested_message() { let deep = outer::inner::super_inner::duper_inner::even_more_inner::CantBelieveItsSoInner::new(); @@ -20,7 +20,7 @@ fn test_deeply_nested_message() { assert_that!(outermsg.deep().num(), eq(0)); } -#[gtest] +#[googletest::test] fn test_deeply_nested_enum() { use outer::inner::super_inner::duper_inner::even_more_inner::JustWayTooInner; let deep = JustWayTooInner::default(); @@ -30,7 +30,7 @@ fn test_deeply_nested_enum() { assert_that!(outermsg.deep_enum(), eq(JustWayTooInner::Unspecified)); } -#[gtest] +#[googletest::test] fn test_nested_views() { let outermsg = Outer::new(); let inner_msg: InnerView<'_> = outermsg.inner(); @@ -53,7 +53,7 @@ fn test_nested_views() { assert_that!(inner_msg.inner_enum(), eq(InnerEnum::Unspecified)); } -#[gtest] +#[googletest::test] fn test_nested_view_lifetimes() { // Ensure that views have the lifetime of the first layer of borrow, and don't // create intermediate borrows through nested accessors. @@ -79,7 +79,7 @@ fn test_nested_view_lifetimes() { assert_that!(string_map.len(), eq(0)); } -#[gtest] +#[googletest::test] fn test_msg_from_outside() { // let's make sure that we're not just working for messages nested inside // messages, messages from without and within should work @@ -87,7 +87,7 @@ fn test_msg_from_outside() { assert_that!(outer.notinside().num(), eq(0)); } -#[gtest] +#[googletest::test] fn test_recursive_view() { let rec = nested_rust_proto::Recursive::new(); assert_that!(rec.num(), eq(0)); @@ -100,7 +100,7 @@ fn test_recursive_view() { assert_that!(nested.num(), eq(0)); } -#[gtest] +#[googletest::test] fn test_recursive_mut() { let mut rec = nested_rust_proto::Recursive::new(); let mut one = rec.rec_mut(); diff --git a/rust/test/shared/utf8/utf8_test.rs b/rust/test/shared/utf8/utf8_test.rs index 620ae237d5..a213136cb1 100644 --- a/rust/test/shared/utf8/utf8_test.rs +++ b/rust/test/shared/utf8/utf8_test.rs @@ -36,7 +36,7 @@ fn make_non_utf8_proto_str() -> &'static ProtoStr { } } -#[gtest] +#[googletest::test] fn test_proto2() { let non_utf8_str = make_non_utf8_proto_str(); @@ -54,7 +54,7 @@ fn test_proto2() { assert_that!(parsed_result, ok(anything())); } -#[gtest] +#[googletest::test] fn test_proto3() { let non_utf8_str = make_non_utf8_proto_str(); @@ -72,7 +72,7 @@ fn test_proto3() { assert_that!(parsed_result, err(matches_pattern!(&ParseError))); } -#[gtest] +#[googletest::test] fn test_verify() { let non_utf8_str = make_non_utf8_proto_str(); diff --git a/rust/test/upb/debug_string_test.rs b/rust/test/upb/debug_string_test.rs index a3c59063a6..9cc3457f1e 100644 --- a/rust/test/upb/debug_string_test.rs +++ b/rust/test/upb/debug_string_test.rs @@ -13,7 +13,7 @@ use unittest_rust_proto::{ test_all_types::NestedMessage as NestedMessageProto2, TestAllTypes as TestAllTypesProto2, }; -#[gtest] +#[googletest::test] fn test_debug_string() { let mut msg = proto!(TestAllTypesProto2 { optional_int32: 42, diff --git a/rust/test/upb/string_ctypes_test.rs b/rust/test/upb/string_ctypes_test.rs index 4d8941f922..7999a58e45 100644 --- a/rust/test/upb/string_ctypes_test.rs +++ b/rust/test/upb/string_ctypes_test.rs @@ -8,7 +8,7 @@ use googletest::prelude::*; use unittest_proto3_rust_proto::TestAllTypes; -#[gtest] +#[googletest::test] fn test_stringpiece_repeated() { let mut msg = TestAllTypes::new(); assert_that!(msg.repeated_string_piece().len(), eq(0)); @@ -17,7 +17,7 @@ fn test_stringpiece_repeated() { assert_that!(msg.repeated_string_piece().get(0), some(eq("hello"))); } -#[gtest] +#[googletest::test] fn test_cord_repeated() { let mut msg = TestAllTypes::new(); assert_that!(msg.repeated_cord().len(), eq(0)); diff --git a/rust/upb/arena.rs b/rust/upb/arena.rs index 3429d54768..9ebe008c64 100644 --- a/rust/upb/arena.rs +++ b/rust/upb/arena.rs @@ -204,9 +204,9 @@ extern "C" { #[cfg(test)] mod tests { use super::*; - use googletest::gtest; + - #[gtest] + #[googletest::test] fn assert_arena_linked() { use crate::assert_linked; assert_linked!(upb_Arena_New); @@ -215,7 +215,7 @@ mod tests { assert_linked!(upb_Arena_Fuse); } - #[gtest] + #[googletest::test] fn raw_ffi_test() { // SAFETY: FFI unit test uses C API under expected patterns. unsafe { @@ -226,7 +226,7 @@ mod tests { } } - #[gtest] + #[googletest::test] fn test_arena_new_and_free() { let arena = Arena::new(); drop(arena); diff --git a/rust/upb/array.rs b/rust/upb/array.rs index f818ea9167..06a0851dd1 100644 --- a/rust/upb/array.rs +++ b/rust/upb/array.rs @@ -29,9 +29,9 @@ extern "C" { mod tests { use super::super::Arena; use super::*; - use googletest::gtest; + - #[gtest] + #[googletest::test] fn assert_array_linked() { use crate::assert_linked; assert_linked!(upb_Array_New); @@ -46,7 +46,7 @@ mod tests { assert_linked!(upb_Array_GetMutable); } - #[gtest] + #[googletest::test] fn array_ffi_test() { // SAFETY: FFI unit test uses C API under expected patterns. unsafe { diff --git a/rust/upb/map.rs b/rust/upb/map.rs index afddb42c17..74a193dd08 100644 --- a/rust/upb/map.rs +++ b/rust/upb/map.rs @@ -51,9 +51,9 @@ extern "C" { mod tests { use super::super::Arena; use super::*; - use googletest::gtest; + - #[gtest] + #[googletest::test] fn assert_map_linked() { use crate::assert_linked; assert_linked!(upb_Map_New); @@ -65,7 +65,7 @@ mod tests { assert_linked!(upb_Map_Next); } - #[gtest] + #[googletest::test] fn map_ffi_test() { // SAFETY: FFI unit test uses C API under expected patterns. unsafe { diff --git a/rust/upb/message.rs b/rust/upb/message.rs index 0a89dde180..f983789ae3 100644 --- a/rust/upb/message.rs +++ b/rust/upb/message.rs @@ -306,9 +306,9 @@ extern "C" { #[cfg(test)] mod tests { use super::*; - use googletest::gtest; + - #[gtest] + #[googletest::test] fn assert_message_linked() { use crate::assert_linked; assert_linked!(upb_Message_New); diff --git a/rust/upb/mini_table.rs b/rust/upb/mini_table.rs index db76fcf14b..061b28de7c 100644 --- a/rust/upb/mini_table.rs +++ b/rust/upb/mini_table.rs @@ -50,9 +50,9 @@ extern "C" { #[cfg(test)] mod tests { use super::*; - use googletest::gtest; + - #[gtest] + #[googletest::test] fn assert_mini_table_linked() { use crate::assert_linked; assert_linked!(upb_MiniTable_FindFieldByNumber); diff --git a/rust/upb/owned_arena_box.rs b/rust/upb/owned_arena_box.rs index 956c76a52b..39044b315a 100644 --- a/rust/upb/owned_arena_box.rs +++ b/rust/upb/owned_arena_box.rs @@ -88,9 +88,9 @@ impl Debug for OwnedArenaBox { mod tests { use super::*; use core::str; - use googletest::gtest; + - #[gtest] + #[googletest::test] fn test_byte_slice_pointer_roundtrip() { let arena = Arena::new(); let original_data: &'static [u8] = b"Hello world"; @@ -98,7 +98,7 @@ mod tests { assert_eq!(&*owned_data, b"Hello world"); } - #[gtest] + #[googletest::test] fn test_alloc_str_roundtrip() { let arena = Arena::new(); let s: &str = "Hello"; @@ -107,7 +107,7 @@ mod tests { assert_eq!(&*owned_data, s); } - #[gtest] + #[googletest::test] fn test_sized_type_roundtrip() { let arena = Arena::new(); let arena_alloc_u32: NonNull = arena.copy_in(&7u32).unwrap().into(); diff --git a/rust/upb/text.rs b/rust/upb/text.rs index 39d164439b..6ea4f121df 100644 --- a/rust/upb/text.rs +++ b/rust/upb/text.rs @@ -68,9 +68,9 @@ pub unsafe fn debug_string(msg: RawMessage, mt: *const upb_MiniTable) -> String #[cfg(test)] mod tests { use super::*; - use googletest::gtest; + - #[gtest] + #[googletest::test] fn assert_text_linked() { use crate::assert_linked; assert_linked!(upb_DebugString); diff --git a/rust/upb/wire.rs b/rust/upb/wire.rs index b407360cf0..7a79fb6615 100644 --- a/rust/upb/wire.rs +++ b/rust/upb/wire.rs @@ -126,9 +126,9 @@ extern "C" { #[cfg(test)] mod tests { use super::*; - use googletest::gtest; + - #[gtest] + #[googletest::test] fn assert_wire_linked() { use crate::assert_linked; assert_linked!(upb_Encode);