Skip to content

Commit c33408e

Browse files
gribozavrcopybara-github
authored andcommitted
Handle non-copyable type in (expect|verify)_(ne|eq)!
This is similar to the behavior and implementation of `assert_eq!(..., ...)` PiperOrigin-RevId: 656369015
1 parent 07dffcf commit c33408e

File tree

2 files changed

+4
-32
lines changed

2 files changed

+4
-32
lines changed

googletest/src/assertions.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -571,13 +571,13 @@ macro_rules! expect_false {
571571
#[macro_export]
572572
macro_rules! verify_eq {
573573
($actual:expr, [$($expected:expr),+ $(,)?] $(,)?) => {
574-
verify_that!(&$actual, [$($crate::matchers::eq(&$expected)),*])
574+
verify_that!($actual, [$($crate::matchers::eq(&$expected)),*])
575575
};
576576
($actual:expr, {$($expected:expr),+ $(,)?} $(,)?) => {
577-
verify_that!(&$actual, {$($crate::matchers::eq(&$expected)),*})
577+
verify_that!($actual, {$($crate::matchers::eq(&$expected)),*})
578578
};
579579
($actual:expr, $expected:expr $(,)?) => {
580-
verify_that!(&$actual, $crate::matchers::eq(&$expected))
580+
verify_that!($actual, $crate::matchers::eq($expected))
581581
};
582582
}
583583

@@ -681,7 +681,7 @@ macro_rules! expect_eq {
681681
#[macro_export]
682682
macro_rules! verify_ne {
683683
($actual:expr, $expected:expr $(,)?) => {
684-
verify_that!(&$actual, $crate::matchers::not($crate::matchers::eq(&$expected)))
684+
verify_that!($actual, $crate::matchers::not($crate::matchers::eq($expected)))
685685
};
686686
}
687687

integration_tests/src/integration_tests.rs

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -825,13 +825,6 @@ mod tests {
825825
verify_eq!(value, 2)
826826
}
827827

828-
#[googletest::test]
829-
fn verify_eq_with_non_copyable_type() -> Result<()> {
830-
#[derive(Debug, PartialEq)]
831-
struct NonCopyable(i32);
832-
verify_eq!(NonCopyable(123), NonCopyable(123))
833-
}
834-
835828
#[test]
836829
fn verify_eq_supports_trailing_comma() -> Result<()> {
837830
let value = 2;
@@ -933,13 +926,6 @@ mod tests {
933926
expect_eq!(value, 2);
934927
}
935928

936-
#[googletest::test]
937-
fn expect_eq_with_non_copyable_type() {
938-
#[derive(Debug, PartialEq)]
939-
struct NonCopyable(i32);
940-
expect_eq!(NonCopyable(123), NonCopyable(123));
941-
}
942-
943929
#[googletest::test]
944930
fn expect_eq_should_allow_multiple_calls() {
945931
expect_eq!(1, 1);
@@ -1104,13 +1090,6 @@ mod tests {
11041090
verify_ne!(value, 3)
11051091
}
11061092

1107-
#[googletest::test]
1108-
fn verify_ne_with_non_copyable_type() -> Result<()> {
1109-
#[derive(Debug, PartialEq)]
1110-
struct NonCopyable(i32);
1111-
verify_ne!(NonCopyable(123), NonCopyable(321))
1112-
}
1113-
11141093
#[test]
11151094
fn verify_ne_supports_trailing_comma() -> Result<()> {
11161095
let value = 2;
@@ -1137,13 +1116,6 @@ mod tests {
11371116
expect_ne!(1, 2);
11381117
}
11391118

1140-
#[googletest::test]
1141-
fn expect_ne_with_non_copyable_type() {
1142-
#[derive(Debug, PartialEq)]
1143-
struct NonCopyable(i32);
1144-
expect_ne!(NonCopyable(123), NonCopyable(321));
1145-
}
1146-
11471119
#[googletest::test]
11481120
fn expect_ne_should_allow_multiple_calls() {
11491121
expect_ne!(1, 2);

0 commit comments

Comments
 (0)