googletest-catch-exceptions-test.py (googletest-release-1.11.0) | : | googletest-catch-exceptions-test.py (googletest-release-1.12.0) | ||
---|---|---|---|---|
skipping to change at line 38 | skipping to change at line 38 | |||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||
"""Tests Google Test's exception catching behavior. | """Tests Google Test's exception catching behavior. | |||
This script invokes googletest-catch-exceptions-test_ and | This script invokes googletest-catch-exceptions-test_ and | |||
googletest-catch-exceptions-ex-test_ (programs written with | googletest-catch-exceptions-ex-test_ (programs written with | |||
Google Test) and verifies their output. | Google Test) and verifies their output. | |||
""" | """ | |||
import gtest_test_utils | from googletest.test import gtest_test_utils | |||
# Constants. | # Constants. | |||
FLAG_PREFIX = '--gtest_' | FLAG_PREFIX = '--gtest_' | |||
LIST_TESTS_FLAG = FLAG_PREFIX + 'list_tests' | LIST_TESTS_FLAG = FLAG_PREFIX + 'list_tests' | |||
NO_CATCH_EXCEPTIONS_FLAG = FLAG_PREFIX + 'catch_exceptions=0' | NO_CATCH_EXCEPTIONS_FLAG = FLAG_PREFIX + 'catch_exceptions=0' | |||
FILTER_FLAG = FLAG_PREFIX + 'filter' | FILTER_FLAG = FLAG_PREFIX + 'filter' | |||
# Path to the googletest-catch-exceptions-ex-test_ binary, compiled with | # Path to the googletest-catch-exceptions-ex-test_ binary, compiled with | |||
# exceptions enabled. | # exceptions enabled. | |||
EX_EXE_PATH = gtest_test_utils.GetTestExecutablePath( | EX_EXE_PATH = gtest_test_utils.GetTestExecutablePath( | |||
skipping to change at line 147 | skipping to change at line 147 | |||
'CxxExceptionInDestructorTest::TearDownTestSuite() ' | 'CxxExceptionInDestructorTest::TearDownTestSuite() ' | |||
'called as expected.' in EX_BINARY_OUTPUT, EX_BINARY_OUTPUT) | 'called as expected.' in EX_BINARY_OUTPUT, EX_BINARY_OUTPUT) | |||
def testCatchesCxxExceptionsInSetUpTestCase(self): | def testCatchesCxxExceptionsInSetUpTestCase(self): | |||
self.assertTrue( | self.assertTrue( | |||
'C++ exception with description "Standard C++ exception"' | 'C++ exception with description "Standard C++ exception"' | |||
' thrown in SetUpTestSuite()' in EX_BINARY_OUTPUT, EX_BINARY_OUTPUT) | ' thrown in SetUpTestSuite()' in EX_BINARY_OUTPUT, EX_BINARY_OUTPUT) | |||
self.assertTrue( | self.assertTrue( | |||
'CxxExceptionInConstructorTest::TearDownTestSuite() ' | 'CxxExceptionInConstructorTest::TearDownTestSuite() ' | |||
'called as expected.' in EX_BINARY_OUTPUT, EX_BINARY_OUTPUT) | 'called as expected.' in EX_BINARY_OUTPUT, EX_BINARY_OUTPUT) | |||
self.assertTrue( | self.assertFalse( | |||
'CxxExceptionInSetUpTestSuiteTest constructor ' | 'CxxExceptionInSetUpTestSuiteTest constructor ' | |||
'called as expected.' in EX_BINARY_OUTPUT, EX_BINARY_OUTPUT) | 'called as expected.' in EX_BINARY_OUTPUT, EX_BINARY_OUTPUT) | |||
self.assertTrue( | self.assertFalse( | |||
'CxxExceptionInSetUpTestSuiteTest destructor ' | 'CxxExceptionInSetUpTestSuiteTest destructor ' | |||
'called as expected.' in EX_BINARY_OUTPUT, EX_BINARY_OUTPUT) | 'called as expected.' in EX_BINARY_OUTPUT, EX_BINARY_OUTPUT) | |||
self.assertTrue( | self.assertFalse( | |||
'CxxExceptionInSetUpTestSuiteTest::SetUp() ' | 'CxxExceptionInSetUpTestSuiteTest::SetUp() ' | |||
'called as expected.' in EX_BINARY_OUTPUT, EX_BINARY_OUTPUT) | 'called as expected.' in EX_BINARY_OUTPUT, EX_BINARY_OUTPUT) | |||
self.assertTrue( | self.assertFalse( | |||
'CxxExceptionInSetUpTestSuiteTest::TearDown() ' | 'CxxExceptionInSetUpTestSuiteTest::TearDown() ' | |||
'called as expected.' in EX_BINARY_OUTPUT, EX_BINARY_OUTPUT) | 'called as expected.' in EX_BINARY_OUTPUT, EX_BINARY_OUTPUT) | |||
self.assertTrue( | self.assertFalse( | |||
'CxxExceptionInSetUpTestSuiteTest test body ' | 'CxxExceptionInSetUpTestSuiteTest test body ' | |||
'called as expected.' in EX_BINARY_OUTPUT, EX_BINARY_OUTPUT) | 'called as expected.' in EX_BINARY_OUTPUT, EX_BINARY_OUTPUT) | |||
def testCatchesCxxExceptionsInTearDownTestCase(self): | def testCatchesCxxExceptionsInTearDownTestCase(self): | |||
self.assertTrue( | self.assertTrue( | |||
'C++ exception with description "Standard C++ exception"' | 'C++ exception with description "Standard C++ exception"' | |||
' thrown in TearDownTestSuite()' in EX_BINARY_OUTPUT, EX_BINARY_OUTPUT) | ' thrown in TearDownTestSuite()' in EX_BINARY_OUTPUT, EX_BINARY_OUTPUT) | |||
def testCatchesCxxExceptionsInSetUp(self): | def testCatchesCxxExceptionsInSetUp(self): | |||
self.assertTrue( | self.assertTrue( | |||
End of changes. 6 change blocks. | ||||
6 lines changed or deleted | 6 lines changed or added |