aboutsummaryrefslogtreecommitdiffstats
path: root/test/gtest_no_test_unittest.cc
diff options
context:
space:
mode:
authorzhanyong.wan <zhanyong.wan@861a406c-534a-0410-8894-cb66d6ee9925>2010-06-16 22:47:13 +0000
committerzhanyong.wan <zhanyong.wan@861a406c-534a-0410-8894-cb66d6ee9925>2010-06-16 22:47:13 +0000
commit682c89f7557eb53c7359b6cbf3670c05165f2419 (patch)
tree3a0d849ba9e72f411fbcc0b1b8f1acd880647736 /test/gtest_no_test_unittest.cc
parent985a30360ce4824b65cb35ad55faa0d7c1ad1104 (diff)
downloadgoogletest-682c89f7557eb53c7359b6cbf3670c05165f2419.tar.gz
googletest-682c89f7557eb53c7359b6cbf3670c05165f2419.tar.bz2
googletest-682c89f7557eb53c7359b6cbf3670c05165f2419.zip
Makes gtest report failures in ad hoc test assertions executed before RUN_ALL_TESTS().
Diffstat (limited to 'test/gtest_no_test_unittest.cc')
-rw-r--r--test/gtest_no_test_unittest.cc11
1 files changed, 7 insertions, 4 deletions
diff --git a/test/gtest_no_test_unittest.cc b/test/gtest_no_test_unittest.cc
index afe2dc0c..e09ca73a 100644
--- a/test/gtest_no_test_unittest.cc
+++ b/test/gtest_no_test_unittest.cc
@@ -40,15 +40,18 @@ int main(int argc, char **argv) {
// An ad-hoc assertion outside of all tests.
//
- // This serves two purposes:
+ // This serves three purposes:
//
// 1. It verifies that an ad-hoc assertion can be executed even if
// no test is defined.
- // 2. We had a bug where the XML output won't be generated if an
+ // 2. It verifies that a failed ad-hoc assertion causes the test
+ // program to fail.
+ // 3. We had a bug where the XML output won't be generated if an
// assertion is executed before RUN_ALL_TESTS() is called, even
// though --gtest_output=xml is specified. This makes sure the
// bug is fixed and doesn't regress.
- EXPECT_EQ(1, 1);
+ EXPECT_EQ(1, 2);
- return RUN_ALL_TESTS();
+ // The above EXPECT_EQ() should cause RUN_ALL_TESTS() to return non-zero.
+ return RUN_ALL_TESTS() ? 0 : 1;
}