summaryrefslogtreecommitdiff
path: root/test/gtest_unittest.cc
diff options
context:
space:
mode:
authorzhanyong.wan <zhanyong.wan@861a406c-534a-0410-8894-cb66d6ee9925>2010-07-26 21:59:50 +0000
committerzhanyong.wan <zhanyong.wan@861a406c-534a-0410-8894-cb66d6ee9925>2010-07-26 21:59:50 +0000
commitd5ad2ca82051c34b19af628a3c81131ca65010c2 (patch)
treea393db9c0cebf32d9a62a2a95e8ade4f5750c62c /test/gtest_unittest.cc
parent87b89d907bc1b5032581439d7de5028c824fa05b (diff)
downloadgtest-d5ad2ca82051c34b19af628a3c81131ca65010c2.tar.gz
gtest-d5ad2ca82051c34b19af628a3c81131ca65010c2.tar.bz2
gtest-d5ad2ca82051c34b19af628a3c81131ca65010c2.tar.xz
Adds ADD_FAILURE_AT (by Zhanyong Wan); disables -Wswitch-default (by Vlad Losev).
git-svn-id: http://googletest.googlecode.com/svn/trunk@451 861a406c-534a-0410-8894-cb66d6ee9925
Diffstat (limited to 'test/gtest_unittest.cc')
-rw-r--r--test/gtest_unittest.cc15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/gtest_unittest.cc b/test/gtest_unittest.cc
index e11b6a6..910d4e2 100644
--- a/test/gtest_unittest.cc
+++ b/test/gtest_unittest.cc
@@ -4393,6 +4393,21 @@ TEST(MacroTest, ADD_FAILURE) {
EXPECT_FALSE(aborted);
}
+// Tests ADD_FAILURE_AT.
+TEST(MacroTest, ADD_FAILURE_AT) {
+ // Verifies that ADD_FAILURE_AT does generate a nonfatal failure and
+ // the failure message contains the user-streamed part.
+ EXPECT_NONFATAL_FAILURE(ADD_FAILURE_AT("foo.cc", 42) << "Wrong!", "Wrong!");
+
+ // Verifies that the user-streamed part is optional.
+ EXPECT_NONFATAL_FAILURE(ADD_FAILURE_AT("foo.cc", 42), "Failed");
+
+ // Unfortunately, we cannot verify that the failure message contains
+ // the right file path and line number the same way, as
+ // EXPECT_NONFATAL_FAILURE() doesn't get to see the file path and
+ // line number. Instead, we do that in gtest_output_test_.cc.
+}
+
// Tests FAIL.
TEST(MacroTest, FAIL) {
EXPECT_FATAL_FAILURE(FAIL(),