Bump to gtest 1.10.0
[platform/upstream/gtest.git] / googletest / test / googletest-catch-exceptions-test.py
similarity index 61%
rename from test/gtest_catch_exceptions_test.py
rename to googletest/test/googletest-catch-exceptions-test.py
index e6fc22f..94a5b33 100755 (executable)
 
 """Tests Google Test's exception catching behavior.
 
-This script invokes gtest_catch_exceptions_test_ and
-gtest_catch_exceptions_ex_test_ (programs written with
+This script invokes googletest-catch-exceptions-test_ and
+googletest-catch-exceptions-ex-test_ (programs written with
 Google Test) and verifies their output.
 """
 
-__author__ = 'vladl@google.com (Vlad Losev)'
-
-import os
-
 import gtest_test_utils
 
 # Constants.
@@ -47,15 +43,15 @@ LIST_TESTS_FLAG = FLAG_PREFIX + 'list_tests'
 NO_CATCH_EXCEPTIONS_FLAG = FLAG_PREFIX + 'catch_exceptions=0'
 FILTER_FLAG = FLAG_PREFIX + 'filter'
 
-# Path to the gtest_catch_exceptions_ex_test_ binary, compiled with
+# Path to the googletest-catch-exceptions-ex-test_ binary, compiled with
 # exceptions enabled.
 EX_EXE_PATH = gtest_test_utils.GetTestExecutablePath(
-    'gtest_catch_exceptions_ex_test_')
+    'googletest-catch-exceptions-ex-test_')
 
-# Path to the gtest_catch_exceptions_test_ binary, compiled with
+# Path to the googletest-catch-exceptions-test_ binary, compiled with
 # exceptions disabled.
 EXE_PATH = gtest_test_utils.GetTestExecutablePath(
-    'gtest_catch_exceptions_no_ex_test_')
+    'googletest-catch-exceptions-no-ex-test_')
 
 environ = gtest_test_utils.environ
 SetEnvVar = gtest_test_utils.SetEnvVar
@@ -93,9 +89,9 @@ if SUPPORTS_SEH_EXCEPTIONS:
       self.assert_('SEH exception with code 0x2a thrown '
                    'in the test fixture\'s destructor'
                    in test_output)
