Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
yangql
googletest
Commits
52998153
Commit
52998153
authored
May 08, 2019
by
Abseil Team
Committed by
Gennadiy Civil
May 10, 2019
Browse files
Googletest export
Print the test output on assertion failure. PiperOrigin-RevId: 247283764
parent
3f5b5b8f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
73 additions
and
68 deletions
+73
-68
googletest/test/googletest-catch-exceptions-test.py
googletest/test/googletest-catch-exceptions-test.py
+73
-68
No files found.
googletest/test/googletest-catch-exceptions-test.py
View file @
52998153
...
@@ -117,10 +117,11 @@ class CatchCxxExceptionsTest(gtest_test_utils.TestCase):
...
@@ -117,10 +117,11 @@ class CatchCxxExceptionsTest(gtest_test_utils.TestCase):
"""
"""
def
testCatchesCxxExceptionsInFixtureConstructor
(
self
):
def
testCatchesCxxExceptionsInFixtureConstructor
(
self
):
self
.
assert_
(
'C++ exception with description '
self
.
assertTrue
(
'"Standard C++ exception" thrown '
'C++ exception with description '
'in the test fixture
\'
s constructor'
'"Standard C++ exception" thrown '
in
EX_BINARY_OUTPUT
)
'in the test fixture
\'
s constructor'
in
EX_BINARY_OUTPUT
,
EX_BINARY_OUTPUT
)
self
.
assert_
(
'unexpected'
not
in
EX_BINARY_OUTPUT
,
self
.
assert_
(
'unexpected'
not
in
EX_BINARY_OUTPUT
,
'This failure belongs in this test only if '
'This failure belongs in this test only if '
'"CxxExceptionInConstructorTest" (no quotes) '
'"CxxExceptionInConstructorTest" (no quotes) '
...
@@ -130,86 +131,90 @@ class CatchCxxExceptionsTest(gtest_test_utils.TestCase):
...
@@ -130,86 +131,90 @@ class CatchCxxExceptionsTest(gtest_test_utils.TestCase):
EX_BINARY_OUTPUT
):
EX_BINARY_OUTPUT
):
def
testCatchesCxxExceptionsInFixtureDestructor
(
self
):
def
testCatchesCxxExceptionsInFixtureDestructor
(
self
):
self
.
assert_
(
'C++ exception with description '
self
.
assertTrue
(
'"Standard C++ exception" thrown '
'C++ exception with description '
'in the test fixture
\'
s destructor'
'"Standard C++ exception" thrown '
in
EX_BINARY_OUTPUT
)
'in the test fixture
\'
s destructor'
in
EX_BINARY_OUTPUT
,
self
.
assert_
(
'CxxExceptionInDestructorTest::TearDownTestSuite() '
EX_BINARY_OUTPUT
)
'called as expected.'
self
.
assertTrue
(
in
EX_BINARY_OUTPUT
)
'CxxExceptionInDestructorTest::TearDownTestSuite() '
'called as expected.'
in
EX_BINARY_OUTPUT
,
EX_BINARY_OUTPUT
)
def
testCatchesCxxExceptionsInSetUpTestCase
(
self
):
def
testCatchesCxxExceptionsInSetUpTestCase
(
self
):
self
.
assert_
(
'C++ exception with description "Standard C++ exception"'
self
.
assertTrue
(
' thrown in SetUpTestSuite()'
in
EX_BINARY_OUTPUT
)
'C++ exception with description "Standard C++ exception"'
self
.
assert_
(
'CxxExceptionInConstructorTest::TearDownTestSuite() '
' thrown in SetUpTestSuite()'
in
EX_BINARY_OUTPUT
,
EX_BINARY_OUTPUT
)
'called as expected.'
self
.
assertTrue
(
in
EX_BINARY_OUTPUT
)
'CxxExceptionInConstructorTest::TearDownTestSuite() '
self
.
assert_
(
'CxxExceptionInSetUpTestSuiteTest constructor '
'called as expected.'
in
EX_BINARY_OUTPUT
,
EX_BINARY_OUTPUT
)
'called as expected.'
self
.
assertTrue
(
in
EX_BINARY_OUTPUT
)
'CxxExceptionInSetUpTestSuiteTest constructor '
self
.
assert_
(
'CxxExceptionInSetUpTestSuiteTest destructor '
'called as expected.'
in
EX_BINARY_OUTPUT
,
EX_BINARY_OUTPUT
)
'called as expected.'
self
.
assertTrue
(
in
EX_BINARY_OUTPUT
)
'CxxExceptionInSetUpTestSuiteTest destructor '
self
.
assert_
(
'CxxExceptionInSetUpTestSuiteTest::SetUp() '
'called as expected.'
in
EX_BINARY_OUTPUT
,
EX_BINARY_OUTPUT
)
'called as expected.'
self
.
assertTrue
(
in
EX_BINARY_OUTPUT
)
'CxxExceptionInSetUpTestSuiteTest::SetUp() '
self
.
assert_
(
'CxxExceptionInSetUpTestSuiteTest::TearDown() '
'called as expected.'
in
EX_BINARY_OUTPUT
,
EX_BINARY_OUTPUT
)
'called as expected.'
self
.
assertTrue
(
in
EX_BINARY_OUTPUT
)
'CxxExceptionInSetUpTestSuiteTest::TearDown() '
self
.
assert_
(
'CxxExceptionInSetUpTestSuiteTest test body '
'called as expected.'
in
EX_BINARY_OUTPUT
,
EX_BINARY_OUTPUT
)
'called as expected.'
self
.
assertTrue
(
in
EX_BINARY_OUTPUT
)
'CxxExceptionInSetUpTestSuiteTest test body '
'called as expected.'
in
EX_BINARY_OUTPUT
,
EX_BINARY_OUTPUT
)
def
testCatchesCxxExceptionsInTearDownTestCase
(
self
):
def
testCatchesCxxExceptionsInTearDownTestCase
(
self
):
self
.
assert_
(
'C++ exception with description "Standard C++ exception"'
self
.
assertTrue
(
' thrown in TearDownTestSuite()'
in
EX_BINARY_OUTPUT
)
'C++ exception with description "Standard C++ exception"'
' thrown in TearDownTestSuite()'
in
EX_BINARY_OUTPUT
,
EX_BINARY_OUTPUT
)
def
testCatchesCxxExceptionsInSetUp
(
self
):
def
testCatchesCxxExceptionsInSetUp
(
self
):
self
.
assert
_
(
'C++ exception with description "Standard C++ exception"'
self
.
assert
True
(
' thrown in SetUp()
'
'C++ exception with description "Standard C++ exception"
'
in
EX_BINARY_OUTPUT
)
' thrown in SetUp()'
in
EX_BINARY_OUTPUT
,
EX_BINARY_OUTPUT
)
self
.
assert
_
(
'CxxExceptionInSetUpTest::TearDownTestSuite() '
self
.
assert
True
(
'called as expected.
'
'CxxExceptionInSetUpTest::TearDownTestSuite()
'
in
EX_BINARY_OUTPUT
)
'called as expected.'
in
EX_BINARY_OUTPUT
,
EX_BINARY_OUTPUT
)
self
.
assert
_
(
'CxxExceptionInSetUpTest destructor '
self
.
assert
True
(
'called as expected.
'
'CxxExceptionInSetUpTest destructor
'
in
EX_BINARY_OUTPUT
)
'called as expected.'
in
EX_BINARY_OUTPUT
,
EX_BINARY_OUTPUT
)
self
.
assert
_
(
'CxxExceptionInSetUpTest::TearDown() '
self
.
assert
True
(
'called as expected.
'
'CxxExceptionInSetUpTest::TearDown()
'
in
EX_BINARY_OUTPUT
)
'called as expected.'
in
EX_BINARY_OUTPUT
,
EX_BINARY_OUTPUT
)
self
.
assert_
(
'unexpected'
not
in
EX_BINARY_OUTPUT
,
self
.
assert_
(
'unexpected'
not
in
EX_BINARY_OUTPUT
,
'This failure belongs in this test only if '
'This failure belongs in this test only if '
'"CxxExceptionInSetUpTest" (no quotes) '
'"CxxExceptionInSetUpTest" (no quotes) '
'appears on the same line as words "called unexpectedly"'
)
'appears on the same line as words "called unexpectedly"'
)
def
testCatchesCxxExceptionsInTearDown
(
self
):
def
testCatchesCxxExceptionsInTearDown
(
self
):
self
.
assert
_
(
'C++ exception with description "Standard C++ exception"'
self
.
assert
True
(
' thrown in TearDown()
'
'C++ exception with description "Standard C++ exception"
'
in
EX_BINARY_OUTPUT
)
' thrown in TearDown()'
in
EX_BINARY_OUTPUT
,
EX_BINARY_OUTPUT
)
self
.
assert
_
(
'CxxExceptionInTearDownTest::TearDownTestSuite() '
self
.
assert
True
(
'called as expected.
'
'CxxExceptionInTearDownTest::TearDownTestSuite()
'
in
EX_BINARY_OUTPUT
)
'called as expected.'
in
EX_BINARY_OUTPUT
,
EX_BINARY_OUTPUT
)
self
.
assert
_
(
'CxxExceptionInTearDownTest destructor '
self
.
assert
True
(
'called as expected.
'
'CxxExceptionInTearDownTest destructor
'
in
EX_BINARY_OUTPUT
)
'called as expected.'
in
EX_BINARY_OUTPUT
,
EX_BINARY_OUTPUT
)
def
testCatchesCxxExceptionsInTestBody
(
self
):
def
testCatchesCxxExceptionsInTestBody
(
self
):
self
.
assert
_
(
'C++ exception with description "Standard C++ exception"'
self
.
assert
True
(
' thrown in the test body
'
'C++ exception with description "Standard C++ exception"
'
in
EX_BINARY_OUTPUT
)
' thrown in the test body'
in
EX_BINARY_OUTPUT
,
EX_BINARY_OUTPUT
)
self
.
assert
_
(
'CxxExceptionInTestBodyTest::TearDownTestSuite() '
self
.
assert
True
(
'called as expected.
'
'CxxExceptionInTestBodyTest::TearDownTestSuite()
'
in
EX_BINARY_OUTPUT
)
'called as expected.'
in
EX_BINARY_OUTPUT
,
EX_BINARY_OUTPUT
)
self
.
assert
_
(
'CxxExceptionInTestBodyTest destructor '
self
.
assert
True
(
'called as expected.
'
'CxxExceptionInTestBodyTest destructor
'
in
EX_BINARY_OUTPUT
)
'called as expected.'
in
EX_BINARY_OUTPUT
,
EX_BINARY_OUTPUT
)
self
.
assert
_
(
'CxxExceptionInTestBodyTest::TearDown() '
self
.
assert
True
(
'called as expected.
'
'CxxExceptionInTestBodyTest::TearDown()
'
in
EX_BINARY_OUTPUT
)
'called as expected.'
in
EX_BINARY_OUTPUT
,
EX_BINARY_OUTPUT
)
def
testCatchesNonStdCxxExceptions
(
self
):
def
testCatchesNonStdCxxExceptions
(
self
):
self
.
assert_
(
'Unknown C++ exception thrown in the test body'
self
.
assertTrue
(
in
EX_BINARY_OUTPUT
)
'Unknown C++ exception thrown in the test body'
in
EX_BINARY_OUTPUT
,
EX_BINARY_OUTPUT
)
def
testUnhandledCxxExceptionsAbortTheProgram
(
self
):
def
testUnhandledCxxExceptionsAbortTheProgram
(
self
):
# Filters out SEH exception tests on Windows. Unhandled SEH exceptions
# Filters out SEH exception tests on Windows. Unhandled SEH exceptions
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment