Expose ScopedTrace utility in public interface
This commit is contained in:
@@ -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):
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -8,7 +8,7 @@ gtest_output_test_.cc:#: Failure
|
||||
Expected equality of these values:
|
||||
2
|
||||
3
|
||||
[0;32m[==========] [mRunning 66 tests from 29 test cases.
|
||||
[0;32m[==========] [mRunning 67 tests from 30 test cases.
|
||||
[0;32m[----------] [mGlobal 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).
|
||||
[0;31m[ FAILED ] [mSCOPED_TRACETest.WorksConcurrently
|
||||
[0;32m[----------] [m1 test from ScopedTraceTest
|
||||
[0;32m[ RUN ] [mScopedTraceTest.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
|
||||
[0;31m[ FAILED ] [mScopedTraceTest.WithExplicitFileAndLine
|
||||
[0;32m[----------] [m1 test from NonFatalFailureInFixtureConstructorTest
|
||||
[0;32m[ RUN ] [mNonFatalFailureInFixtureConstructorTest.FailureInConstructor
|
||||
(expecting 5 failures)
|
||||
@@ -636,9 +644,9 @@ FooEnvironment::TearDown() called.
|
||||
gtest_output_test_.cc:#: Failure
|
||||
Failed
|
||||
Expected fatal failure.
|
||||
[0;32m[==========] [m66 tests from 29 test cases ran.
|
||||
[0;32m[==========] [m67 tests from 30 test cases ran.
|
||||
[0;32m[ PASSED ] [m22 tests.
|
||||
[0;31m[ FAILED ] [m44 tests, listed below:
|
||||
[0;31m[ FAILED ] [m45 tests, listed below:
|
||||
[0;31m[ FAILED ] [mNonfatalFailureTest.EscapesStringOperands
|
||||
[0;31m[ FAILED ] [mNonfatalFailureTest.DiffForLongStrings
|
||||
[0;31m[ FAILED ] [mFatalFailureTest.FatalFailureInSubroutine
|
||||
@@ -651,6 +659,7 @@ Expected fatal failure.
|
||||
[0;31m[ FAILED ] [mSCOPED_TRACETest.CanBeNested
|
||||
[0;31m[ FAILED ] [mSCOPED_TRACETest.CanBeRepeated
|
||||
[0;31m[ FAILED ] [mSCOPED_TRACETest.WorksConcurrently
|
||||
[0;31m[ FAILED ] [mScopedTraceTest.WithExplicitFileAndLine
|
||||
[0;31m[ FAILED ] [mNonFatalFailureInFixtureConstructorTest.FailureInConstructor
|
||||
[0;31m[ FAILED ] [mFatalFailureInFixtureConstructorTest.FailureInConstructor
|
||||
[0;31m[ FAILED ] [mNonFatalFailureInSetUpTest.FailureInSetUp
|
||||
@@ -684,7 +693,7 @@ Expected fatal failure.
|
||||
[0;31m[ FAILED ] [mPrintingFailingParams/FailingParamTest.Fails/0, where GetParam() = 2
|
||||
[0;31m[ FAILED ] [mPrintingStrings/ParamTest.Failure/a, where GetParam() = "a"
|
||||
|
||||
44 FAILED TESTS
|
||||
45 FAILED TESTS
|
||||
[0;33m YOU HAVE 1 DISABLED TEST
|
||||
|
||||
[mNote: Google Test filter = FatalFailureTest.*:LoggingTest.*
|
||||
|
||||
Reference in New Issue
Block a user