diff options
author | zhanyong.wan <zhanyong.wan@861a406c-534a-0410-8894-cb66d6ee9925> | 2010-08-31 18:21:13 +0000 |
---|---|---|
committer | zhanyong.wan <zhanyong.wan@861a406c-534a-0410-8894-cb66d6ee9925> | 2010-08-31 18:21:13 +0000 |
commit | 35c39756495bea5959de5778aaaf33a94f8c1e2e (patch) | |
tree | fe8cac8d619895feaa69a4e3678f1edd9d4945c4 /test/gtest_catch_exceptions_test.py | |
parent | a9f380f5c7ff75cd715c58e11885dddc54baef02 (diff) | |
download | googletest-35c39756495bea5959de5778aaaf33a94f8c1e2e.tar.gz googletest-35c39756495bea5959de5778aaaf33a94f8c1e2e.tar.bz2 googletest-35c39756495bea5959de5778aaaf33a94f8c1e2e.zip |
Casts char to unsigned char before calling isspace() etc to avoid undefined behavior (by Zhanyong Wan); removes conditional #includes keyed on GTEST_HAS_PROTOBUF_ (by Zhanyong Wan); publishes GTEST_HAS_STREAM_REDIRECTION (by Vlad Losev); forward declares some classes properly (by Samuel Benzaquen); honors the --gtest_catch_exceptions flag (by Vlad Losev).
Diffstat (limited to 'test/gtest_catch_exceptions_test.py')
-rwxr-xr-x | test/gtest_catch_exceptions_test.py | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/test/gtest_catch_exceptions_test.py b/test/gtest_catch_exceptions_test.py index c4d1756d..061c5c3d 100755 --- a/test/gtest_catch_exceptions_test.py +++ b/test/gtest_catch_exceptions_test.py @@ -43,6 +43,8 @@ import gtest_test_utils # Constants. LIST_TESTS_FLAG = '--gtest_list_tests' +CATCH_EXCEPTIONS_FLAG = '--gtest_catch_exceptions=1' +FILTER_FLAG='--gtest_filter' # Path to the gtest_catch_exceptions_ex_test_ binary, compiled with # exceptions enabled. @@ -59,10 +61,11 @@ TEST_LIST = gtest_test_utils.Subprocess([EXE_PATH, LIST_TESTS_FLAG]).output SUPPORTS_SEH_EXCEPTIONS = 'ThrowsSehException' in TEST_LIST if SUPPORTS_SEH_EXCEPTIONS: - BINARY_OUTPUT = gtest_test_utils.Subprocess([EXE_PATH]).output - -EX_BINARY_OUTPUT = gtest_test_utils.Subprocess([EX_EXE_PATH]).output + BINARY_OUTPUT = gtest_test_utils.Subprocess([EXE_PATH, + CATCH_EXCEPTIONS_FLAG]).output +EX_BINARY_OUTPUT = gtest_test_utils.Subprocess([EX_EXE_PATH, + CATCH_EXCEPTIONS_FLAG]).output # The tests. if SUPPORTS_SEH_EXCEPTIONS: @@ -199,5 +202,18 @@ class CatchCxxExceptionsTest(gtest_test_utils.TestCase): self.assert_('Unknown C++ exception thrown in the test body' in EX_BINARY_OUTPUT) + def testUnhandledCxxExceptionsAbortTheProgram(self): + # Filters out SEH exception tests on Windows. Unhandled SEH exceptions + # cause tests to show pop-up windows there. + FITLER_OUT_SEH_TESTS_FLAG = FILTER_FLAG + '=-*Seh*' + # By default, Google Test doesn't catch the exceptions. + uncaught_exceptions_ex_binary_output = gtest_test_utils.Subprocess( + [EX_EXE_PATH, FITLER_OUT_SEH_TESTS_FLAG]).output + + self.assert_('Unhandled C++ exception terminating the program' + in uncaught_exceptions_ex_binary_output) + self.assert_('unexpected' not in uncaught_exceptions_ex_binary_output) + + if __name__ == '__main__': gtest_test_utils.Main() |