From 7c598c4f1a44fdda5f97587484c85bef9e93fa98 Mon Sep 17 00:00:00 2001 From: "zhanyong.wan" Date: Mon, 26 Jul 2010 21:59:50 +0000 Subject: Adds ADD_FAILURE_AT (by Zhanyong Wan); disables -Wswitch-default (by Vlad Losev). --- test/gtest_unittest.cc | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'test/gtest_unittest.cc') diff --git a/test/gtest_unittest.cc b/test/gtest_unittest.cc index e11b6a66..910d4e20 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(), -- cgit v1.2.3