diff --git a/Cargo.bazel.lock b/Cargo.bazel.lock index 0d1aa040f8..23fe9e5ef7 100644 --- a/Cargo.bazel.lock +++ b/Cargo.bazel.lock @@ -1,5 +1,5 @@ { - "checksum": "b4edbf28ea96b685a90948d9efaa14d55f0f01e27b5d774b3ecd6eff3c231517", + "checksum": "ca8913cc78d0ec771c537fae8d8e7b4505ab91bd61ddc886cc66dbeb264ff626", "crates": { "aho-corasick 1.1.2": { "name": "aho-corasick", @@ -123,7 +123,7 @@ "deps": { "common": [ { - "id": "googletest 0.11.0", + "id": "googletest 0.12.0", "target": "googletest" } ], @@ -145,15 +145,15 @@ "license_ids": [], "license_file": null }, - "googletest 0.11.0": { + "googletest 0.12.0": { "name": "googletest", - "version": "0.11.0", + "version": "0.12.0", "package_url": "https://github.com/google/googletest-rust", "repository": { "Git": { "remote": "https://github.com/google/googletest-rust", "commitish": { - "Rev": "471d4a2a8e8bc74f6d7d9c8eecb4d4e3157b2a9f" + "Rev": "b407f3b5774defb8917d714bfb7af485e117d621" }, "strip_prefix": "googletest" } @@ -194,7 +194,7 @@ "proc_macro_deps": { "common": [ { - "id": "googletest_macro 0.11.0", + "id": "googletest_macro 0.12.0", "target": "googletest_macro" }, { @@ -204,7 +204,7 @@ ], "selects": {} }, - "version": "0.11.0" + "version": "0.12.0" }, "license": "Apache-2.0", "license_ids": [ @@ -212,15 +212,15 @@ ], "license_file": "LICENSE" }, - "googletest_macro 0.11.0": { + "googletest_macro 0.12.0": { "name": "googletest_macro", - "version": "0.11.0", + "version": "0.12.0", "package_url": "https://github.com/google/googletest-rust", "repository": { "Git": { "remote": "https://github.com/google/googletest-rust", "commitish": { - "Rev": "471d4a2a8e8bc74f6d7d9c8eecb4d4e3157b2a9f" + "Rev": "b407f3b5774defb8917d714bfb7af485e117d621" }, "strip_prefix": "googletest_macro" } @@ -258,7 +258,7 @@ "selects": {} }, "edition": "2021", - "version": "0.11.0" + "version": "0.12.0" }, "license": "Apache-2.0", "license_ids": [ @@ -1092,8 +1092,8 @@ ] }, "direct_deps": [ - "googletest 0.11.0", + "googletest 0.12.0", "paste 1.0.14" ], "direct_dev_deps": [] -} \ No newline at end of file +} diff --git a/Cargo.lock b/Cargo.lock index be9bb77bad..28d1f37a51 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -27,8 +27,8 @@ dependencies = [ [[package]] name = "googletest" -version = "0.11.0" -source = "git+https://github.com/google/googletest-rust?rev=471d4a2a8e8bc74f6d7d9c8eecb4d4e3157b2a9f#471d4a2a8e8bc74f6d7d9c8eecb4d4e3157b2a9f" +version = "0.12.0" +source = "git+https://github.com/google/googletest-rust?rev=b407f3b5774defb8917d714bfb7af485e117d621#b407f3b5774defb8917d714bfb7af485e117d621" dependencies = [ "googletest_macro", "num-traits", @@ -38,8 +38,8 @@ dependencies = [ [[package]] name = "googletest_macro" -version = "0.11.0" -source = "git+https://github.com/google/googletest-rust?rev=471d4a2a8e8bc74f6d7d9c8eecb4d4e3157b2a9f#471d4a2a8e8bc74f6d7d9c8eecb4d4e3157b2a9f" +version = "0.12.0" +source = "git+https://github.com/google/googletest-rust?rev=b407f3b5774defb8917d714bfb7af485e117d621#b407f3b5774defb8917d714bfb7af485e117d621" dependencies = [ "quote", "syn", diff --git a/WORKSPACE b/WORKSPACE index 0459aff61a..00a804faf9 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -220,7 +220,7 @@ crates_repository( packages = { "googletest": crate.spec( git = "https://github.com/google/googletest-rust", - rev = "471d4a2a8e8bc74f6d7d9c8eecb4d4e3157b2a9f", + rev = "b407f3b5774defb8917d714bfb7af485e117d621", ), "paste": crate.spec( version = ">=1", diff --git a/rust/cpp.rs b/rust/cpp.rs index dcb54bd2ea..766a269aa5 100644 --- a/rust/cpp.rs +++ b/rust/cpp.rs @@ -1019,14 +1019,14 @@ mod tests { (content.as_mut_ptr(), content.len()) } - #[googletest::test] + #[gtest] 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")); } - #[googletest::test] + #[gtest] 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 ec72d9a49e..ee0f87ef83 100644 --- a/rust/map.rs +++ b/rust/map.rs @@ -516,7 +516,7 @@ mod tests { use crate::{ProtoBytes, ProtoStr, ProtoString}; use googletest::prelude::*; - #[googletest::test] + #[gtest] fn test_proxied_scalar() { let mut map: Map = Map::new(); let mut map_mut = map.as_mut(); @@ -542,7 +542,7 @@ mod tests { assert_that!(map_view_4.is_empty(), eq(false)); } - #[googletest::test] + #[gtest] fn test_proxied_str() { let mut map: Map = Map::new(); let mut map_mut = map.as_mut(); @@ -567,7 +567,7 @@ mod tests { assert_that!(map_view_4.is_empty(), eq(false)); } - #[googletest::test] + #[gtest] fn test_proxied_iter() { let mut map: Map = Map::new(); let mut map_mut = map.as_mut(); @@ -614,7 +614,7 @@ mod tests { ); } - #[googletest::test] + #[gtest] fn test_overwrite_insert() { let mut map: Map = Map::new(); let mut map_mut = map.as_mut(); @@ -624,7 +624,7 @@ mod tests { assert_that!(map.as_mut(), unordered_elements_are![eq((0, ProtoStr::from_str("buzz"))),]); } - #[googletest::test] + #[gtest] fn test_extend() { let mut map: Map = Map::new(); let mut map_mut = map.as_mut(); @@ -661,7 +661,7 @@ mod tests { ); } - #[googletest::test] + #[gtest] fn test_copy_from() { let mut map: Map = Map::new(); let mut map_mut = map.as_mut(); @@ -692,7 +692,7 @@ mod tests { ); } - #[googletest::test] + #[gtest] fn test_all_maps_can_be_constructed() { macro_rules! gen_proto_values { ($key_t:ty, $($value_t:ty),*) => { @@ -714,7 +714,7 @@ mod tests { gen_proto_keys!(i32, u32, i64, u64, bool, ProtoString); } - #[googletest::test] + #[gtest] 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 32147908b5..2aab4e016a 100644 --- a/rust/proxied.rs +++ b/rust/proxied.rs @@ -371,7 +371,7 @@ mod tests { impl<'msg> MutProxy<'msg> for MyProxiedMut<'msg> {} - #[googletest::test] + #[gtest] fn test_as_view() { let my_proxied = MyProxied { val: "Hello World".to_string() }; @@ -386,7 +386,7 @@ mod tests { x.into_view() // OK: we return the same lifetime as we got in. } - #[googletest::test] + #[gtest] fn test_mut_into_view() { let mut my_proxied = MyProxied { val: "Hello World".to_string() }; reborrow_mut_into_view(my_proxied.as_mut()); @@ -394,7 +394,7 @@ mod tests { fn require_unified_lifetimes<'msg>(_x: Mut<'msg, MyProxied>, _y: View<'msg, MyProxied>) {} - #[googletest::test] + #[gtest] fn test_require_unified_lifetimes() { let mut my_proxied = MyProxied { val: "Hello1".to_string() }; let my_mut = my_proxied.as_mut(); @@ -419,7 +419,7 @@ mod tests { [x.as_view(), y.as_view()] } - #[googletest::test] + #[gtest] fn test_reborrow_generic_as_view() { let mut my_proxied = MyProxied { val: "Hello1".to_string() }; let mut my_mut = my_proxied.as_mut(); @@ -446,7 +446,7 @@ mod tests { [x.into_view(), y] } - #[googletest::test] + #[gtest] fn test_reborrow_generic_into_view() { let my_proxied = MyProxied { val: "Hello1".to_string() }; let my_view = my_proxied.as_view(); @@ -466,7 +466,7 @@ mod tests { [x.into_view(), y] } - #[googletest::test] + #[gtest] fn test_reborrow_generic_mut_into_view() { let mut my_proxied = MyProxied { val: "Hello1".to_string() }; let my_mut = my_proxied.as_mut(); @@ -490,7 +490,7 @@ mod tests { [tmp, y] } - #[googletest::test] + #[gtest] 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 1fd5e0e364..9e8ab97ac1 100644 --- a/rust/repeated.rs +++ b/rust/repeated.rs @@ -585,7 +585,7 @@ mod tests { use super::*; use googletest::prelude::*; - #[googletest::test] + #[gtest] fn test_primitive_repeated() { macro_rules! primitive_repeated_tests { ($($t:ty => [$($vals:expr),* $(,)?]),* $(,)?) => { @@ -626,7 +626,7 @@ mod tests { ); } - #[googletest::test] + #[gtest] 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)]); } - #[googletest::test] + #[gtest] 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 7c758783be..cc473039f0 100644 --- a/rust/string.rs +++ b/rust/string.rs @@ -606,6 +606,7 @@ unsafe impl Sync for ProtoBytes {} #[cfg(test)] mod tests { use super::*; + use googletest::prelude::*; // TODO: Add unit tests @@ -620,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 - #[googletest::test] + #[gtest] fn proto_str_debug() { assert_eq!(&format!("{:?}", test_proto_str(b"Hello There")), "\"Hello There\""); assert_eq!( @@ -632,7 +633,7 @@ mod tests { ); } - #[googletest::test] + #[gtest] fn proto_str_display() { assert_eq!(&test_proto_str(b"Hello There").to_string(), "Hello There"); assert_eq!( @@ -641,7 +642,7 @@ mod tests { ); } - #[googletest::test] + #[gtest] 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")); @@ -661,7 +662,7 @@ mod tests { } } - #[googletest::test] + #[gtest] fn proto_str_to_cow() { assert_eq!(test_proto_str(b"hello").to_cow_lossy(), Cow::Borrowed("hello")); assert_eq!( @@ -683,12 +684,12 @@ mod tests { } } - #[googletest::test] + #[gtest] fn proto_str_utf8_chunks() { macro_rules! assert_chunks { ($bytes:expr, $($chunks:expr),* $(,)?) => { let bytes = $bytes; - let chunks: &[Result<&str, &[u8]>] = &[$($chunks),*]; + let chunks: &[std::result::Result<&str, &[u8]>] = &[$($chunks),*]; let s = test_proto_str(bytes); let mut got_chunks = s.utf8_chunks(); let mut expected_chars = chunks.iter().copied(); @@ -762,7 +763,7 @@ mod tests { ); } - #[googletest::test] + #[gtest] 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 2b784a9a9b..d1e50f9712 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))] -#[googletest::test] +#[gtest] fn test_debug() { let mut msg = DebugMsg::new(); msg.set_id(1); @@ -14,7 +14,7 @@ fn test_debug() { } #[cfg(lite_runtime)] -#[googletest::test] +#[gtest] fn test_debug_lite() { let mut msg = DebugMsg::new(); msg.set_id(1); @@ -27,7 +27,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. -#[googletest::test] +#[gtest] 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 467f4559d0..398d94b8a0 100644 --- a/rust/test/cpp/interop/main.rs +++ b/rust/test/cpp/interop/main.rs @@ -36,7 +36,7 @@ extern "C" { fn GetBytesExtension(msg: RawMessage) -> PtrAndLen; } -#[googletest::test] +#[gtest] fn send_to_cpp() { let mut msg1 = TestAllTypes::new(); msg1.set_optional_int32(7); @@ -44,7 +44,7 @@ fn send_to_cpp() { assert_eq!(i, 7); } -#[googletest::test] +#[gtest] fn mutate_message_mut_in_cpp() { let mut msg1 = TestAllTypes::new(); unsafe { @@ -59,7 +59,7 @@ fn mutate_message_mut_in_cpp() { proto_assert_eq!(msg1, msg2); } -#[googletest::test] +#[gtest] fn deserialize_in_rust() { let mut msg1 = TestAllTypes::new(); msg1.set_optional_int64(-1); @@ -70,7 +70,7 @@ fn deserialize_in_rust() { proto_assert_eq!(msg1, msg2); } -#[googletest::test] +#[gtest] fn deserialize_in_cpp() { let mut msg1 = TestAllTypes::new(); msg1.set_optional_int64(-1); @@ -87,7 +87,7 @@ fn deserialize_in_cpp() { proto_assert_eq!(msg1, msg2); } -#[googletest::test] +#[gtest] fn deserialize_in_cpp_into_mut() { let mut msg1 = TestAllTypes::new(); msg1.set_optional_int64(-1); @@ -105,7 +105,7 @@ fn deserialize_in_cpp_into_mut() { } } -#[googletest::test] +#[gtest] fn deserialize_in_cpp_into_view() { let mut msg1 = TestAllTypes::new(); msg1.set_optional_int64(-1); @@ -125,7 +125,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. -#[googletest::test] +#[gtest] fn smuggle_extension() { let msg1 = unsafe { TestAllExtensions::__unstable_take_ownership_of_raw_message(NewWithExtension()) }; diff --git a/rust/test/shared/accessors_map_test.rs b/rust/test/shared/accessors_map_test.rs index 942efb6efd..6e71b7ec3c 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! { $( - #[googletest::test] + #[gtest] 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), ); -#[googletest::test] +#[gtest] fn collect_as_hashmap() { // Highlights conversion from protobuf map to hashmap. let mut msg = TestMap::new(); @@ -115,7 +115,7 @@ fn collect_as_hashmap() { ); } -#[googletest::test] +#[gtest] 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)); } -#[googletest::test] +#[gtest] 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); } -#[googletest::test] +#[gtest] 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")); } -#[googletest::test] +#[gtest] fn test_map_setter() { // Set Map { @@ -268,7 +268,7 @@ macro_rules! generate_map_with_msg_values_tests { $(,)? ) => { paste! { $( - #[googletest::test] + #[gtest] 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 1df120d1a1..c23356f404 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}; -#[googletest::test] +#[gtest] 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)); } -#[googletest::test] +#[gtest] 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)); } -#[googletest::test] +#[gtest] 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()); } -#[googletest::test] +#[gtest] 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"[..]))); } -#[googletest::test] +#[gtest] 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()); } -#[googletest::test] +#[gtest] 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()))); } -#[googletest::test] +#[gtest] 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)); } -#[googletest::test] +#[gtest] 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))); } -#[googletest::test] +#[gtest] 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)); } -#[googletest::test] +#[gtest] 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(_))); } -#[googletest::test] +#[gtest] 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)))); } -#[googletest::test] +#[gtest] 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)); } -#[googletest::test] +#[gtest] 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)); } -#[googletest::test] +#[gtest] 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")); } -#[googletest::test] +#[gtest] 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)); } -#[googletest::test] +#[gtest] 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 c1de003561..e838c2cf38 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! { $( - #[googletest::test] + #[gtest] 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 { ); } - #[googletest::test] + #[gtest] 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 { ); } - #[googletest::test] + #[gtest] 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) ); -#[googletest::test] +#[gtest] 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))); } -#[googletest::test] +#[gtest] 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))); } -#[googletest::test] +#[gtest] fn test_repeated_enum_set() { use test_all_types::NestedEnum; @@ -184,7 +184,7 @@ fn test_repeated_enum_set() { ); } -#[googletest::test] +#[gtest] 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::>())); } -#[googletest::test] +#[gtest] fn test_repeated_message() { let mut msg = TestAllTypes::new(); assert_that!(msg.repeated_nested_message().len(), eq(0)); @@ -230,7 +230,7 @@ fn test_repeated_message() { assert_that!(msg2.repeated_nested_message().len(), eq(0)); } -#[googletest::test] +#[gtest] fn test_repeated_message_setter() { let mut msg = TestAllTypes::new(); let mut nested = NestedMessage::new(); @@ -239,7 +239,7 @@ fn test_repeated_message_setter() { assert_that!(msg.repeated_nested_message().get(0).unwrap().bb(), eq(1)); } -#[googletest::test] +#[gtest] fn test_repeated_strings() { let mut older_msg = TestAllTypes::new(); { @@ -274,7 +274,7 @@ fn test_repeated_strings() { assert_that!(older_msg.repeated_string(), empty()); } -#[googletest::test] +#[gtest] 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 af020f8ba4..d76ec8965b 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}; -#[googletest::test] +#[gtest] 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())); } -#[googletest::test] +#[gtest] 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)); } -#[googletest::test] +#[gtest] 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))); } -#[googletest::test] +#[gtest] 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)); } -#[googletest::test] +#[gtest] 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))); } -#[googletest::test] +#[gtest] 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)); } -#[googletest::test] +#[gtest] 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))); } -#[googletest::test] +#[gtest] 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)); } -#[googletest::test] +#[gtest] 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))); } -#[googletest::test] +#[gtest] 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)); } -#[googletest::test] +#[gtest] 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))); } -#[googletest::test] +#[gtest] 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)); } -#[googletest::test] +#[gtest] 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))); } -#[googletest::test] +#[gtest] 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)); } -#[googletest::test] +#[gtest] 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))); } -#[googletest::test] +#[gtest] 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)); } -#[googletest::test] +#[gtest] 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))); } -#[googletest::test] +#[gtest] 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)); } -#[googletest::test] +#[gtest] 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))); } -#[googletest::test] +#[gtest] 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)); } -#[googletest::test] +#[gtest] 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))); } -#[googletest::test] +#[gtest] 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))); } -#[googletest::test] +#[gtest] 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))); } -#[googletest::test] +#[gtest] 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""[..]))); } -#[googletest::test] +#[gtest] 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")); } -#[googletest::test] +#[gtest] 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"[..]))); } -#[googletest::test] +#[gtest] 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()))); } -#[googletest::test] +#[gtest] 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")); } -#[googletest::test] +#[gtest] 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()))); } -#[googletest::test] +#[gtest] 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)); } -#[googletest::test] +#[gtest] 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)); } -#[googletest::test] +#[gtest] 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)); } -#[googletest::test] +#[gtest] 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)); } -#[googletest::test] +#[gtest] 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)); } -#[googletest::test] +#[gtest] 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)); } -#[googletest::test] +#[gtest] 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))); } -#[googletest::test] +#[gtest] 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)); } -#[googletest::test] +#[gtest] 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))); } -#[googletest::test] +#[gtest] fn test_optional_import_enum_accessors() { use unittest_rust_proto::ImportEnum; @@ -748,7 +748,7 @@ fn test_optional_import_enum_accessors() { assert_that!(msg.optional_import_enum(), eq(ImportEnum::ImportFoo)); } -#[googletest::test] +#[gtest] fn test_default_import_enum_accessors() { use unittest_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))); } -#[googletest::test] +#[gtest] 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. } -#[googletest::test] +#[gtest] 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. } -#[googletest::test] +#[gtest] fn test_group() { let mut m = TestAllTypes::new(); @@ -861,7 +861,7 @@ fn test_group() { assert_that!(m.optionalgroup().a(), eq(7)); } -#[googletest::test] +#[gtest] 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)); } -#[googletest::test] +#[gtest] 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)); } -#[googletest::test] +#[gtest] 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)); } -#[googletest::test] +#[gtest] 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)); } -#[googletest::test] +#[gtest] 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)); } -#[googletest::test] +#[gtest] 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 a60bfb942b..febc0dcc33 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::*; -#[googletest::test] +#[gtest] 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)); } -#[googletest::test] +#[gtest] fn test_reserved_keyword_in_messages() { let _ = r#enum::new(); let _ = Ref::new().r#const(); } -#[googletest::test] +#[gtest] 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 b1905a9cb4..f25390df9f 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::*; -#[googletest::test] +#[gtest] 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(); } -#[googletest::test] +#[gtest] fn test_parent_serialization() { assert_that!(*parent_rust_proto::Parent::new().serialize().unwrap(), empty()); } -#[googletest::test] +#[gtest] 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 2879af1906..0e46dab714 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}; -#[googletest::test] +#[gtest] fn test_string_cord() { let mut msg = TestAllTypes::new(); assert_that!(msg.has_optional_cord(), eq(false)); @@ -23,7 +23,7 @@ fn test_string_cord() { assert_that!(msg2.optional_cord(), eq("hello")); } -#[googletest::test] +#[gtest] 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 ba31299dcc..0d0ab1c670 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). -#[googletest::test] +#[gtest] 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)); } -#[googletest::test] +#[gtest] 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)); } -#[googletest::test] +#[gtest] 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 b4d0900495..a6cbfd4200 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::*; -#[googletest::test] +#[gtest] 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)); } -#[googletest::test] +#[gtest] 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)); } -#[googletest::test] +#[gtest] fn test_enum_value_name_same_as_enum() { assert_that!(i32::from(TestEnumValueNameSameAsEnum::TestEnumValueNameSameAsEnum), eq(1)); } -#[googletest::test] +#[gtest] 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)); } -#[googletest::test] +#[gtest] #[deny(unreachable_patterns)] #[allow(clippy::let_unit_value)] fn test_closed_enum_is_nonexhaustive() { @@ -58,7 +58,7 @@ fn test_closed_enum_is_nonexhaustive() { }; } -#[googletest::test] +#[gtest] 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())); } -#[googletest::test] +#[gtest] 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)); } -#[googletest::test] +#[gtest] #[deny(unreachable_patterns)] #[allow(clippy::let_unit_value)] fn test_open_enum_is_nonexhaustive() { @@ -100,7 +100,7 @@ fn test_open_enum_is_nonexhaustive() { }; } -#[googletest::test] +#[gtest] 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)); } -#[googletest::test] +#[gtest] 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)); } -#[googletest::test] +#[gtest] 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")); } -#[googletest::test] +#[gtest] fn test_enum_conversion_failure_impls_std_error() { let err = TestSparseEnum::try_from(1).unwrap_err(); let _test_compiles: &dyn std::error::Error = &err; } -#[googletest::test] +#[gtest] 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)); } -#[googletest::test] +#[gtest] 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 9fa6563da1..8ac233e2ce 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::*; -#[googletest::test] +#[gtest] 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 { .. })); } -#[googletest::test] +#[gtest] 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)); } -#[googletest::test] +#[gtest] 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/import_public_test.rs b/rust/test/shared/import_public_test.rs index 6299219151..253e8fba19 100644 --- a/rust/test/shared/import_public_test.rs +++ b/rust/test/shared/import_public_test.rs @@ -7,7 +7,9 @@ //! Tests covering codegen of import public statements. -#[googletest::test] +use googletest::prelude::*; + +#[gtest] 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 feb9e1ad4e..e3e4a6940f 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}; -#[googletest::test] +#[gtest] 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)); } -#[googletest::test] +#[gtest] 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); } -#[googletest::test] +#[gtest] fn merge_repeated_empty() { let mut dst = TestAllTypes::new(); let mut src = TestAllTypes::new(); @@ -30,7 +30,7 @@ fn merge_repeated_empty() { ); } -#[googletest::test] +#[gtest] fn merge_repeated_non_empty() { let mut dst = TestAllTypes::new(); let mut src = TestAllTypes::new(); @@ -43,7 +43,7 @@ fn merge_repeated_non_empty() { ); } -#[googletest::test] +#[gtest] 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 8f04d9f38d..8077cb38d3 100644 --- a/rust/test/shared/nested_types_test.rs +++ b/rust/test/shared/nested_types_test.rs @@ -7,7 +7,9 @@ //! Tests covering nested types. -#[googletest::test] +use googletest::prelude::*; + +#[gtest] fn test_nested_messages_accessible() { let _parent: unittest_rust_proto::TestAllTypes; let _child: unittest_rust_proto::test_all_types::NestedMessage; @@ -15,7 +17,7 @@ fn test_nested_messages_accessible() { nested_test_all_extensions_data::NestedDynamicExtensions::new(); } -#[googletest::test] +#[gtest] 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/package_test.rs b/rust/test/shared/package_test.rs index 67a854d6d3..1cbbab126b 100644 --- a/rust/test/shared/package_test.rs +++ b/rust/test/shared/package_test.rs @@ -7,7 +7,9 @@ //! Tests covering proto packages. -#[googletest::test] +use googletest::prelude::*; + +#[gtest] fn test_message_packages() { // empty package, message declared in the first .proto source let _: no_package_rust_proto::MsgWithoutPackage; @@ -26,7 +28,7 @@ fn test_message_packages() { let _: package_rust_proto::ImportedMsgWithPackage; } -#[googletest::test] +#[gtest] 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 5085cb73f5..fa86f5dd7f 100644 --- a/rust/test/shared/proto_macro_test.rs +++ b/rust/test/shared/proto_macro_test.rs @@ -18,7 +18,7 @@ struct TestValue { val: i64, } -#[googletest::test] +#[gtest] fn test_setting_literals() { let fixed64 = || 108; let test_ref = |x: &i64| *x; @@ -67,7 +67,7 @@ fn test_setting_literals() { assert_that!(msg.optional_nested_enum(), eq(test_all_types::NestedEnum::Baz)); } -#[googletest::test] +#[gtest] fn single_nested_message() { let msg = proto!(TestAllTypes { optional_nested_message: NestedMessage { bb: 42 } }); assert_that!(msg.optional_nested_message().bb(), eq(42)); @@ -122,7 +122,7 @@ fn single_nested_message() { assert_that!(msg.has_optional_nested_message(), eq(true)); } -#[googletest::test] +#[gtest] fn test_recursive_msg() { let msg = proto!(NestedTestAllTypes { child: NestedTestAllTypes { @@ -139,7 +139,7 @@ fn test_recursive_msg() { assert_that!(msg.child().child().child().payload().optional_int32(), eq(43)); } -#[googletest::test] +#[gtest] fn test_spread_msg() { let msg = proto!(TestAllTypes { optional_nested_message: NestedMessage { bb: 42 } }); let msg2 = proto!(TestAllTypes { ..msg.as_view() }); @@ -149,7 +149,7 @@ fn test_spread_msg() { assert_that!(msg3.optional_int32(), eq(1)); } -#[googletest::test] +#[gtest] fn test_spread_nested_msg() { let msg = proto!(NestedTestAllTypes { child: NestedTestAllTypes { @@ -168,7 +168,7 @@ fn test_spread_nested_msg() { assert_that!(msg2.child().child().child().payload().optional_int32(), eq(43)); } -#[googletest::test] +#[gtest] fn test_repeated_i32() { let msg = proto!(TestAllTypes { repeated_int32: [1, 1 + 1, 3] }); assert_that!(msg.repeated_int32().len(), eq(3)); @@ -177,7 +177,7 @@ fn test_repeated_i32() { assert_that!(msg.repeated_int32().get(2).unwrap(), eq(3)); } -#[googletest::test] +#[gtest] fn test_repeated_msg() { let msg2 = proto!(NestedTestAllTypes { payload: TestAllTypes { optional_int32: 1 } }); let msg = proto!(NestedTestAllTypes { diff --git a/rust/test/shared/serialization_test.rs b/rust/test/shared/serialization_test.rs index b0e882271a..2561bed3d1 100644 --- a/rust/test/shared/serialization_test.rs +++ b/rust/test/shared/serialization_test.rs @@ -17,7 +17,7 @@ use unittest_rust_proto::TestAllTypes as TestAllTypesProto2; macro_rules! generate_parameterized_serialization_test { ($(($type: ident, $name_ext: ident)),*) => { paste! { $( - #[googletest::test] + #[gtest] fn [< serialization_zero_length_ $name_ext >]() { let mut msg = [< $type >]::new(); @@ -31,7 +31,7 @@ macro_rules! generate_parameterized_serialization_test { assert_that!(serialized.len(), eq(0)); } - #[googletest::test] + #[gtest] fn [< serialize_deserialize_message_ $name_ext>]() { let mut msg = [< $type >]::new(); msg.set_optional_int64(42); @@ -46,17 +46,17 @@ macro_rules! generate_parameterized_serialization_test { assert_that!(msg.optional_bytes(), eq(msg2.optional_bytes())); } - #[googletest::test] + #[gtest] fn [< deserialize_empty_ $name_ext>]() { assert!([< $type >]::parse(&[]).is_ok()); } - #[googletest::test] + #[gtest] fn [< deserialize_error_ $name_ext>]() { assert!([< $type >]::parse(b"not a serialized proto").is_err()); } - #[googletest::test] + #[gtest] fn [< set_bytes_with_serialized_data_ $name_ext>]() { let mut msg = [< $type >]::new(); msg.set_optional_int64(42); @@ -66,7 +66,7 @@ macro_rules! generate_parameterized_serialization_test { assert_that!(msg2.optional_bytes(), eq(msg.serialize().unwrap())); } - #[googletest::test] + #[gtest] fn [< deserialize_on_previously_allocated_message_ $name_ext>]() { let mut msg = [< $type >]::new(); msg.set_optional_int64(42); @@ -97,7 +97,7 @@ macro_rules! generate_parameterized_int32_byte_size_test { ($(($type: ident, $name_ext: ident)),*) => { paste! { $( - #[googletest::test] + #[gtest] 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 2fefc466de..ed2ce03dca 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::*; -#[googletest::test] +#[gtest] 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)); } -#[googletest::test] +#[gtest] 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)); } -#[googletest::test] +#[gtest] 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)); } -#[googletest::test] +#[gtest] 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)); } -#[googletest::test] +#[gtest] 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)); } -#[googletest::test] +#[gtest] 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)); } -#[googletest::test] +#[gtest] 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 a213136cb1..620ae237d5 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 { } } -#[googletest::test] +#[gtest] 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())); } -#[googletest::test] +#[gtest] 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))); } -#[googletest::test] +#[gtest] 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 9cc3457f1e..a3c59063a6 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, }; -#[googletest::test] +#[gtest] 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 7999a58e45..4d8941f922 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; -#[googletest::test] +#[gtest] 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"))); } -#[googletest::test] +#[gtest] fn test_cord_repeated() { let mut msg = TestAllTypes::new(); assert_that!(msg.repeated_cord().len(), eq(0));