makes gtest-death-test_test.cc compile on platforms that don't support death tests; h/t to Steve Robbins for reporting the issue and suggesting the fix.
This commit is contained in:
parent
48568d0688
commit
81ddb8434f
|
@ -1289,6 +1289,27 @@ TEST(ConditionalDeathMacrosTest, AssertDeatDoesNotReturnhIfUnsupported) {
|
||||||
FuncWithAssert(&n);
|
FuncWithAssert(&n);
|
||||||
EXPECT_EQ(1, n);
|
EXPECT_EQ(1, n);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST(InDeathTestChildDeathTest, ReportsDeathTestCorrectlyInFastStyle) {
|
||||||
|
testing::GTEST_FLAG(death_test_style) = "fast";
|
||||||
|
EXPECT_FALSE(InDeathTestChild());
|
||||||
|
EXPECT_DEATH({
|
||||||
|
fprintf(stderr, InDeathTestChild() ? "Inside" : "Outside");
|
||||||
|
fflush(stderr);
|
||||||
|
_exit(1);
|
||||||
|
}, "Inside");
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(InDeathTestChildDeathTest, ReportsDeathTestCorrectlyInThreadSafeStyle) {
|
||||||
|
testing::GTEST_FLAG(death_test_style) = "threadsafe";
|
||||||
|
EXPECT_FALSE(InDeathTestChild());
|
||||||
|
EXPECT_DEATH({
|
||||||
|
fprintf(stderr, InDeathTestChild() ? "Inside" : "Outside");
|
||||||
|
fflush(stderr);
|
||||||
|
_exit(1);
|
||||||
|
}, "Inside");
|
||||||
|
}
|
||||||
|
|
||||||
#endif // GTEST_HAS_DEATH_TEST
|
#endif // GTEST_HAS_DEATH_TEST
|
||||||
|
|
||||||
// Tests that the death test macros expand to code which may or may not
|
// Tests that the death test macros expand to code which may or may not
|
||||||
|
@ -1341,26 +1362,6 @@ TEST(ConditionalDeathMacrosSyntaxDeathTest, SwitchStatement) {
|
||||||
#endif // _MSC_VER
|
#endif // _MSC_VER
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(InDeathTestChildDeathTest, ReportsDeathTestCorrectlyInFastStyle) {
|
|
||||||
testing::GTEST_FLAG(death_test_style) = "fast";
|
|
||||||
EXPECT_FALSE(InDeathTestChild());
|
|
||||||
EXPECT_DEATH({
|
|
||||||
fprintf(stderr, InDeathTestChild() ? "Inside" : "Outside");
|
|
||||||
fflush(stderr);
|
|
||||||
_exit(1);
|
|
||||||
}, "Inside");
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST(InDeathTestChildDeathTest, ReportsDeathTestCorrectlyInThreadSafeStyle) {
|
|
||||||
testing::GTEST_FLAG(death_test_style) = "threadsafe";
|
|
||||||
EXPECT_FALSE(InDeathTestChild());
|
|
||||||
EXPECT_DEATH({
|
|
||||||
fprintf(stderr, InDeathTestChild() ? "Inside" : "Outside");
|
|
||||||
fflush(stderr);
|
|
||||||
_exit(1);
|
|
||||||
}, "Inside");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Tests that a test case whose name ends with "DeathTest" works fine
|
// Tests that a test case whose name ends with "DeathTest" works fine
|
||||||
// on Windows.
|
// on Windows.
|
||||||
TEST(NotADeathTest, Test) {
|
TEST(NotADeathTest, Test) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user