Skip to content

Commit 4eb1e49

Browse files
Abseil Teamcopybara-github
Abseil Team
authored andcommitted
Expect different representations of pointers from the Windows toolchain.
In `TestPointerPrintedAsNumberDespiteAbslStringify`, an `EXPECT_DEATH` matches an error with a pointer represented in it. The representation used to differ for Windows. In newer releases, Windows' representation matches that of other toolchains. This change makes either of the numeric representations admissible. This change allows this test to pass before and after the latest Windows release. PiperOrigin-RevId: 754003964 Change-Id: Ifee2c20a7d8022b380b7a58f50966013f7f7a4ba
1 parent af51282 commit 4eb1e49

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

absl/log/check_test_impl.inc

+5-6
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
namespace absl_log_internal {
4040

4141
using ::testing::AllOf;
42+
using ::testing::AnyOf;
4243
using ::testing::HasSubstr;
4344
using ::testing::Not;
4445

@@ -634,14 +635,12 @@ void AbslStringify(Sink& sink, const PointerIsStringifiable* var) {
634635
TEST(CHECKDeathTest, TestPointerPrintedAsNumberDespiteAbslStringify) {
635636
const auto* p = reinterpret_cast<const PointerIsStringifiable*>(0x1234);
636637

637-
#ifdef _MSC_VER
638638
EXPECT_DEATH(
639639
ABSL_TEST_CHECK_EQ(p, nullptr),
640-
HasSubstr("Check failed: p == nullptr (0000000000001234 vs. (null))"));
641-
#else // _MSC_VER
642-
EXPECT_DEATH(ABSL_TEST_CHECK_EQ(p, nullptr),
643-
HasSubstr("Check failed: p == nullptr (0x1234 vs. (null))"));
644-
#endif // _MSC_VER
640+
AnyOf(
641+
HasSubstr("Check failed: p == nullptr (0000000000001234 vs. (null))"),
642+
HasSubstr("Check failed: p == nullptr (0x1234 vs. (null))")
643+
));
645644
}
646645

647646
// An uncopyable object with operator<<.

0 commit comments

Comments
 (0)