-      self.assert_('SEH exception with code 0x2a thrown in SetUpTestCase()'
+      self.assert_('SEH exception with code 0x2a thrown in SetUpTestSuite()'
                    in test_output)
-      self.assert_('SEH exception with code 0x2a thrown in TearDownTestCase()'
+      self.assert_('SEH exception with code 0x2a thrown in TearDownTestSuite()'
                    in test_output)
       self.assert_('SEH exception with code 0x2a thrown in SetUp()'
                    in test_output)
@@ -121,10 +117,11 @@ class CatchCxxExceptionsTest(gtest_test_utils.TestCase):
   """
 
   def testCatchesCxxExceptionsInFixtureConstructor(self):
-    self.assert_('C++ exception with description '
-                 '"Standard C++ exception" thrown '
-                 'in the test fixture\'s constructor'
-                 in EX_BINARY_OUTPUT)
+    self.assertTrue(
+        'C++ exception with description '
+        '"Standard C++ exception" thrown '
+        'in the test fixture\'s constructor' in EX_BINARY_OUTPUT,
+        EX_BINARY_OUTPUT)
     self.assert_('unexpected' not in EX_BINARY_OUTPUT,
                  'This failure belongs in this test only if '
                  '"CxxExceptionInConstructorTest" (no quotes) '
@@ -134,88 +131,90 @@ class CatchCxxExceptionsTest(gtest_test_utils.TestCase):
       EX_BINARY_OUTPUT):
 
     def testCatchesCxxExceptionsInFixtureDestructor(self):
-      self.assert_('C++ exception with description '
-                   '"Standard C++ exception" thrown '
-                   'in the test fixture\'s destructor'
-                   in EX_BINARY_OUTPUT)
-      self.assert_('CxxExceptionInDestructorTest::TearDownTestCase() '
-                   'called as expected.'
-                   in EX_BINARY_OUTPUT)
+      self.assertTrue(
+          'C++ exception with description '
+          '"Standard C++ exception" thrown '
+          'in the test fixture\'s destructor' in EX_BINARY_OUTPUT,
+          EX_BINARY_OUTPUT)
+      self.assertTrue(
+          'CxxExceptionInDestructorTest::TearDownTestSuite() '
+          'called as expected.' in EX_BINARY_OUTPUT, EX_BINARY_OUTPUT)
 
   def testCatchesCxxExceptionsInSetUpTestCase(self):
-    self.assert_('C++ exception with description "Standard C++ exception"'
-                 ' thrown in SetUpTestCase()'
-                 in EX_BINARY_OUTPUT)
-    self.assert_('CxxExceptionInConstructorTest::TearDownTestCase() '
-                 'called as expected.'
-                 in EX_BINARY_OUTPUT)
-    self.assert_('CxxExceptionInSetUpTestCaseTest constructor '
-                 'called as expected.'
-                 in EX_BINARY_OUTPUT)
-    self.assert_('CxxExceptionInSetUpTestCaseTest destructor '
-                 'called as expected.'
-                 in EX_BINARY_OUTPUT)
-    self.assert_('CxxExceptionInSetUpTestCaseTest::SetUp() '
-                 'called as expected.'
-                 in EX_BINARY_OUTPUT)
-    self.assert_('CxxExceptionInSetUpTestCaseTest::TearDown() '
-                 'called as expected.'
-                 in EX_BINARY_OUTPUT)
-    self.assert_('CxxExceptionInSetUpTestCaseTest test body '
-                 'called as expected.'
-                 in EX_BINARY_OUTPUT)
+    self.assertTrue(
+        'C++ exception with description "Standard C++ exception"'
+        ' thrown in SetUpTestSuite()' in EX_BINARY_OUTPUT, EX_BINARY_OUTPUT)
+    self.assertTrue(
+        'CxxExceptionInConstructorTest::TearDownTestSuite() '
+        'called as expected.' in EX_BINARY_OUTPUT, EX_BINARY_OUTPUT)
+    self.assertTrue(
+        'CxxExceptionInSetUpTestSuiteTest constructor '
+        'called as expected.' in EX_BINARY_OUTPUT, EX_BINARY_OUTPUT)
+    self.assertTrue(
+        'CxxExceptionInSetUpTestSuiteTest destructor '
+        'called as expected.' in EX_BINARY_OUTPUT, EX_BINARY_OUTPUT)
+    self.assertTrue(
+        'CxxExceptionInSetUpTestSuiteTest::SetUp() '
+        'called as expected.' in EX_BINARY_OUTPUT, EX_BINARY_OUTPUT)
+    self.assertTrue(
+        'CxxExceptionInSetUpTestSuiteTest::TearDown() '
+        'called as expected.' in EX_BINARY_OUTPUT, EX_BINARY_OUTPUT)
+    self.assertTrue(
+        'CxxExceptionInSetUpTestSuiteTest test body '
+        'called as expected.' in EX_BINARY_OUTPUT, EX_BINARY_OUTPUT)
 
   def testCatchesCxxExceptionsInTearDownTestCase(self):
-    self.assert_('C++ exception with description "Standard C++ exception"'
-                 ' thrown in TearDownTestCase()'
-                 in EX_BINARY_OUTPUT)
+    self.assertTrue(
+        'C++ exception with description "Standard C++ exception"'
+        ' thrown in TearDownTestSuite()' in EX_BINARY_OUTPUT, EX_BINARY_OUTPUT)
 
   def testCatchesCxxExceptionsInSetUp(self):
-    self.assert_('C++ exception with description "Standard C++ exception"'
-                 ' thrown in SetUp()'
-                 in EX_BINARY_OUTPUT)
-    self.assert_('CxxExceptionInSetUpTest::TearDownTestCase() '
-                 'called as expected.'
-                 in EX_BINARY_OUTPUT)
-    self.assert_('CxxExceptionInSetUpTest destructor '
-                 'called as expected.'
-                 in EX_BINARY_OUTPUT)
-    self.assert_('CxxExceptionInSetUpTest::TearDown() '
-                 'called as expected.'
-                 in EX_BINARY_OUTPUT)
+    self.assertTrue(
+        'C++ exception with description "Standard C++ exception"'
+        ' thrown in SetUp()' in EX_BINARY_OUTPUT, EX_BINARY_OUTPUT)
+    self.assertTrue(
+        'CxxExceptionInSetUpTest::TearDownTestSuite() '
+        'called as expected.' in EX_BINARY_OUTPUT, EX_BINARY_OUTPUT)
+    self.assertTrue(
+        'CxxExceptionInSetUpTest destructor '
+        'called as expected.' in EX_BINARY_OUTPUT, EX_BINARY_OUTPUT)
+    self.assertTrue(
+        'CxxExceptionInSetUpTest::TearDown() '
+        'called as expected.' in EX_BINARY_OUTPUT, EX_BINARY_OUTPUT)
     self.assert_('unexpected' not in EX_BINARY_OUTPUT,
                  'This failure belongs in this test only if '
                  '"CxxExceptionInSetUpTest" (no quotes) '
                  'appears on the same line as words "called unexpectedly"')
 
   def testCatchesCxxExceptionsInTearDown(self):
-    self.assert_('C++ exception with description "Standard C++ exception"'
-                 ' thrown in TearDown()'
-                 in EX_BINARY_OUTPUT)
-    self.assert_('CxxExceptionInTearDownTest::TearDownTestCase() '
-                 'called as expected.'
-                 in EX_BINARY_OUTPUT)
-    self.assert_('CxxExceptionInTearDownTest destructor '
-                 'called as expected.'
-                 in EX_BINARY_OUTPUT)
+    self.assertTrue(
+        'C++ exception with description "Standard C++ exception"'
+        ' thrown in TearDown()' in EX_BINARY_OUTPUT, EX_BINARY_OUTPUT)
+    self.assertTrue(
+        'CxxExceptionInTearDownTest::TearDownTestSuite() '
+        'called as expected.' in EX_BINARY_OUTPUT, EX_BINARY_OUTPUT)
+    self.assertTrue(
+        'CxxExceptionInTearDownTest destructor '
+        'called as expected.' in EX_BINARY_OUTPUT, EX_BINARY_OUTPUT)
 
   def testCatchesCxxExceptionsInTestBody(self):
-    self.assert_('C++ exception with description "Standard C++ exception"'
-                 ' thrown in the test body'
-                 in EX_BINARY_OUTPUT)
-    self.assert_('CxxExceptionInTestBodyTest::TearDownTestCase() '
-                 'called as expected.'
-                 in EX_BINARY_OUTPUT)
-    self.assert_('CxxExceptionInTestBodyTest destructor '
-                 'called as expected.'
-                 in EX_BINARY_OUTPUT)
-    self.assert_('CxxExceptionInTestBodyTest::TearDown() '
-                 'called as expected.'
-                 in EX_BINARY_OUTPUT)
+    self.assertTrue(
+        'C++ exception with description "Standard C++ exception"'
+        ' thrown in the test body' in EX_BINARY_OUTPUT, EX_BINARY_OUTPUT)
+    self.assertTrue(
+        'CxxExceptionInTestBodyTest::TearDownTestSuite() '
+        'called as expected.' in EX_BINARY_OUTPUT, EX_BINARY_OUTPUT)
+    self.assertTrue(
+        'CxxExceptionInTestBodyTest destructor '
+        'called as expected.' in EX_BINARY_OUTPUT, EX_BINARY_OUTPUT)
+    self.assertTrue(
+        'CxxExceptionInTestBodyTest::TearDown() '
+        'called as expected.' in EX_BINARY_OUTPUT, EX_BINARY_OUTPUT)
 
   def testCatchesNonStdCxxExceptions(self):
-    self.assert_('Unknown C++ exception thrown in the test body'
-                 in EX_BINARY_OUTPUT)
+    self.assertTrue(
+        'Unknown C++ exception thrown in the test body' in EX_BINARY_OUTPUT,
+        EX_BINARY_OUTPUT)
 
   def testUnhandledCxxExceptionsAbortTheProgram(self):
     # Filters out SEH exception tests on Windows. Unhandled SEH exceptions