diff options
author | Abseil Team <absl-team@google.com> | 2019-04-22 22:23:35 (GMT) |
---|---|---|
committer | Matt Calabrese <calabrese@x.team> | 2019-04-24 13:34:40 (GMT) |
commit | 84d986531e8df9fb6ea4a7bae8fb130c05b3782c (patch) | |
tree | 0b8757a3724c3550765e5efbe34fc40354aa9f75 /googletest/test/gtest_unittest.cc | |
parent | a53e931dcd00c2556ee181d832e699c9f3c29036 (diff) | |
download | googletest-84d986531e8df9fb6ea4a7bae8fb130c05b3782c.zip googletest-84d986531e8df9fb6ea4a7bae8fb130c05b3782c.tar.gz googletest-84d986531e8df9fb6ea4a7bae8fb130c05b3782c.tar.bz2 |
Googletest export
Add GTEST_FAIL_AT, an equivalent to ADD_FAILURE_AT but that
spawns a fatal failure rather than a non-fatal, eg. the equivalent
of an ASSERT* failure rather than an EXPECT* failure.
PiperOrigin-RevId: 244746609
Diffstat (limited to 'googletest/test/gtest_unittest.cc')
-rw-r--r-- | googletest/test/gtest_unittest.cc | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/googletest/test/gtest_unittest.cc b/googletest/test/gtest_unittest.cc index 28ced73..d481056 100644 --- a/googletest/test/gtest_unittest.cc +++ b/googletest/test/gtest_unittest.cc @@ -4708,6 +4708,19 @@ TEST(MacroTest, FAIL) { "Intentional failure."); } +// Tests GTEST_FAIL_AT. +TEST(MacroTest, GTEST_FAIL_AT) { + // Verifies that GTEST_FAIL_AT does generate a fatal failure and + // the failure message contains the user-streamed part. + EXPECT_FATAL_FAILURE(GTEST_FAIL_AT("foo.cc", 42) << "Wrong!", "Wrong!"); + + // Verifies that the user-streamed part is optional. + EXPECT_FATAL_FAILURE(GTEST_FAIL_AT("foo.cc", 42), "Failed"); + + // See the ADD_FAIL_AT test above to see how we test that the failure message + // contains the right filename and line number -- the same applies here. +} + // Tests SUCCEED TEST(MacroTest, SUCCEED) { SUCCEED(); |