aboutsummaryrefslogtreecommitdiffstats
path: root/googletest/test
diff options
context:
space:
mode:
authorGennadiy Civil <gennadiycivil@users.noreply.github.com>2018-01-18 09:47:22 -0500
committerGitHub <noreply@github.com>2018-01-18 09:47:22 -0500
commit8d733dc19525c4c898a85f9ae02713f42fe6d083 (patch)
treebaefd7543494c50239a21602dbb0fd89ca939770 /googletest/test
parent1b077667bd950be0f5b106e033fb820b008ad0c0 (diff)
parent8e862211a24804d6635adc867f9b9199220e1128 (diff)
downloadgoogletest-8d733dc19525c4c898a85f9ae02713f42fe6d083.tar.gz
googletest-8d733dc19525c4c898a85f9ae02713f42fe6d083.tar.bz2
googletest-8d733dc19525c4c898a85f9ae02713f42fe6d083.zip
Merge pull request #1407 from ted-xp/master
Expose ScopedTrace utility in public interface
Diffstat (limited to 'googletest/test')
-rwxr-xr-xgoogletest/test/gtest_output_test.py3
-rw-r--r--googletest/test/gtest_output_test_.cc7
-rw-r--r--googletest/test/gtest_output_test_golden_lin.txt17
3 files changed, 22 insertions, 5 deletions
diff --git a/googletest/test/gtest_output_test.py b/googletest/test/gtest_output_test.py
index 06dbee09..78a00156 100755
--- a/googletest/test/gtest_output_test.py
+++ b/googletest/test/gtest_output_test.py
@@ -99,7 +99,8 @@ def RemoveLocations(test_output):
'FILE_NAME:#: '.
"""
- return re.sub(r'.*[/\\](.+)(\:\d+|\(\d+\))\: ', r'\1:#: ', test_output)
+ return re.sub(r'.*[/\\]((gtest_output_test_|gtest).cc)(\:\d+|\(\d+\))\: ',
+ r'\1:#: ', test_output)
def RemoveStackTraceDetails(output):
diff --git a/googletest/test/gtest_output_test_.cc b/googletest/test/gtest_output_test_.cc
index 6aaba977..04ca5e5e 100644
--- a/googletest/test/gtest_output_test_.cc
+++ b/googletest/test/gtest_output_test_.cc
@@ -315,6 +315,13 @@ TEST(SCOPED_TRACETest, WorksConcurrently) {
}
#endif // GTEST_IS_THREADSAFE
+// Tests basic functionality of the ScopedTrace utility (most of its features
+// are already tested in SCOPED_TRACETest).
+TEST(ScopedTraceTest, WithExplicitFileAndLine) {
+ testing::ScopedTrace trace("explicit_file.cc", 123, "expected trace message");
+ ADD_FAILURE() << "Check that the trace is attached to a particular location.";
+}
+
TEST(DisabledTestsWarningTest,
DISABLED_AlsoRunDisabledTestsFlagSuppressesWarning) {
// This test body is intentionally empty. Its sole purpose is for
diff --git a/googletest/test/gtest_output_test_golden_lin.txt b/googletest/test/gtest_output_test_golden_lin.txt
index 677d9f40..48f55932 100644
--- a/googletest/test/gtest_output_test_golden_lin.txt
+++ b/googletest/test/gtest_output_test_golden_lin.txt
@@ -8,7 +8,7 @@ gtest_output_test_.cc:#: Failure
Expected equality of these values:
2
3
-[==========] Running 66 tests from 29 test cases.
+[==========] Running 67 tests from 30 test cases.
[----------] Global test environment set-up.
FooEnvironment::SetUp() called.
BarEnvironment::SetUp() called.
@@ -212,6 +212,14 @@ gtest_output_test_.cc:#: Failure
Failed
Expected failure #6 (in thread A, no trace alive).
[ FAILED ] SCOPED_TRACETest.WorksConcurrently
+[----------] 1 test from ScopedTraceTest
+[ RUN ] ScopedTraceTest.WithExplicitFileAndLine
+gtest_output_test_.cc:#: Failure
+Failed
+Check that the trace is attached to a particular location.
+Google Test trace:
+explicit_file.cc:123: expected trace message
+[ FAILED ] ScopedTraceTest.WithExplicitFileAndLine
[----------] 1 test from NonFatalFailureInFixtureConstructorTest
[ RUN ] NonFatalFailureInFixtureConstructorTest.FailureInConstructor
(expecting 5 failures)
@@ -636,9 +644,9 @@ FooEnvironment::TearDown() called.
gtest_output_test_.cc:#: Failure
Failed
Expected fatal failure.
-[==========] 66 tests from 29 test cases ran.
+[==========] 67 tests from 30 test cases ran.
[ PASSED ] 22 tests.
-[ FAILED ] 44 tests, listed below:
+[ FAILED ] 45 tests, listed below:
[ FAILED ] NonfatalFailureTest.EscapesStringOperands
[ FAILED ] NonfatalFailureTest.DiffForLongStrings
[ FAILED ] FatalFailureTest.FatalFailureInSubroutine
@@ -651,6 +659,7 @@ Expected fatal failure.
[ FAILED ] SCOPED_TRACETest.CanBeNested
[ FAILED ] SCOPED_TRACETest.CanBeRepeated
[ FAILED ] SCOPED_TRACETest.WorksConcurrently
+[ FAILED ] ScopedTraceTest.WithExplicitFileAndLine
[ FAILED ] NonFatalFailureInFixtureConstructorTest.FailureInConstructor
[ FAILED ] FatalFailureInFixtureConstructorTest.FailureInConstructor
[ FAILED ] NonFatalFailureInSetUpTest.FailureInSetUp
@@ -684,7 +693,7 @@ Expected fatal failure.
[ FAILED ] PrintingFailingParams/FailingParamTest.Fails/0, where GetParam() = 2
[ FAILED ] PrintingStrings/ParamTest.Failure/a, where GetParam() = "a"
-44 FAILED TESTS
+45 FAILED TESTS
 YOU HAVE 1 DISABLED TEST
Note: Google Test filter = FatalFailureTest.*:LoggingTest.*