Move {child_parent_test, reserved_test, serialization_test} to googletest-rust

PiperOrigin-RevId: 572657135
pull/14351/head
Hong Shin 1 year ago committed by Copybara-Service
parent 15c04bf1bc
commit b823f7f826
  1. 14
      rust/test/shared/BUILD
  2. 6
      rust/test/shared/child_parent_test.rs
  3. 3
      rust/test/shared/reserved_test.rs
  4. 7
      rust/test/shared/serialization_test.rs

@ -24,6 +24,7 @@ rust_test(
"not_build:arm",
],
deps = [
"//third_party/gtest_rust/googletest",
"//rust/test:child_upb_rust_proto",
"//rust/test:parent_upb_rust_proto",
],
@ -37,6 +38,7 @@ rust_test(
"not_build:arm",
],
deps = [
"//third_party/gtest_rust/googletest",
"//rust/test:child_cc_rust_proto",
"//rust/test:parent_cc_rust_proto",
],
@ -78,6 +80,7 @@ rust_test(
"not_build:arm",
],
deps = [
"//third_party/gtest_rust/googletest",
"//rust/test:reserved_cc_rust_proto",
"//rust/test:unittest_cc_rust_proto",
],
@ -91,6 +94,7 @@ rust_test(
"not_build:arm",
],
deps = [
"//third_party/gtest_rust/googletest",
"//rust/test:reserved_upb_rust_proto",
"//rust/test:unittest_upb_rust_proto",
],
@ -191,7 +195,10 @@ rust_test(
# TODO: Enable testing on arm once we support sanitizers for Rust on Arm.
"not_build:arm",
],
deps = ["//rust/test:unittest_upb_rust_proto"],
deps = [
"//third_party/gtest_rust/googletest",
"//rust/test:unittest_upb_rust_proto",
],
)
rust_test(
@ -201,7 +208,10 @@ rust_test(
# TODO: Enable testing on arm once we support sanitizers for Rust on Arm.
"not_build:arm",
],
deps = ["//rust/test:unittest_cc_rust_proto"],
deps = [
"//third_party/gtest_rust/googletest",
"//rust/test:unittest_cc_rust_proto",
],
)
rust_test(

@ -5,6 +5,8 @@
// license that can be found in the LICENSE file or at
// https://developers.google.com/open-source/licenses/bsd
use googletest::prelude::*;
#[test]
fn test_canonical_types() {
let _child = child_proto::child_package::Child::new();
@ -17,10 +19,10 @@ fn test_canonical_types() {
#[test]
fn test_parent_serialization() {
assert_eq!(*parent_proto::parent_package::Parent::new().serialize(), []);
assert_that!(*parent_proto::parent_package::Parent::new().serialize(), empty());
}
#[test]
fn test_child_serialization() {
assert_eq!(*child_proto::child_package::Child::new().serialize(), []);
assert_that!(*child_proto::child_package::Child::new().serialize(), empty());
}

@ -5,6 +5,7 @@
// license that can be found in the LICENSE file or at
// https://developers.google.com/open-source/licenses/bsd
use googletest::prelude::*;
/// Test covering proto compilation with reserved words.
use reserved_proto::naming::Reserved;
@ -12,7 +13,7 @@ use reserved_proto::naming::Reserved;
fn test_reserved_keyword_in_accessors() {
let msg = Reserved::new();
let res = msg.r#for();
assert_eq!(res, 0);
assert_that!(res, eq(0));
}
#[test]

@ -5,6 +5,7 @@
// license that can be found in the LICENSE file or at
// https://developers.google.com/open-source/licenses/bsd
use googletest::prelude::*;
use unittest_proto::proto2_unittest::TestAllTypes;
#[test]
@ -19,9 +20,9 @@ fn serialize_deserialize_message() {
let mut msg2 = TestAllTypes::new();
assert!(msg2.deserialize(&serialized).is_ok());
assert_eq!(msg.optional_int64(), msg2.optional_int64());
assert_eq!(msg.optional_bool(), msg2.optional_bool());
assert_eq!(msg.optional_bytes(), msg2.optional_bytes());
assert_that!(msg.optional_int64(), eq(msg2.optional_int64()));
assert_that!(msg.optional_bool(), eq(msg2.optional_bool()));
assert_that!(msg.optional_bytes(), eq(msg2.optional_bytes()));
}
#[test]

Loading…
Cancel
Save