diff options
Diffstat (limited to 'gtest/test/gtest_help_test.py')
-rwxr-xr-x | gtest/test/gtest_help_test.py | 55 |
1 files changed, 6 insertions, 49 deletions
diff --git a/gtest/test/gtest_help_test.py b/gtest/test/gtest_help_test.py index 3cb4c48..91081ad 100755 --- a/gtest/test/gtest_help_test.py +++ b/gtest/test/gtest_help_test.py @@ -50,15 +50,6 @@ PROGRAM_PATH = gtest_test_utils.GetTestExecutablePath('gtest_help_test_') FLAG_PREFIX = '--gtest_' CATCH_EXCEPTIONS_FLAG = FLAG_PREFIX + 'catch_exceptions' DEATH_TEST_STYLE_FLAG = FLAG_PREFIX + 'death_test_style' -UNKNOWN_FLAG = FLAG_PREFIX + 'unknown_flag_for_testing' -LIST_TESTS_FLAG = FLAG_PREFIX + 'list_tests' -INCORRECT_FLAG_VARIANTS = [re.sub('^--', '-', LIST_TESTS_FLAG), - re.sub('^--', '/', LIST_TESTS_FLAG), - re.sub('_', '-', LIST_TESTS_FLAG)] -INTERNAL_FLAG_FOR_TESTING = FLAG_PREFIX + 'internal_flag_for_testing' - -SUPPORTS_DEATH_TESTS = "DeathTest" in gtest_test_utils.Subprocess( - [PROGRAM_PATH, LIST_TESTS_FLAG]).output # The help message must match this regex. HELP_REGEX = re.compile( @@ -97,41 +88,18 @@ class GTestHelpTest(gtest_test_utils.TestCase): """Tests the --help flag and its equivalent forms.""" def TestHelpFlag(self, flag): - """Verifies correct behavior when help flag is specified. - - The right message must be printed and the tests must - skipped when the given flag is specified. - - Args: - flag: A flag to pass to the binary or None. - """ + """Verifies that the right message is printed and the tests are + skipped when the given flag is specified.""" exit_code, output = RunWithFlag(flag) self.assertEquals(0, exit_code) self.assert_(HELP_REGEX.search(output), output) if IS_WINDOWS: self.assert_(CATCH_EXCEPTIONS_FLAG in output, output) + self.assert_(DEATH_TEST_STYLE_FLAG not in output, output) else: self.assert_(CATCH_EXCEPTIONS_FLAG not in output, output) - - if SUPPORTS_DEATH_TESTS and not IS_WINDOWS: self.assert_(DEATH_TEST_STYLE_FLAG in output, output) - else: - self.assert_(DEATH_TEST_STYLE_FLAG not in output, output) - - def TestNonHelpFlag(self, flag): - """Verifies correct behavior when no help flag is specified. - - Verifies that when no help flag is specified, the tests are run - and the help message is not printed. - - Args: - flag: A flag to pass to the binary or None. - """ - - exit_code, output = RunWithFlag(flag) - self.assert_(exit_code != 0) - self.assert_(not HELP_REGEX.search(output), output) def testPrintsHelpWithFullFlag(self): self.TestHelpFlag('--help') @@ -145,24 +113,13 @@ class GTestHelpTest(gtest_test_utils.TestCase): def testPrintsHelpWithWindowsStyleQuestionFlag(self): self.TestHelpFlag('/?') - def testPrintsHelpWithUnrecognizedGoogleTestFlag(self): - self.TestHelpFlag(UNKNOWN_FLAG) - - def testPrintsHelpWithIncorrectFlagStyle(self): - for incorrect_flag in INCORRECT_FLAG_VARIANTS: - self.TestHelpFlag(incorrect_flag) - def testRunsTestsWithoutHelpFlag(self): """Verifies that when no help flag is specified, the tests are run and the help message is not printed.""" - self.TestNonHelpFlag(None) - - def testRunsTestsWithGtestInternalFlag(self): - """Verifies that the tests are run and no help message is printed when - a flag starting with Google Test prefix and 'internal_' is supplied.""" - - self.TestNonHelpFlag(INTERNAL_FLAG_FOR_TESTING) + exit_code, output = RunWithFlag(None) + self.assert_(exit_code != 0) + self.assert_(not HELP_REGEX.search(output), output) if __name__ == '__main__': |