diff options
Diffstat (limited to 'googletest/test')
-rw-r--r-- | googletest/test/BUILD.bazel | 257 | ||||
-rwxr-xr-x | googletest/test/googletest-break-on-failure-unittest.py (renamed from googletest/test/gtest_break_on_failure_unittest.py) | 8 | ||||
-rw-r--r-- | googletest/test/googletest-break-on-failure-unittest_.cc (renamed from googletest/test/gtest_break_on_failure_unittest_.cc) | 0 | ||||
-rwxr-xr-x | googletest/test/googletest-catch-exceptions-test.py (renamed from googletest/test/gtest_catch_exceptions_test.py) | 12 | ||||
-rw-r--r-- | googletest/test/googletest-catch-exceptions-test_.cc (renamed from googletest/test/gtest_catch_exceptions_test_.cc) | 2 | ||||
-rwxr-xr-x | googletest/test/googletest-color-test.py (renamed from googletest/test/gtest_color_test.py) | 4 | ||||
-rw-r--r-- | googletest/test/googletest-color-test_.cc (renamed from googletest/test/gtest_color_test_.cc) | 0 | ||||
-rw-r--r-- | googletest/test/googletest-death-test-test.cc (renamed from googletest/test/gtest-death-test_test.cc) | 2 | ||||
-rw-r--r-- | googletest/test/googletest-death-test_ex_test.cc (renamed from googletest/test/gtest-death-test_ex_test.cc) | 2 | ||||
-rwxr-xr-x | googletest/test/googletest-env-var-test.py (renamed from googletest/test/gtest_env_var_test.py) | 4 | ||||
-rw-r--r-- | googletest/test/googletest-env-var-test_.cc (renamed from googletest/test/gtest_env_var_test_.cc) | 2 | ||||
-rw-r--r-- | googletest/test/googletest-filepath-test.cc (renamed from googletest/test/gtest-filepath_test.cc) | 0 | ||||
-rwxr-xr-x | googletest/test/googletest-filter-unittest.py (renamed from googletest/test/gtest_filter_unittest.py) | 12 | ||||
-rw-r--r-- | googletest/test/googletest-filter-unittest_.cc (renamed from googletest/test/gtest_filter_unittest_.cc) | 0 | ||||
-rw-r--r-- | googletest/test/googletest-json-outfiles-test.py (renamed from googletest/test/gtest_json_outfiles_test.py) | 0 | ||||
-rw-r--r-- | googletest/test/googletest-json-output-unittest.py (renamed from googletest/test/gtest_json_output_unittest.py) | 9 | ||||
-rw-r--r-- | googletest/test/googletest-linked-ptr-test.cc (renamed from googletest/test/gtest-linked_ptr_test.cc) | 0 | ||||
-rwxr-xr-x | googletest/test/googletest-list-tests-unittest.py (renamed from googletest/test/gtest_list_tests_unittest.py) | 14 | ||||
-rw-r--r-- | googletest/test/googletest-list-tests-unittest_.cc (renamed from googletest/test/gtest_list_tests_unittest_.cc) | 0 | ||||
-rw-r--r-- | googletest/test/googletest-listener-test.cc (renamed from googletest/test/gtest-listener_test.cc) | 0 | ||||
-rw-r--r-- | googletest/test/googletest-message-test.cc (renamed from googletest/test/gtest-message_test.cc) | 0 | ||||
-rw-r--r-- | googletest/test/googletest-options-test.cc (renamed from googletest/test/gtest-options_test.cc) | 4 | ||||
-rw-r--r-- | googletest/test/googletest-output-test-golden-lin.txt (renamed from googletest/test/gtest_output_test_golden_lin.txt) | 204 | ||||
-rwxr-xr-x | googletest/test/googletest-output-test.py (renamed from googletest/test/gtest_output_test.py) | 20 | ||||
-rw-r--r-- | googletest/test/googletest-output-test_.cc (renamed from googletest/test/gtest_output_test_.cc) | 2 | ||||
-rw-r--r-- | googletest/test/googletest-param-test-invalid-name1-test.py | 72 | ||||
-rw-r--r-- | googletest/test/googletest-param-test-invalid-name1-test_.cc | 51 | ||||
-rw-r--r-- | googletest/test/googletest-param-test-invalid-name2-test.py | 71 | ||||
-rw-r--r-- | googletest/test/googletest-param-test-invalid-name2-test_.cc | 56 | ||||
-rw-r--r-- | googletest/test/googletest-param-test-test.cc (renamed from googletest/test/gtest-param-test_test.cc) | 2 | ||||
-rw-r--r-- | googletest/test/googletest-param-test-test.h (renamed from googletest/test/gtest-param-test_test.h) | 0 | ||||
-rw-r--r-- | googletest/test/googletest-param-test2-test.cc (renamed from googletest/test/gtest-param-test2_test.cc) | 8 | ||||
-rw-r--r-- | googletest/test/googletest-port-test.cc (renamed from googletest/test/gtest-port_test.cc) | 6 | ||||
-rw-r--r-- | googletest/test/googletest-printers-test.cc (renamed from googletest/test/gtest-printers_test.cc) | 0 | ||||
-rwxr-xr-x | googletest/test/googletest-shuffle-test.py (renamed from googletest/test/gtest_shuffle_test.py) | 6 | ||||
-rw-r--r-- | googletest/test/googletest-shuffle-test_.cc (renamed from googletest/test/gtest_shuffle_test_.cc) | 0 | ||||
-rw-r--r-- | googletest/test/googletest-test-part-test.cc (renamed from googletest/test/gtest-test-part_test.cc) | 0 | ||||
-rw-r--r-- | googletest/test/googletest-test2_test.cc | 61 | ||||
-rwxr-xr-x | googletest/test/googletest-throw-on-failure-test.py (renamed from googletest/test/gtest_throw_on_failure_test.py) | 10 | ||||
-rw-r--r-- | googletest/test/googletest-throw-on-failure-test_.cc (renamed from googletest/test/gtest_throw_on_failure_test_.cc) | 2 | ||||
-rw-r--r-- | googletest/test/googletest-tuple-test.cc (renamed from googletest/test/gtest-tuple_test.cc) | 0 | ||||
-rwxr-xr-x | googletest/test/googletest-uninitialized-test.py (renamed from googletest/test/gtest_uninitialized_test.py) | 2 | ||||
-rw-r--r-- | googletest/test/googletest-uninitialized-test_.cc (renamed from googletest/test/gtest_uninitialized_test_.cc) | 0 | ||||
-rw-r--r-- | googletest/test/gtest_all_test.cc | 12 | ||||
-rw-r--r-- | googletest/test/gtest_test_macro_stack_footprint_test.cc | 90 | ||||
-rw-r--r-- | googletest/test/gtest_unittest.cc | 2 |
46 files changed, 763 insertions, 246 deletions
diff --git a/googletest/test/BUILD.bazel b/googletest/test/BUILD.bazel index 405feee..a930d65 100644 --- a/googletest/test/BUILD.bazel +++ b/googletest/test/BUILD.bazel @@ -49,31 +49,48 @@ config_setting( values = {"define": "absl=1"}, ) -#on windows exclude gtest-tuple.h and gtest-tuple_test.cc +#on windows exclude gtest-tuple.h and googletest-tuple-test.cc cc_test( name = "gtest_all_test", size = "small", srcs = glob( include = [ "gtest-*.cc", + "googletest-*.cc", "*.h", "googletest/include/gtest/**/*.h", ], exclude = [ "gtest-unittest-api_test.cc", - "gtest-tuple_test.cc", + "googletest-tuple-test.cc", "googletest/src/gtest-all.cc", "gtest_all_test.cc", "gtest-death-test_ex_test.cc", "gtest-listener_test.cc", "gtest-unittest-api_test.cc", - "gtest-param-test_test.cc", + "googletest-param-test-test.cc", + "googletest-catch-exceptions-test_.cc", + "googletest-color-test_.cc", + "googletest-env-var-test_.cc", + "googletest-filter-unittest_.cc", + "googletest-break-on-failure-unittest_.cc", + "googletest-listener-test.cc", + "googletest-output-test_.cc", + "googletest-list-tests-unittest_.cc", + "googletest-shuffle-test_.cc", + "googletest-uninitialized-test_.cc", + "googletest-death-test_ex_test.cc", + "googletest-param-test-test", + "googletest-throw-on-failure-test_.cc", + "googletest-param-test-invalid-name1-test_.cc", + "googletest-param-test-invalid-name2-test_.cc", + ], ) + select({ "//:windows": [], "//:windows_msvc": [], "//conditions:default": [ - "gtest-tuple_test.cc", + "googletest-tuple-test.cc", ], }), copts = select({ @@ -97,16 +114,28 @@ cc_test( deps = ["//:gtest_main"], ) + +# Tests death tests. +cc_test( + name = "googletest-death-test-test", + size = "medium", + srcs = ["googletest-death-test-test.cc"], + deps = ["//:gtest_main"], +) + +cc_test( + name = "gtest_test_macro_stack_footprint_test", + size = "small", + srcs = ["gtest_test_macro_stack_footprint_test.cc"], + deps = ["//:gtest"], +) + #These googletest tests have their own main() cc_test( - name = "gtest-listener_test", + name = "googletest-listener-test", size = "small", - srcs = [ - "gtest-listener_test.cc", - ], - deps = [ - "//:gtest", - ], + srcs = ["googletest-listener-test.cc"], + deps = ["//:gtest_main"], ) cc_test( @@ -121,16 +150,14 @@ cc_test( ) cc_test( - name = "gtest-param-test_test", + name = "googletest-param-test-test", size = "small", srcs = [ - "gtest-param-test2_test.cc", - "gtest-param-test_test.cc", - "gtest-param-test_test.h", - ], - deps = [ - "//:gtest", + "googletest-param-test-test.cc", + "googletest-param-test-test.h", + "googletest-param-test2-test.cc", ], + deps = ["//:gtest"], ) cc_test( @@ -166,87 +193,92 @@ py_test( ) cc_binary( - name = "gtest_output_test_", + name = "googletest-output-test_", testonly = 1, - srcs = ["gtest_output_test_.cc"], + srcs = ["googletest-output-test_.cc"], deps = ["//:gtest"], ) + py_test( - name = "gtest_output_test", + name = "googletest-output-test", size = "small", - srcs = ["gtest_output_test.py"], + srcs = ["googletest-output-test.py"], args = select({ ":has_absl": [], "//conditions:default": ["--no_stacktrace_support"], }), data = [ - "gtest_output_test_golden_lin.txt", - ":gtest_output_test_", + "googletest-output-test-golden-lin.txt", + ":googletest-output-test_", ], deps = [":gtest_test_utils"], ) cc_binary( - name = "gtest_color_test_", + name = "googletest-color-test_", testonly = 1, - srcs = ["gtest_color_test_.cc"], + srcs = ["googletest-color-test_.cc"], deps = ["//:gtest"], ) py_test( - name = "gtest_color_test", + name = "googletest-color-test", size = "small", - srcs = ["gtest_color_test.py"], - data = [":gtest_color_test_"], + srcs = ["googletest-color-test.py"], + data = [":googletest-color-test_"], deps = [":gtest_test_utils"], ) cc_binary( - name = "gtest_env_var_test_", + name = "googletest-env-var-test_", testonly = 1, - srcs = ["gtest_env_var_test_.cc"], + srcs = ["googletest-env-var-test_.cc"], deps = ["//:gtest"], ) py_test( - name = "gtest_env_var_test", - size = "small", - srcs = ["gtest_env_var_test.py"], - data = [":gtest_env_var_test_"], + name = "googletest-env-var-test", + size = "medium", + srcs = ["googletest-env-var-test.py"], + data = [":googletest-env-var-test_"], deps = [":gtest_test_utils"], ) cc_binary( - name = "gtest_filter_unittest_", + name = "googletest-filter-unittest_", testonly = 1, - srcs = ["gtest_filter_unittest_.cc"], + srcs = ["googletest-filter-unittest_.cc"], deps = ["//:gtest"], ) py_test( - name = "gtest_filter_unittest", - size = "small", - srcs = ["gtest_filter_unittest.py"], - data = [":gtest_filter_unittest_"], + name = "googletest-filter-unittest", + size = "medium", + srcs = ["googletest-filter-unittest.py"], + data = [":googletest-filter-unittest_"], deps = [":gtest_test_utils"], ) + cc_binary( - name = "gtest_break_on_failure_unittest_", + name = "googletest-break-on-failure-unittest_", testonly = 1, - srcs = ["gtest_break_on_failure_unittest_.cc"], + srcs = ["googletest-break-on-failure-unittest_.cc"], deps = ["//:gtest"], ) + + py_test( - name = "gtest_break_on_failure_unittest", + name = "googletest-break-on-failure-unittest", size = "small", - srcs = ["gtest_break_on_failure_unittest.py"], - data = [":gtest_break_on_failure_unittest_"], + srcs = ["googletest-break-on-failure-unittest.py"], + data = [":googletest-break-on-failure-unittest_"], deps = [":gtest_test_utils"], ) + cc_test( name = "gtest_assert_by_exception_test", size = "small", @@ -254,72 +286,75 @@ cc_test( deps = ["//:gtest"], ) + + cc_binary( - name = "gtest_throw_on_failure_test_", + name = "googletest-throw-on-failure-test_", testonly = 1, - srcs = ["gtest_throw_on_failure_test_.cc"], + srcs = ["googletest-throw-on-failure-test_.cc"], deps = ["//:gtest"], ) py_test( - name = "gtest_throw_on_failure_test", + name = "googletest-throw-on-failure-test", size = "small", - srcs = ["gtest_throw_on_failure_test.py"], - data = [":gtest_throw_on_failure_test_"], + srcs = ["googletest-throw-on-failure-test.py"], + data = [":googletest-throw-on-failure-test_"], deps = [":gtest_test_utils"], ) + cc_binary( - name = "gtest_list_tests_unittest_", + name = "googletest-list-tests-unittest_", testonly = 1, - srcs = ["gtest_list_tests_unittest_.cc"], + srcs = ["googletest-list-tests-unittest_.cc"], deps = ["//:gtest"], ) py_test( - name = "gtest_list_tests_unittest", + name = "googletest-list-tests-unittest", size = "small", - srcs = ["gtest_list_tests_unittest.py"], - data = [":gtest_list_tests_unittest_"], + srcs = ["googletest-list-tests-unittest.py"], + data = [":googletest-list-tests-unittest_"], deps = [":gtest_test_utils"], ) cc_binary( - name = "gtest_shuffle_test_", - srcs = ["gtest_shuffle_test_.cc"], + name = "googletest-shuffle-test_", + srcs = ["googletest-shuffle-test_.cc"], deps = ["//:gtest"], ) py_test( - name = "gtest_shuffle_test", + name = "googletest-shuffle-test", size = "small", - srcs = ["gtest_shuffle_test.py"], - data = [":gtest_shuffle_test_"], + srcs = ["googletest-shuffle-test.py"], + data = [":googletest-shuffle-test_"], deps = [":gtest_test_utils"], ) cc_binary( - name = "gtest_catch_exceptions_no_ex_test_", + name = "googletest-catch-exceptions-no-ex-test_", testonly = 1, - srcs = ["gtest_catch_exceptions_test_.cc"], + srcs = ["googletest-catch-exceptions-test_.cc"], deps = ["//:gtest_main"], ) cc_binary( - name = "gtest_catch_exceptions_ex_test_", + name = "googletest-catch-exceptions-ex-test_", testonly = 1, - srcs = ["gtest_catch_exceptions_test_.cc"], + srcs = ["googletest-catch-exceptions-test_.cc"], copts = ["-fexceptions"], deps = ["//:gtest_main"], ) py_test( - name = "gtest_catch_exceptions_test", + name = "googletest-catch-exceptions-test", size = "small", - srcs = ["gtest_catch_exceptions_test.py"], + srcs = ["googletest-catch-exceptions-test.py"], data = [ - ":gtest_catch_exceptions_ex_test_", - ":gtest_catch_exceptions_no_ex_test_", + ":googletest-catch-exceptions-ex-test_", + ":googletest-catch-exceptions-no-ex-test_", ], deps = [":gtest_test_utils"], ) @@ -387,17 +422,17 @@ py_test( ) cc_binary( - name = "gtest_uninitialized_test_", + name = "googletest-uninitialized-test_", testonly = 1, - srcs = ["gtest_uninitialized_test_.cc"], + srcs = ["googletest-uninitialized-test_.cc"], deps = ["//:gtest"], ) py_test( - name = "gtest_uninitialized_test", + name = "googletest-uninitialized-test", size = "medium", - srcs = ["gtest_uninitialized_test.py"], - data = [":gtest_uninitialized_test_"], + srcs = ["googletest-uninitialized-test.py"], + data = ["googletest-uninitialized-test_"], deps = [":gtest_test_utils"], ) @@ -416,3 +451,77 @@ py_test( data = [":gtest_testbridge_test_"], deps = [":gtest_test_utils"], ) + + +py_test( + name = "googletest-json-outfiles-test", + size = "small", + srcs = [ + "googletest-json-outfiles-test.py", + "gtest_json_test_utils.py", + ], + data = [ + ":gtest_xml_outfile1_test_", + ":gtest_xml_outfile2_test_", + ], + deps = [":gtest_test_utils"], +) + +py_test( + name = "googletest-json-output-unittest", + size = "medium", + srcs = [ + "googletest-json-output-unittest.py", + "gtest_json_test_utils.py", + ], + data = [ + # We invoke gtest_no_test_unittest to verify the JSON output + # when the test program contains no test definition. + ":gtest_no_test_unittest", + ":gtest_xml_output_unittest_", + ], + args = select({ + ":has_absl": [], + "//conditions:default": ["--no_stacktrace_support"], + }), + deps = [":gtest_test_utils"], +) +# Verifies interaction of death tests and exceptions. +cc_test( + name = "googletest-death-test_ex_catch_test", + size = "medium", + srcs = ["googletest-death-test_ex_test.cc"], + copts = ["-fexceptions"], + defines = ["GTEST_ENABLE_CATCH_EXCEPTIONS_=1"], + deps = ["//:gtest"], +) + +cc_binary( + name = "googletest-param-test-invalid-name1-test_", + testonly = 1, + srcs = ["googletest-param-test-invalid-name1-test_.cc"], + deps = ["//:gtest"], +) + +cc_binary( + name = "googletest-param-test-invalid-name2-test_", + testonly = 1, + srcs = ["googletest-param-test-invalid-name2-test_.cc"], + deps = ["//:gtest"], +) + +py_test( + name = "googletest-param-test-invalid-name1-test", + size = "small", + srcs = ["googletest-param-test-invalid-name1-test.py"], + data = [":googletest-param-test-invalid-name1-test_"], + deps = [":gtest_test_utils"], +) + +py_test( + name = "googletest-param-test-invalid-name2-test", + size = "small", + srcs = ["googletest-param-test-invalid-name2-test.py"], + data = [":googletest-param-test-invalid-name2-test_"], + deps = [":gtest_test_utils"], +) diff --git a/googletest/test/gtest_break_on_failure_unittest.py b/googletest/test/googletest-break-on-failure-unittest.py index 16e19db..cd77547 100755 --- a/googletest/test/gtest_break_on_failure_unittest.py +++ b/googletest/test/googletest-break-on-failure-unittest.py @@ -34,7 +34,7 @@ A user can ask Google Test to seg-fault when an assertion fails, using either the GTEST_BREAK_ON_FAILURE environment variable or the --gtest_break_on_failure flag. This script tests such functionality -by invoking gtest_break_on_failure_unittest_ (a program written with +by invoking googletest-break-on-failure-unittest_ (a program written with Google Test) with different environments and command line flags. """ @@ -59,9 +59,9 @@ THROW_ON_FAILURE_ENV_VAR = 'GTEST_THROW_ON_FAILURE' # The environment variable for enabling/disabling the catch-exceptions mode. CATCH_EXCEPTIONS_ENV_VAR = 'GTEST_CATCH_EXCEPTIONS' -# Path to the gtest_break_on_failure_unittest_ program. +# Path to the googletest-break-on-failure-unittest_ program. EXE_PATH = gtest_test_utils.GetTestExecutablePath( - 'gtest_break_on_failure_unittest_') + 'googletest-break-on-failure-unittest_') environ = gtest_test_utils.environ @@ -95,7 +95,7 @@ class GTestBreakOnFailureUnitTest(gtest_test_utils.TestCase): """ def RunAndVerify(self, env_var_value, flag_value, expect_seg_fault): - """Runs gtest_break_on_failure_unittest_ and verifies that it does + """Runs googletest-break-on-failure-unittest_ and verifies that it does (or does not) have a seg-fault. Args: diff --git a/googletest/test/gtest_break_on_failure_unittest_.cc b/googletest/test/googletest-break-on-failure-unittest_.cc index 1231ec2..1231ec2 100644 --- a/googletest/test/gtest_break_on_failure_unittest_.cc +++ b/googletest/test/googletest-break-on-failure-unittest_.cc diff --git a/googletest/test/gtest_catch_exceptions_test.py b/googletest/test/googletest-catch-exceptions-test.py index 760f914..69dbadf 100755 --- a/googletest/test/gtest_catch_exceptions_test.py +++ b/googletest/test/googletest-catch-exceptions-test.py @@ -30,8 +30,8 @@ """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. """ @@ -45,15 +45,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 diff --git a/googletest/test/gtest_catch_exceptions_test_.cc b/googletest/test/googletest-catch-exceptions-test_.cc index c6d953c..cb018f9 100644 --- a/googletest/test/gtest_catch_exceptions_test_.cc +++ b/googletest/test/googletest-catch-exceptions-test_.cc @@ -30,7 +30,7 @@ // Author: vladl@google.com (Vlad Losev) // // Tests for Google Test itself. Tests in this file throw C++ or SEH -// exceptions, and the output is verified by gtest_catch_exceptions_test.py. +// exceptions, and the output is verified by googletest-catch-exceptions-test.py. #include "gtest/gtest.h" diff --git a/googletest/test/gtest_color_test.py b/googletest/test/googletest-color-test.py index 49b8ed2..875d478 100755 --- a/googletest/test/gtest_color_test.py +++ b/googletest/test/googletest-color-test.py @@ -40,7 +40,7 @@ IS_WINDOWS = os.name == 'nt' COLOR_ENV_VAR = 'GTEST_COLOR' COLOR_FLAG = 'gtest_color' -COMMAND = gtest_test_utils.GetTestExecutablePath('gtest_color_test_') +COMMAND = gtest_test_utils.GetTestExecutablePath('googletest-color-test_') def SetEnvVar(env_var, value): @@ -53,7 +53,7 @@ def SetEnvVar(env_var, value): def UsesColor(term, color_env_var, color_flag): - """Runs gtest_color_test_ and returns its exit code.""" + """Runs googletest-color-test_ and returns its exit code.""" SetEnvVar('TERM', term) SetEnvVar(COLOR_ENV_VAR, color_env_var) diff --git a/googletest/test/gtest_color_test_.cc b/googletest/test/googletest-color-test_.cc index f9a21e2..f9a21e2 100644 --- a/googletest/test/gtest_color_test_.cc +++ b/googletest/test/googletest-color-test_.cc diff --git a/googletest/test/gtest-death-test_test.cc b/googletest/test/googletest-death-test-test.cc index 37261cb..9d8f13c 100644 --- a/googletest/test/gtest-death-test_test.cc +++ b/googletest/test/googletest-death-test-test.cc @@ -784,7 +784,7 @@ static void TestExitMacros() { // Of all signals effects on the process exit code, only those of SIGABRT // are documented on Windows. - // See http://msdn.microsoft.com/en-us/library/dwwzkt4c(VS.71).aspx. + // See https://msdn.microsoft.com/en-us/query-bi/m/dwwzkt4c. EXPECT_EXIT(raise(SIGABRT), testing::ExitedWithCode(3), "") << "b_ar"; # elif !GTEST_OS_FUCHSIA diff --git a/googletest/test/gtest-death-test_ex_test.cc b/googletest/test/googletest-death-test_ex_test.cc index b50a13d..3391074 100644 --- a/googletest/test/gtest-death-test_ex_test.cc +++ b/googletest/test/googletest-death-test_ex_test.cc @@ -69,7 +69,7 @@ TEST(CxxExceptionDeathTest, PrintsMessageForStdExceptions) { "exceptional message"); // Verifies that the location is mentioned in the failure text. EXPECT_NONFATAL_FAILURE(EXPECT_DEATH(throw TestException(), ""), - "gtest-death-test_ex_test.cc"); + "googletest-death-test_ex_test.cc"); } # endif // GTEST_HAS_EXCEPTIONS diff --git a/googletest/test/gtest_env_var_test.py b/googletest/test/googletest-env-var-test.py index beb2a8b..9c80e2a 100755 --- a/googletest/test/gtest_env_var_test.py +++ b/googletest/test/googletest-env-var-test.py @@ -40,7 +40,7 @@ import gtest_test_utils IS_WINDOWS = os.name == 'nt' IS_LINUX = os.name == 'posix' and os.uname()[0] == 'Linux' -COMMAND = gtest_test_utils.GetTestExecutablePath('gtest_env_var_test_') +COMMAND = gtest_test_utils.GetTestExecutablePath('googletest-env-var-test_') environ = os.environ.copy() @@ -62,7 +62,7 @@ def SetEnvVar(env_var, value): def GetFlag(flag): - """Runs gtest_env_var_test_ and returns its output.""" + """Runs googletest-env-var-test_ and returns its output.""" args = [COMMAND] if flag is not None: diff --git a/googletest/test/gtest_env_var_test_.cc b/googletest/test/googletest-env-var-test_.cc index 9b668dc..74b9506 100644 --- a/googletest/test/gtest_env_var_test_.cc +++ b/googletest/test/googletest-env-var-test_.cc @@ -115,7 +115,7 @@ int main(int argc, char** argv) { testing::InitGoogleTest(&argc, argv); if (argc != 2) { - cout << "Usage: gtest_env_var_test_ NAME_OF_FLAG\n"; + cout << "Usage: googletest-env-var-test_ NAME_OF_FLAG\n"; return 1; } diff --git a/googletest/test/gtest-filepath_test.cc b/googletest/test/googletest-filepath-test.cc index 29cea3d..29cea3d 100644 --- a/googletest/test/gtest-filepath_test.cc +++ b/googletest/test/googletest-filepath-test.cc diff --git a/googletest/test/gtest_filter_unittest.py b/googletest/test/googletest-filter-unittest.py index 92cc77c..1e554d5 100755 --- a/googletest/test/gtest_filter_unittest.py +++ b/googletest/test/googletest-filter-unittest.py @@ -33,7 +33,7 @@ A user can specify which test(s) in a Google Test program to run via either the GTEST_FILTER environment variable or the --gtest_filter flag. This script tests such functionality by invoking -gtest_filter_unittest_ (a program written with Google Test) with different +googletest-filter-unittest_ (a program written with Google Test) with different environments and command line flags. Note that test sharding may also influence which tests are filtered. Therefore, @@ -100,8 +100,8 @@ FILTER_FLAG = 'gtest_filter' # The command line flag for including disabled tests. ALSO_RUN_DISABLED_TESTS_FLAG = 'gtest_also_run_disabled_tests' -# Command to run the gtest_filter_unittest_ program. -COMMAND = gtest_test_utils.GetTestExecutablePath('gtest_filter_unittest_') +# Command to run the googletest-filter-unittest_ program. +COMMAND = gtest_test_utils.GetTestExecutablePath('googletest-filter-unittest_') # Regex for determining whether parameterized tests are enabled in the binary. PARAM_TEST_REGEX = re.compile(r'/ParamTest') @@ -120,7 +120,7 @@ LIST_TESTS_FLAG = '--gtest_list_tests' SUPPORTS_DEATH_TESTS = 'HasDeathTest' in gtest_test_utils.Subprocess( [COMMAND, LIST_TESTS_FLAG]).output -# Full names of all tests in gtest_filter_unittests_. +# Full names of all tests in googletest-filter-unittests_. PARAM_TESTS = [ 'SeqP/ParamTest.TestX/0', 'SeqP/ParamTest.TestX/1', @@ -292,7 +292,7 @@ class GTestFilterUnitTest(gtest_test_utils.TestCase): args=None, check_exit_0=False): """Checks that binary runs correct tests for the given filter and shard. - Runs all shards of gtest_filter_unittest_ with the given filter, and + Runs all shards of googletest-filter-unittest_ with the given filter, and verifies that the right set of tests were run. The union of tests run on each shard should be identical to tests_to_run, without duplicates. If check_exit_0, . @@ -330,7 +330,7 @@ class GTestFilterUnitTest(gtest_test_utils.TestCase): def RunAndVerifyAllowingDisabled(self, gtest_filter, tests_to_run): """Checks that the binary runs correct set of tests for the given filter. - Runs gtest_filter_unittest_ with the given filter, and enables + Runs googletest-filter-unittest_ with the given filter, and enables disabled tests. Verifies that the right set of tests were run. Args: diff --git a/googletest/test/gtest_filter_unittest_.cc b/googletest/test/googletest-filter-unittest_.cc index e74a7a3..e74a7a3 100644 --- a/googletest/test/gtest_filter_unittest_.cc +++ b/googletest/test/googletest-filter-unittest_.cc diff --git a/googletest/test/gtest_json_outfiles_test.py b/googletest/test/googletest-json-outfiles-test.py index 46010d8..46010d8 100644 --- a/googletest/test/gtest_json_outfiles_test.py +++ b/googletest/test/googletest-json-outfiles-test.py diff --git a/googletest/test/gtest_json_output_unittest.py b/googletest/test/googletest-json-output-unittest.py index 12047c4..57dcd5f 100644 --- a/googletest/test/gtest_json_output_unittest.py +++ b/googletest/test/googletest-json-output-unittest.py @@ -46,7 +46,10 @@ GTEST_OUTPUT_FLAG = '--gtest_output' GTEST_DEFAULT_OUTPUT_FILE = 'test_detail.json' GTEST_PROGRAM_NAME = 'gtest_xml_output_unittest_' -SUPPORTS_STACK_TRACES = False +# The flag indicating stacktraces are not supported +NO_STACKTRACE_SUPPORT_FLAG = '--no_stacktrace_support' + +SUPPORTS_STACK_TRACES = NO_STACKTRACE_SUPPORT_FLAG not in sys.argv if SUPPORTS_STACK_TRACES: STACK_TRACE_TEMPLATE = '\nStack trace:\n*' @@ -607,5 +610,9 @@ class GTestJsonOutputUnitTest(gtest_test_utils.TestCase): if __name__ == '__main__': + if NO_STACKTRACE_SUPPORT_FLAG in sys.argv: + # unittest.main() can't handle unknown flags + sys.argv.remove(NO_STACKTRACE_SUPPORT_FLAG) + os.environ['GTEST_STACK_TRACE_DEPTH'] = '1' gtest_test_utils.Main() diff --git a/googletest/test/gtest-linked_ptr_test.cc b/googletest/test/googletest-linked-ptr-test.cc index 6fcf512..6fcf512 100644 --- a/googletest/test/gtest-linked_ptr_test.cc +++ b/googletest/test/googletest-linked-ptr-test.cc diff --git a/googletest/test/gtest_list_tests_unittest.py b/googletest/test/googletest-list-tests-unittest.py index ebf1a3c..a38073a 100755 --- a/googletest/test/gtest_list_tests_unittest.py +++ b/googletest/test/googletest-list-tests-unittest.py @@ -33,7 +33,7 @@ A user can ask Google Test to list all tests by specifying the --gtest_list_tests flag. This script tests such functionality -by invoking gtest_list_tests_unittest_ (a program written with +by invoking googletest-list-tests-unittest_ (a program written with Google Test) the command line flags. """ @@ -47,10 +47,10 @@ import gtest_test_utils # The command line flag for enabling/disabling listing all tests. LIST_TESTS_FLAG = 'gtest_list_tests' -# Path to the gtest_list_tests_unittest_ program. -EXE_PATH = gtest_test_utils.GetTestExecutablePath('gtest_list_tests_unittest_') +# Path to the googletest-list-tests-unittest_ program. +EXE_PATH = gtest_test_utils.GetTestExecutablePath('googletest-list-tests-unittest_') -# The expected output when running gtest_list_tests_unittest_ with +# The expected output when running googletest-list-tests-unittest_ with # --gtest_list_tests EXPECTED_OUTPUT_NO_FILTER_RE = re.compile(r"""FooDeathTest\. Test1 @@ -94,7 +94,7 @@ MyInstantiation/ValueParamTest\. TestB/2 # GetParam\(\) = a very\\nlo{241}\.\.\. """) -# The expected output when running gtest_list_tests_unittest_ with +# The expected output when running googletest-list-tests-unittest_ with # --gtest_list_tests and --gtest_filter=Foo*. EXPECTED_OUTPUT_FILTER_FOO_RE = re.compile(r"""FooDeathTest\. Test1 @@ -114,7 +114,7 @@ FooTest\. def Run(args): - """Runs gtest_list_tests_unittest_ and returns the list of tests printed.""" + """Runs googletest-list-tests-unittest_ and returns the list of tests printed.""" return gtest_test_utils.Subprocess([EXE_PATH] + args, capture_stderr=False).output @@ -127,7 +127,7 @@ class GTestListTestsUnitTest(gtest_test_utils.TestCase): """Tests using the --gtest_list_tests flag to list all tests.""" def RunAndVerify(self, flag_value, expected_output_re, other_flag): - """Runs gtest_list_tests_unittest_ and verifies that it prints + """Runs googletest-list-tests-unittest_ and verifies that it prints the correct tests. Args: diff --git a/googletest/test/gtest_list_tests_unittest_.cc b/googletest/test/googletest-list-tests-unittest_.cc index 907c176..907c176 100644 --- a/googletest/test/gtest_list_tests_unittest_.cc +++ b/googletest/test/googletest-list-tests-unittest_.cc diff --git a/googletest/test/gtest-listener_test.cc b/googletest/test/googletest-listener-test.cc index 639529c..639529c 100644 --- a/googletest/test/gtest-listener_test.cc +++ b/googletest/test/googletest-listener-test.cc diff --git a/googletest/test/gtest-message_test.cc b/googletest/test/googletest-message-test.cc index 175238e..175238e 100644 --- a/googletest/test/gtest-message_test.cc +++ b/googletest/test/googletest-message-test.cc diff --git a/googletest/test/gtest-options_test.cc b/googletest/test/googletest-options-test.cc index 10cb1df..e4c0d04 100644 --- a/googletest/test/gtest-options_test.cc +++ b/googletest/test/googletest-options-test.cc @@ -99,7 +99,7 @@ TEST(OutputFileHelpersTest, GetCurrentExecutableName) { const std::string exe_str = GetCurrentExecutableName().string(); #if GTEST_OS_WINDOWS const bool success = - _strcmpi("gtest-options_test", exe_str.c_str()) == 0 || + _strcmpi("googletest-options-test", exe_str.c_str()) == 0 || _strcmpi("gtest-options-ex_test", exe_str.c_str()) == 0 || _strcmpi("gtest_all_test", exe_str.c_str()) == 0 || _strcmpi("gtest_dll_test", exe_str.c_str()) == 0; @@ -109,7 +109,7 @@ TEST(OutputFileHelpersTest, GetCurrentExecutableName) { // TODO(wan@google.com): remove the hard-coded "lt-" prefix when // Chandler Carruth's libtool replacement is ready. const bool success = - exe_str == "gtest-options_test" || + exe_str == "googletest-options-test" || exe_str == "gtest_all_test" || exe_str == "lt-gtest_all_test" || exe_str == "gtest_dll_test"; diff --git a/googletest/test/gtest_output_test_golden_lin.txt b/googletest/test/googletest-output-test-golden-lin.txt index 02a77a8..b0c5189 100644 --- a/googletest/test/gtest_output_test_golden_lin.txt +++ b/googletest/test/googletest-output-test-golden-lin.txt @@ -1,12 +1,12 @@ The non-test part of the code is expected to have 2 failures. -gtest_output_test_.cc:#: Failure +googletest-output-test_.cc:#: Failure Value of: false Actual: false Expected: true Stack trace: (omitted) -gtest_output_test_.cc:#: Failure +googletest-output-test_.cc:#: Failure Expected equality of these values: 2 3 @@ -38,7 +38,7 @@ BarEnvironment::SetUp() called. [0;32m[ OK ] [mPassingTest.PassingTest2 [0;32m[----------] [m2 tests from NonfatalFailureTest [0;32m[ RUN ] [mNonfatalFailureTest.EscapesStringOperands -gtest_output_test_.cc:#: Failure +googletest-output-test_.cc:#: Failure Expected equality of these values: kGoldenString Which is: "\"Line" @@ -46,7 +46,7 @@ Expected equality of these values: Which is: "actual \"string\"" Stack trace: (omitted) -gtest_output_test_.cc:#: Failure +googletest-output-test_.cc:#: Failure Expected equality of these values: golden Which is: "\"Line" @@ -56,7 +56,7 @@ Stack trace: (omitted) [0;31m[ FAILED ] [mNonfatalFailureTest.EscapesStringOperands [0;32m[ RUN ] [mNonfatalFailureTest.DiffForLongStrings -gtest_output_test_.cc:#: Failure +googletest-output-test_.cc:#: Failure Expected equality of these values: golden_str Which is: "\"Line\0 1\"\nLine 2" @@ -72,7 +72,7 @@ Stack trace: (omitted) [0;32m[----------] [m3 tests from FatalFailureTest [0;32m[ RUN ] [mFatalFailureTest.FatalFailureInSubroutine (expecting a failure that x should be 1) -gtest_output_test_.cc:#: Failure +googletest-output-test_.cc:#: Failure Expected equality of these values: 1 x @@ -82,7 +82,7 @@ Stack trace: (omitted) [0;31m[ FAILED ] [mFatalFailureTest.FatalFailureInSubroutine [0;32m[ RUN ] [mFatalFailureTest.FatalFailureInNestedSubroutine (expecting a failure that x should be 1) -gtest_output_test_.cc:#: Failure +googletest-output-test_.cc:#: Failure Expected equality of these values: 1 x @@ -92,7 +92,7 @@ Stack trace: (omitted) [0;31m[ FAILED ] [mFatalFailureTest.FatalFailureInNestedSubroutine [0;32m[ RUN ] [mFatalFailureTest.NonfatalFailureInSubroutine (expecting a failure on false) -gtest_output_test_.cc:#: Failure +googletest-output-test_.cc:#: Failure Value of: false Actual: false Expected: true @@ -104,45 +104,45 @@ Stack trace: (omitted) (expecting 2 failures on (3) >= (a[i])) i == 0 i == 1 -gtest_output_test_.cc:#: Failure +googletest-output-test_.cc:#: Failure Expected: (3) >= (a[i]), actual: 3 vs 9 Stack trace: (omitted) i == 2 i == 3 -gtest_output_test_.cc:#: Failure +googletest-output-test_.cc:#: Failure Expected: (3) >= (a[i]), actual: 3 vs 6 Stack trace: (omitted) [0;31m[ FAILED ] [mLoggingTest.InterleavingLoggingAndAssertions [0;32m[----------] [m7 tests from SCOPED_TRACETest [0;32m[ RUN ] [mSCOPED_TRACETest.AcceptedValues -gtest_output_test_.cc:#: Failure +googletest-output-test_.cc:#: Failure Failed Just checking that all these values work fine. Google Test trace: -gtest_output_test_.cc:#: (null) -gtest_output_test_.cc:#: 1337 -gtest_output_test_.cc:#: std::string -gtest_output_test_.cc:#: literal string +googletest-output-test_.cc:#: (null) +googletest-output-test_.cc:#: 1337 +googletest-output-test_.cc:#: std::string +googletest-output-test_.cc:#: literal string Stack trace: (omitted) [0;31m[ FAILED ] [mSCOPED_TRACETest.AcceptedValues [0;32m[ RUN ] [mSCOPED_TRACETest.ObeysScopes (expected to fail) -gtest_output_test_.cc:#: Failure +googletest-output-test_.cc:#: Failure Failed This failure is expected, and shouldn't have a trace. Stack trace: (omitted) -gtest_output_test_.cc:#: Failure +googletest-output-test_.cc:#: Failure Failed This failure is expected, and should have a trace. Google Test trace: -gtest_output_test_.cc:#: Expected trace +googletest-output-test_.cc:#: Expected trace Stack trace: (omitted) -gtest_output_test_.cc:#: Failure +googletest-output-test_.cc:#: Failure Failed This failure is expected, and shouldn't have a trace. Stack trace: (omitted) @@ -150,131 +150,131 @@ Stack trace: (omitted) [0;31m[ FAILED ] [mSCOPED_TRACETest.ObeysScopes [0;32m[ RUN ] [mSCOPED_TRACETest.WorksInLoop (expected to fail) -gtest_output_test_.cc:#: Failure +googletest-output-test_.cc:#: Failure Expected equality of these values: 2 n Which is: 1 Google Test trace: -gtest_output_test_.cc:#: i = 1 +googletest-output-test_.cc:#: i = 1 Stack trace: (omitted) -gtest_output_test_.cc:#: Failure +googletest-output-test_.cc:#: Failure Expected equality of these values: 1 n Which is: 2 Google Test trace: -gtest_output_test_.cc:#: i = 2 +googletest-output-test_.cc:#: i = 2 Stack trace: (omitted) [0;31m[ FAILED ] [mSCOPED_TRACETest.WorksInLoop [0;32m[ RUN ] [mSCOPED_TRACETest.WorksInSubroutine (expected to fail) -gtest_output_test_.cc:#: Failure +googletest-output-test_.cc:#: Failure Expected equality of these values: 2 n Which is: 1 Google Test trace: -gtest_output_test_.cc:#: n = 1 +googletest-output-test_.cc:#: n = 1 Stack trace: (omitted) -gtest_output_test_.cc:#: Failure +googletest-output-test_.cc:#: Failure Expected equality of these values: 1 n Which is: 2 Google Test trace: -gtest_output_test_.cc:#: n = 2 +googletest-output-test_.cc:#: n = 2 Stack trace: (omitted) [0;31m[ FAILED ] [mSCOPED_TRACETest.WorksInSubroutine [0;32m[ RUN ] [mSCOPED_TRACETest.CanBeNested (expected to fail) -gtest_output_test_.cc:#: Failure +googletest-output-test_.cc:#: Failure Expected equality of these values: 1 n Which is: 2 Google Test trace: -gtest_output_test_.cc:#: n = 2 -gtest_output_test_.cc:#: +googletest-output-test_.cc:#: n = 2 +googletest-output-test_.cc:#: Stack trace: (omitted) [0;31m[ FAILED ] [mSCOPED_TRACETest.CanBeNested [0;32m[ RUN ] [mSCOPED_TRACETest.CanBeRepeated (expected to fail) -gtest_output_test_.cc:#: Failure +googletest-output-test_.cc:#: Failure Failed This failure is expected, and should contain trace point A. Google Test trace: -gtest_output_test_.cc:#: A +googletest-output-test_.cc:#: A Stack trace: (omitted) -gtest_output_test_.cc:#: Failure +googletest-output-test_.cc:#: Failure Failed This failure is expected, and should contain trace point A and B. Google Test trace: -gtest_output_test_.cc:#: B -gtest_output_test_.cc:#: A +googletest-output-test_.cc:#: B +googletest-output-test_.cc:#: A Stack trace: (omitted) -gtest_output_test_.cc:#: Failure +googletest-output-test_.cc:#: Failure Failed This failure is expected, and should contain trace point A, B, and C. Google Test trace: -gtest_output_test_.cc:#: C -gtest_output_test_.cc:#: B -gtest_output_test_.cc:#: A +googletest-output-test_.cc:#: C +googletest-output-test_.cc:#: B +googletest-output-test_.cc:#: A Stack trace: (omitted) -gtest_output_test_.cc:#: Failure +googletest-output-test_.cc:#: Failure Failed This failure is expected, and should contain trace point A, B, and D. Google Test trace: -gtest_output_test_.cc:#: D -gtest_output_test_.cc:#: B -gtest_output_test_.cc:#: A +googletest-output-test_.cc:#: D +googletest-output-test_.cc:#: B +googletest-output-test_.cc:#: A Stack trace: (omitted) [0;31m[ FAILED ] [mSCOPED_TRACETest.CanBeRepeated [0;32m[ RUN ] [mSCOPED_TRACETest.WorksConcurrently (expecting 6 failures) -gtest_output_test_.cc:#: Failure +googletest-output-test_.cc:#: Failure Failed Expected failure #1 (in thread B, only trace B alive). Google Test trace: -gtest_output_test_.cc:#: Trace B +googletest-output-test_.cc:#: Trace B Stack trace: (omitted) -gtest_output_test_.cc:#: Failure +googletest-output-test_.cc:#: Failure Failed Expected failure #2 (in thread A, trace A & B both alive). Google Test trace: -gtest_output_test_.cc:#: Trace A +googletest-output-test_.cc:#: Trace A Stack trace: (omitted) -gtest_output_test_.cc:#: Failure +googletest-output-test_.cc:#: Failure Failed Expected failure #3 (in thread B, trace A & B both alive). Google Test trace: -gtest_output_test_.cc:#: Trace B +googletest-output-test_.cc:#: Trace B Stack trace: (omitted) -gtest_output_test_.cc:#: Failure +googletest-output-test_.cc:#: Failure Failed Expected failure #4 (in thread B, only trace A alive). Stack trace: (omitted) -gtest_output_test_.cc:#: Failure +googletest-output-test_.cc:#: Failure Failed Expected failure #5 (in thread A, only trace A alive). Google Test trace: -gtest_output_test_.cc:#: Trace A +googletest-output-test_.cc:#: Trace A Stack trace: (omitted) -gtest_output_test_.cc:#: Failure +googletest-output-test_.cc:#: Failure Failed Expected failure #6 (in thread A, no trace alive). Stack trace: (omitted) @@ -282,7 +282,7 @@ Stack trace: (omitted) [0;31m[ FAILED ] [mSCOPED_TRACETest.WorksConcurrently [0;32m[----------] [m1 test from ScopedTraceTest [0;32m[ RUN ] [mScopedTraceTest.WithExplicitFileAndLine -gtest_output_test_.cc:#: Failure +googletest-output-test_.cc:#: Failure Failed Check that the trace is attached to a particular location. Google Test trace: @@ -293,27 +293,27 @@ Stack trace: (omitted) [0;32m[----------] [m1 test from NonFatalFailureInFixtureConstructorTest [0;32m[ RUN ] [mNonFatalFailureInFixtureConstructorTest.FailureInConstructor (expecting 5 failures) -gtest_output_test_.cc:#: Failure +googletest-output-test_.cc:#: Failure Failed Expected failure #1, in the test fixture c'tor. Stack trace: (omitted) -gtest_output_test_.cc:#: Failure +googletest-output-test_.cc:#: Failure Failed Expected failure #2, in SetUp(). Stack trace: (omitted) -gtest_output_test_.cc:#: Failure +googletest-output-test_.cc:#: Failure Failed Expected failure #3, in the test body. Stack trace: (omitted) -gtest_output_test_.cc:#: Failure +googletest-output-test_.cc:#: Failure Failed Expected failure #4, in TearDown. Stack trace: (omitted) -gtest_output_test_.cc:#: Failure +googletest-output-test_.cc:#: Failure Failed Expected failure #5, in the test fixture d'tor. Stack trace: (omitted) @@ -322,12 +322,12 @@ Stack trace: (omitted) [0;32m[----------] [m1 test from FatalFailureInFixtureConstructorTest [0;32m[ RUN ] [mFatalFailureInFixtureConstructorTest.FailureInConstructor (expecting 2 failures) -gtest_output_test_.cc:#: Failure +googletest-output-test_.cc:#: Failure Failed Expected failure #1, in the test fixture c'tor. Stack trace: (omitted) -gtest_output_test_.cc:#: Failure +googletest-output-test_.cc:#: Failure Failed Expected failure #2, in the test fixture d'tor. Stack trace: (omitted) @@ -336,22 +336,22 @@ Stack trace: (omitted) [0;32m[----------] [m1 test from NonFatalFailureInSetUpTest [0;32m[ RUN ] [mNonFatalFailureInSetUpTest.FailureInSetUp (expecting 4 failures) -gtest_output_test_.cc:#: Failure +googletest-output-test_.cc:#: Failure Failed Expected failure #1, in SetUp(). Stack trace: (omitted) -gtest_output_test_.cc:#: Failure +googletest-output-test_.cc:#: Failure Failed Expected failure #2, in the test function. Stack trace: (omitted) -gtest_output_test_.cc:#: Failure +googletest-output-test_.cc:#: Failure Failed Expected failure #3, in TearDown(). Stack trace: (omitted) -gtest_output_test_.cc:#: Failure +googletest-output-test_.cc:#: Failure Failed Expected failure #4, in the test fixture d'tor. Stack trace: (omitted) @@ -360,17 +360,17 @@ Stack trace: (omitted) [0;32m[----------] [m1 test from FatalFailureInSetUpTest [0;32m[ RUN ] [mFatalFailureInSetUpTest.FailureInSetUp (expecting 3 failures) -gtest_output_test_.cc:#: Failure +googletest-output-test_.cc:#: Failure Failed Expected failure #1, in SetUp(). Stack trace: (omitted) -gtest_output_test_.cc:#: Failure +googletest-output-test_.cc:#: Failure Failed Expected failure #2, in TearDown(). Stack trace: (omitted) -gtest_output_test_.cc:#: Failure +googletest-output-test_.cc:#: Failure Failed Expected failure #3, in the test fixture d'tor. Stack trace: (omitted) @@ -483,13 +483,13 @@ Stack trace: (omitted) gtest.cc:#: Failure Expected: 1 non-fatal failure Actual: 2 failures -gtest_output_test_.cc:#: Non-fatal failure: +googletest-output-test_.cc:#: Non-fatal failure: Failed Expected non-fatal failure 1. Stack trace: (omitted) -gtest_output_test_.cc:#: Non-fatal failure: +googletest-output-test_.cc:#: Non-fatal failure: Failed Expected non-fatal failure 2. Stack trace: (omitted) @@ -503,7 +503,7 @@ Stack trace: (omitted) gtest.cc:#: Failure Expected: 1 non-fatal failure Actual: -gtest_output_test_.cc:#: Fatal failure: +googletest-output-test_.cc:#: Fatal failure: Failed Expected fatal failure. Stack trace: (omitted) @@ -548,13 +548,13 @@ Stack trace: (omitted) gtest.cc:#: Failure Expected: 1 fatal failure Actual: 2 failures -gtest_output_test_.cc:#: Fatal failure: +googletest-output-test_.cc:#: Fatal failure: Failed Expected fatal failure. Stack trace: (omitted) -gtest_output_test_.cc:#: Fatal failure: +googletest-output-test_.cc:#: Fatal failure: Failed Expected fatal failure. Stack trace: (omitted) @@ -568,7 +568,7 @@ Stack trace: (omitted) gtest.cc:#: Failure Expected: 1 fatal failure Actual: -gtest_output_test_.cc:#: Non-fatal failure: +googletest-output-test_.cc:#: Non-fatal failure: Failed Expected non-fatal failure. Stack trace: (omitted) @@ -597,7 +597,7 @@ Stack trace: (omitted) [0;32m[ RUN ] [mTypedTest/0.Success [0;32m[ OK ] [mTypedTest/0.Success [0;32m[ RUN ] [mTypedTest/0.Failure -gtest_output_test_.cc:#: Failure +googletest-output-test_.cc:#: Failure Expected equality of these values: 1 TypeParam() @@ -610,7 +610,7 @@ Stack trace: (omitted) [0;32m[ RUN ] [mUnsigned/TypedTestP/0.Success [0;32m[ OK ] [mUnsigned/TypedTestP/0.Success [0;32m[ RUN ] [mUnsigned/TypedTestP/0.Failure -gtest_output_test_.cc:#: Failure +googletest-output-test_.cc:#: Failure Expected equality of these values: 1U Which is: 1 @@ -624,7 +624,7 @@ Stack trace: (omitted) [0;32m[ RUN ] [mUnsigned/TypedTestP/1.Success [0;32m[ OK ] [mUnsigned/TypedTestP/1.Success [0;32m[ RUN ] [mUnsigned/TypedTestP/1.Failure -gtest_output_test_.cc:#: Failure +googletest-output-test_.cc:#: Failure Expected equality of these values: 1U Which is: 1 @@ -640,7 +640,7 @@ Stack trace: (omitted) gtest.cc:#: Failure Expected: 1 fatal failure Actual: -gtest_output_test_.cc:#: Success: +googletest-output-test_.cc:#: Success: Succeeded Stack trace: (omitted) @@ -651,7 +651,7 @@ Stack trace: (omitted) gtest.cc:#: Failure Expected: 1 fatal failure Actual: -gtest_output_test_.cc:#: Non-fatal failure: +googletest-output-test_.cc:#: Non-fatal failure: Failed Expected non-fatal failure. Stack trace: (omitted) @@ -663,7 +663,7 @@ Stack trace: (omitted) gtest.cc:#: Failure Expected: 1 fatal failure containing "Some other fatal failure expected." Actual: -gtest_output_test_.cc:#: Fatal failure: +googletest-output-test_.cc:#: Fatal failure: Failed Expected fatal failure. Stack trace: (omitted) @@ -677,7 +677,7 @@ Stack trace: (omitted) gtest.cc:#: Failure Expected: 1 non-fatal failure Actual: -gtest_output_test_.cc:#: Success: +googletest-output-test_.cc:#: Success: Succeeded Stack trace: (omitted) @@ -688,7 +688,7 @@ Stack trace: (omitted) gtest.cc:#: Failure Expected: 1 non-fatal failure Actual: -gtest_output_test_.cc:#: Fatal failure: +googletest-output-test_.cc:#: Fatal failure: Failed Expected fatal failure. Stack trace: (omitted) @@ -700,7 +700,7 @@ Stack trace: (omitted) gtest.cc:#: Failure Expected: 1 non-fatal failure containing "Some other non-fatal failure." Actual: -gtest_output_test_.cc:#: Non-fatal failure: +googletest-output-test_.cc:#: Non-fatal failure: Failed Expected non-fatal failure. Stack trace: (omitted) @@ -714,7 +714,7 @@ Stack trace: (omitted) gtest.cc:#: Failure Expected: 1 fatal failure Actual: -gtest_output_test_.cc:#: Success: +googletest-output-test_.cc:#: Success: Succeeded Stack trace: (omitted) @@ -725,7 +725,7 @@ Stack trace: (omitted) gtest.cc:#: Failure Expected: 1 fatal failure Actual: -gtest_output_test_.cc:#: Non-fatal failure: +googletest-output-test_.cc:#: Non-fatal failure: Failed Expected non-fatal failure. Stack trace: (omitted) @@ -737,7 +737,7 @@ Stack trace: (omitted) gtest.cc:#: Failure Expected: 1 fatal failure containing "Some other fatal failure expected." Actual: -gtest_output_test_.cc:#: Fatal failure: +googletest-output-test_.cc:#: Fatal failure: Failed Expected fatal failure. Stack trace: (omitted) @@ -751,7 +751,7 @@ Stack trace: (omitted) gtest.cc:#: Failure Expected: 1 non-fatal failure Actual: -gtest_output_test_.cc:#: Success: +googletest-output-test_.cc:#: Success: Succeeded Stack trace: (omitted) @@ -762,7 +762,7 @@ Stack trace: (omitted) gtest.cc:#: Failure Expected: 1 non-fatal failure Actual: -gtest_output_test_.cc:#: Fatal failure: +googletest-output-test_.cc:#: Fatal failure: Failed Expected fatal failure. Stack trace: (omitted) @@ -774,7 +774,7 @@ Stack trace: (omitted) gtest.cc:#: Failure Expected: 1 non-fatal failure containing "Some other non-fatal failure." Actual: -gtest_output_test_.cc:#: Non-fatal failure: +googletest-output-test_.cc:#: Non-fatal failure: Failed Expected non-fatal failure. Stack trace: (omitted) @@ -786,7 +786,7 @@ Stack trace: (omitted) [0;32m[----------] [m2 tests from ExpectFailureWithThreadsTest [0;32m[ RUN ] [mExpectFailureWithThreadsTest.ExpectFatalFailure (expecting 2 failures) -gtest_output_test_.cc:#: Failure +googletest-output-test_.cc:#: Failure Failed Expected fatal failure. Stack trace: (omitted) @@ -799,7 +799,7 @@ Stack trace: (omitted) [0;31m[ FAILED ] [mExpectFailureWithThreadsTest.ExpectFatalFailure [0;32m[ RUN ] [mExpectFailureWithThreadsTest.ExpectNonFatalFailure (expecting 2 failures) -gtest_output_test_.cc:#: Failure +googletest-output-test_.cc:#: Failure Failed Expected non-fatal failure. Stack trace: (omitted) @@ -813,12 +813,12 @@ Stack trace: (omitted) [0;32m[----------] [m1 test from ScopedFakeTestPartResultReporterTest [0;32m[ RUN ] [mScopedFakeTestPartResultReporterTest.InterceptOnlyCurrentThread (expecting 2 failures) -gtest_output_test_.cc:#: Failure +googletest-output-test_.cc:#: Failure Failed Expected fatal failure. Stack trace: (omitted) -gtest_output_test_.cc:#: Failure +googletest-output-test_.cc:#: Failure Failed Expected non-fatal failure. Stack trace: (omitted) @@ -826,7 +826,7 @@ Stack trace: (omitted) [0;31m[ FAILED ] [mScopedFakeTestPartResultReporterTest.InterceptOnlyCurrentThread [0;32m[----------] [m1 test from PrintingFailingParams/FailingParamTest [0;32m[ RUN ] [mPrintingFailingParams/FailingParamTest.Fails/0 -gtest_output_test_.cc:#: Failure +googletest-output-test_.cc:#: Failure Expected equality of these values: 1 GetParam() @@ -838,7 +838,7 @@ Stack trace: (omitted) [0;32m[ RUN ] [mPrintingStrings/ParamTest.Success/a [0;32m[ OK ] [mPrintingStrings/ParamTest.Success/a [0;32m[ RUN ] [mPrintingStrings/ParamTest.Failure/a -gtest_output_test_.cc:#: Failure +googletest-output-test_.cc:#: Failure Expected equality of these values: "b" GetParam() @@ -849,13 +849,13 @@ Stack trace: (omitted) [0;31m[ FAILED ] [mPrintingStrings/ParamTest.Failure/a, where GetParam() = "a" [0;32m[----------] [mGlobal test environment tear-down BarEnvironment::TearDown() called. -gtest_output_test_.cc:#: Failure +googletest-output-test_.cc:#: Failure Failed Expected non-fatal failure. Stack trace: (omitted) FooEnvironment::TearDown() called. -gtest_output_test_.cc:#: Failure +googletest-output-test_.cc:#: Failure Failed Expected fatal failure. Stack trace: (omitted) @@ -919,7 +919,7 @@ Stack trace: (omitted) [----------] 3 tests from FatalFailureTest [ RUN ] FatalFailureTest.FatalFailureInSubroutine (expecting a failure that x should be 1) -gtest_output_test_.cc:#: Failure +googletest-output-test_.cc:#: Failure Expected equality of these values: 1 x @@ -929,7 +929,7 @@ Stack trace: (omitted) [ FAILED ] FatalFailureTest.FatalFailureInSubroutine (? ms) [ RUN ] FatalFailureTest.FatalFailureInNestedSubroutine (expecting a failure that x should be 1) -gtest_output_test_.cc:#: Failure +googletest-output-test_.cc:#: Failure Expected equality of these values: 1 x @@ -939,7 +939,7 @@ Stack trace: (omitted) [ FAILED ] FatalFailureTest.FatalFailureInNestedSubroutine (? ms) [ RUN ] FatalFailureTest.NonfatalFailureInSubroutine (expecting a failure on false) -gtest_output_test_.cc:#: Failure +googletest-output-test_.cc:#: Failure Value of: false Actual: false Expected: true @@ -953,13 +953,13 @@ Stack trace: (omitted) (expecting 2 failures on (3) >= (a[i])) i == 0 i == 1 -gtest_output_test_.cc:#: Failure +googletest-output-test_.cc:#: Failure Expected: (3) >= (a[i]), actual: 3 vs 9 Stack trace: (omitted) i == 2 i == 3 -gtest_output_test_.cc:#: Failure +googletest-output-test_.cc:#: Failure Expected: (3) >= (a[i]), actual: 3 vs 6 Stack trace: (omitted) diff --git a/googletest/test/gtest_output_test.py b/googletest/test/googletest-output-test.py index 63763b9..c1c3652 100755 --- a/googletest/test/gtest_output_test.py +++ b/googletest/test/googletest-output-test.py @@ -33,10 +33,10 @@ SYNOPSIS - gtest_output_test.py --build_dir=BUILD/DIR --gengolden - # where BUILD/DIR contains the built gtest_output_test_ file. - gtest_output_test.py --gengolden - gtest_output_test.py + googletest_output_test.py --build_dir=BUILD/DIR --gengolden + # where BUILD/DIR contains the built googletest-output-test_ file. + googletest_output_test.py --gengolden + googletest_output_test.py """ __author__ = 'wan@google.com (Zhanyong Wan)' @@ -59,9 +59,9 @@ IS_LINUX = os.name == 'posix' and os.uname()[0] == 'Linux' IS_WINDOWS = os.name == 'nt' # TODO(vladl@google.com): remove the _lin suffix. -GOLDEN_NAME = 'gtest_output_test_golden_lin.txt' +GOLDEN_NAME = 'googletest-output-test-golden-lin.txt' -PROGRAM_PATH = gtest_test_utils.GetTestExecutablePath('gtest_output_test_') +PROGRAM_PATH = gtest_test_utils.GetTestExecutablePath('googletest-output-test_') # At least one command we exercise must not have the # 'internal_skip_environment_and_ad_hoc_tests' argument. @@ -104,7 +104,7 @@ def RemoveLocations(test_output): 'FILE_NAME:#: '. """ - return re.sub(r'.*[/\\]((gtest_output_test_|gtest).cc)(\:\d+|\(\d+\))\: ', + return re.sub(r'.*[/\\]((googletest-output-test_|gtest).cc)(\:\d+|\(\d+\))\: ', r'\1:#: ', test_output) @@ -195,7 +195,7 @@ def RemoveMatchingTests(test_output, pattern): def NormalizeOutput(output): - """Normalizes output (the output of gtest_output_test_.exe).""" + """Normalizes output (the output of googletest-output-test_.exe).""" output = ToUnixLineEnding(output) output = RemoveLocations(output) @@ -316,11 +316,11 @@ class GTestOutputTest(gtest_test_utils.TestCase): if os.getenv('DEBUG_GTEST_OUTPUT_TEST'): open(os.path.join( gtest_test_utils.GetSourceDir(), - '_gtest_output_test_normalized_actual.txt'), 'wb').write( + '_googletest-output-test_normalized_actual.txt'), 'wb').write( normalized_actual) open(os.path.join( gtest_test_utils.GetSourceDir(), - '_gtest_output_test_normalized_golden.txt'), 'wb').write( + '_googletest-output-test_normalized_golden.txt'), 'wb').write( normalized_golden) self.assertEqual(normalized_golden, normalized_actual) diff --git a/googletest/test/gtest_output_test_.cc b/googletest/test/googletest-output-test_.cc index 9ae9dc6..29fc993 100644 --- a/googletest/test/gtest_output_test_.cc +++ b/googletest/test/googletest-output-test_.cc @@ -29,7 +29,7 @@ // // The purpose of this file is to generate Google Test output under // various conditions. The output will then be verified by -// gtest_output_test.py to ensure that Google Test generates the +// googletest-output-test.py to ensure that Google Test generates the // desired messages. Therefore, most tests in this file are MEANT TO // FAIL. // diff --git a/googletest/test/googletest-param-test-invalid-name1-test.py b/googletest/test/googletest-param-test-invalid-name1-test.py new file mode 100644 index 0000000..63be043 --- /dev/null +++ b/googletest/test/googletest-param-test-invalid-name1-test.py @@ -0,0 +1,72 @@ +#!/usr/bin/env python +# +# Copyright 2015 Google Inc. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +"""Verifies that Google Test warns the user when not initialized properly.""" + +__author__ = 'jmadill@google.com (Jamie Madill)' + +import os + +IS_LINUX = os.name == 'posix' and os.uname()[0] == 'Linux' + +if IS_LINUX: + import gtest_test_utils +else: + import gtest_test_utils + +binary_name = 'googletest-param-test-invalid-name1-test_' +COMMAND = gtest_test_utils.GetTestExecutablePath(binary_name) + + +def Assert(condition): + if not condition: + raise AssertionError + + +def TestExitCodeAndOutput(command): + """Runs the given command and verifies its exit code and output.""" + + err = ('Parameterized test name \'"InvalidWithQuotes"\' is invalid') + + p = gtest_test_utils.Subprocess(command) + Assert(p.terminated_by_signal) + + # Verify the output message contains appropriate output + Assert(err in p.output) + + +class GTestParamTestInvalidName1Test(gtest_test_utils.TestCase): + + def testExitCodeAndOutput(self): + TestExitCodeAndOutput(COMMAND) + + +if __name__ == '__main__': + gtest_test_utils.Main() diff --git a/googletest/test/googletest-param-test-invalid-name1-test_.cc b/googletest/test/googletest-param-test-invalid-name1-test_.cc new file mode 100644 index 0000000..68dd470 --- /dev/null +++ b/googletest/test/googletest-param-test-invalid-name1-test_.cc @@ -0,0 +1,51 @@ +// Copyright 2015, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Author: jmadill@google.com (Jamie Madill) + +#include "gtest/gtest.h" + +namespace { +class DummyTest : public ::testing::TestWithParam<const char *> {}; + +TEST_P(DummyTest, Dummy) { +} + +INSTANTIATE_TEST_CASE_P(InvalidTestName, + DummyTest, + ::testing::Values("InvalidWithQuotes"), + ::testing::PrintToStringParamName()); + +} // namespace + +int main(int argc, char *argv[]) { + testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} + diff --git a/googletest/test/googletest-param-test-invalid-name2-test.py b/googletest/test/googletest-param-test-invalid-name2-test.py new file mode 100644 index 0000000..b1a80c1 --- /dev/null +++ b/googletest/test/googletest-param-test-invalid-name2-test.py @@ -0,0 +1,71 @@ +#!/usr/bin/env python +# +# Copyright 2015 Google Inc. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +"""Verifies that Google Test warns the user when not initialized properly.""" + +__author__ = 'jmadill@google.com (Jamie Madill)' + +import os + +IS_LINUX = os.name == 'posix' and os.uname()[0] == 'Linux' + +if IS_LINUX: + import gtest_test_utils +else: + import gtest_test_utils + +binary_name = 'googletest-param-test-invalid-name2-test_' +COMMAND = gtest_test_utils.GetTestExecutablePath(binary_name) + + +def Assert(condition): + if not condition: + raise AssertionError + + +def TestExitCodeAndOutput(command): + """Runs the given command and verifies its exit code and output.""" + + err = ('Duplicate parameterized test name \'a\'') + + p = gtest_test_utils.Subprocess(command) + Assert(p.terminated_by_signal) + + # Check for appropriate output + Assert(err in p.output) + + +class GTestParamTestInvalidName2Test(gtest_test_utils.TestCase): + + def testExitCodeAndOutput(self): + TestExitCodeAndOutput(COMMAND) + +if __name__ == '__main__': + gtest_test_utils.Main() diff --git a/googletest/test/googletest-param-test-invalid-name2-test_.cc b/googletest/test/googletest-param-test-invalid-name2-test_.cc new file mode 100644 index 0000000..9a8ec4e --- /dev/null +++ b/googletest/test/googletest-param-test-invalid-name2-test_.cc @@ -0,0 +1,56 @@ +// Copyright 2015, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Author: jmadill@google.com (Jamie Madill) + +#include "gtest/gtest.h" + +namespace { +class DummyTest : public ::testing::TestWithParam<const char *> {}; + +std::string StringParamTestSuffix( + const testing::TestParamInfo<const char*>& info) { + return std::string(info.param); +} + +TEST_P(DummyTest, Dummy) { +} + +INSTANTIATE_TEST_CASE_P(DuplicateTestNames, + DummyTest, + ::testing::Values("a", "b", "a", "c"), + StringParamTestSuffix); +} // namespace + +int main(int argc, char *argv[]) { + testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} + + diff --git a/googletest/test/gtest-param-test_test.cc b/googletest/test/googletest-param-test-test.cc index adc4d1b..893b132 100644 --- a/googletest/test/gtest-param-test_test.cc +++ b/googletest/test/googletest-param-test-test.cc @@ -43,7 +43,7 @@ # include <vector> # include "src/gtest-internal-inl.h" // for UnitTestOptions -# include "test/gtest-param-test_test.h" +# include "test/googletest-param-test-test.h" using ::std::vector; using ::std::sort; diff --git a/googletest/test/gtest-param-test_test.h b/googletest/test/googletest-param-test-test.h index ea1e884..ea1e884 100644 --- a/googletest/test/gtest-param-test_test.h +++ b/googletest/test/googletest-param-test-test.h diff --git a/googletest/test/gtest-param-test2_test.cc b/googletest/test/googletest-param-test2-test.cc index c3b2d18..c0a908b 100644 --- a/googletest/test/gtest-param-test2_test.cc +++ b/googletest/test/googletest-param-test2-test.cc @@ -33,18 +33,18 @@ // Google Test work. #include "gtest/gtest.h" -#include "gtest-param-test_test.h" +#include "googletest-param-test-test.h" using ::testing::Values; using ::testing::internal::ParamGenerator; // Tests that generators defined in a different translation unit // are functional. The test using extern_gen is defined -// in gtest-param-test_test.cc. +// in googletest-param-test-test.cc. ParamGenerator<int> extern_gen = Values(33); // Tests that a parameterized test case can be defined in one translation unit -// and instantiated in another. The test is defined in gtest-param-test_test.cc +// and instantiated in another. The test is defined in googletest-param-test-test.cc // and ExternalInstantiationTest fixture class is defined in // gtest-param-test_test.h. INSTANTIATE_TEST_CASE_P(MultiplesOf33, @@ -53,7 +53,7 @@ INSTANTIATE_TEST_CASE_P(MultiplesOf33, // Tests that a parameterized test case can be instantiated // in multiple translation units. Another instantiation is defined -// in gtest-param-test_test.cc and InstantiationInMultipleTranslaionUnitsTest +// in googletest-param-test-test.cc and InstantiationInMultipleTranslaionUnitsTest // fixture is defined in gtest-param-test_test.h INSTANTIATE_TEST_CASE_P(Sequence2, InstantiationInMultipleTranslaionUnitsTest, diff --git a/googletest/test/gtest-port_test.cc b/googletest/test/googletest-port-test.cc index 3801e5e..15a629f 100644 --- a/googletest/test/gtest-port_test.cc +++ b/googletest/test/googletest-port-test.cc @@ -346,11 +346,11 @@ TEST(GtestCheckDeathTest, DiesWithCorrectOutputOnFailure) { const bool a_false_condition = false; const char regex[] = #ifdef _MSC_VER - "gtest-port_test\\.cc\\(\\d+\\):" + "googletest-port-test\\.cc\\(\\d+\\):" #elif GTEST_USES_POSIX_RE - "gtest-port_test\\.cc:[0-9]+" + "googletest-port-test\\.cc:[0-9]+" #else - "gtest-port_test\\.cc:\\d+" + "googletest-port-test\\.cc:\\d+" #endif // _MSC_VER ".*a_false_condition.*Extra info.*"; diff --git a/googletest/test/gtest-printers_test.cc b/googletest/test/googletest-printers-test.cc index 49b3bd4..49b3bd4 100644 --- a/googletest/test/gtest-printers_test.cc +++ b/googletest/test/googletest-printers-test.cc diff --git a/googletest/test/gtest_shuffle_test.py b/googletest/test/googletest-shuffle-test.py index 30d0303..5ae9655 100755 --- a/googletest/test/gtest_shuffle_test.py +++ b/googletest/test/googletest-shuffle-test.py @@ -35,8 +35,8 @@ __author__ = 'wan@google.com (Zhanyong Wan)' import os import gtest_test_utils -# Command to run the gtest_shuffle_test_ program. -COMMAND = gtest_test_utils.GetTestExecutablePath('gtest_shuffle_test_') +# Command to run the googletest-shuffle-test_ program. +COMMAND = gtest_test_utils.GetTestExecutablePath('googletest-shuffle-test_') # The environment variables for test sharding. TOTAL_SHARDS_ENV_VAR = 'GTEST_TOTAL_SHARDS' @@ -89,7 +89,7 @@ def GetTestsForAllIterations(extra_env, args): Args: extra_env: a map from environment variables to their values - args: command line flags to pass to gtest_shuffle_test_ + args: command line flags to pass to googletest-shuffle-test_ Returns: A list where the i-th element is the list of tests run in the i-th diff --git a/googletest/test/gtest_shuffle_test_.cc b/googletest/test/googletest-shuffle-test_.cc index 6fb441b..6fb441b 100644 --- a/googletest/test/gtest_shuffle_test_.cc +++ b/googletest/test/googletest-shuffle-test_.cc diff --git a/googletest/test/gtest-test-part_test.cc b/googletest/test/googletest-test-part-test.cc index ca8ba93..ca8ba93 100644 --- a/googletest/test/gtest-test-part_test.cc +++ b/googletest/test/googletest-test-part-test.cc diff --git a/googletest/test/googletest-test2_test.cc b/googletest/test/googletest-test2_test.cc new file mode 100644 index 0000000..e50c259 --- /dev/null +++ b/googletest/test/googletest-test2_test.cc @@ -0,0 +1,61 @@ +// Copyright 2008, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Author: vladl@google.com (Vlad Losev) +// +// Tests for Google Test itself. This verifies that the basic constructs of +// Google Test work. + +#include "gtest/gtest.h" +#include "googletest-param-test-test.h" + +using ::testing::Values; +using ::testing::internal::ParamGenerator; + +// Tests that generators defined in a different translation unit +// are functional. The test using extern_gen_2 is defined +// in googletest-param-test-test.cc. +ParamGenerator<int> extern_gen_2 = Values(33); + +// Tests that a parameterized test case can be defined in one translation unit +// and instantiated in another. The test is defined in googletest-param-test-test.cc +// and ExternalInstantiationTest fixture class is defined in +// gtest-param-test_test.h. +INSTANTIATE_TEST_CASE_P(MultiplesOf33, + ExternalInstantiationTest, + Values(33, 66)); + +// Tests that a parameterized test case can be instantiated +// in multiple translation units. Another instantiation is defined +// in googletest-param-test-test.cc and InstantiationInMultipleTranslaionUnitsTest +// fixture is defined in gtest-param-test_test.h +INSTANTIATE_TEST_CASE_P(Sequence2, + InstantiationInMultipleTranslaionUnitsTest, + Values(42*3, 42*4, 42*5)); + diff --git a/googletest/test/gtest_throw_on_failure_test.py b/googletest/test/googletest-throw-on-failure-test.py index 5678ffe..26ba32b 100755 --- a/googletest/test/gtest_throw_on_failure_test.py +++ b/googletest/test/googletest-throw-on-failure-test.py @@ -31,7 +31,7 @@ """Tests Google Test's throw-on-failure mode with exceptions disabled. -This script invokes gtest_throw_on_failure_test_ (a program written with +This script invokes googletest-throw-on-failure-test_ (a program written with Google Test) with different environments and command line flags. """ @@ -46,10 +46,10 @@ import gtest_test_utils # The command line flag for enabling/disabling the throw-on-failure mode. THROW_ON_FAILURE = 'gtest_throw_on_failure' -# Path to the gtest_throw_on_failure_test_ program, compiled with +# Path to the googletest-throw-on-failure-test_ program, compiled with # exceptions disabled. EXE_PATH = gtest_test_utils.GetTestExecutablePath( - 'gtest_throw_on_failure_test_') + 'googletest-throw-on-failure-test_') # Utilities. @@ -76,12 +76,12 @@ def Run(command): # The tests. TODO(wan@google.com): refactor the class to share common -# logic with code in gtest_break_on_failure_unittest.py. +# logic with code in googletest-break-on-failure-unittest.py. class ThrowOnFailureTest(gtest_test_utils.TestCase): """Tests the throw-on-failure mode.""" def RunAndVerify(self, env_var_value, flag_value, should_fail): - """Runs gtest_throw_on_failure_test_ and verifies that it does + """Runs googletest-throw-on-failure-test_ and verifies that it does (or does not) exit with a non-zero code. Args: diff --git a/googletest/test/gtest_throw_on_failure_test_.cc b/googletest/test/googletest-throw-on-failure-test_.cc index 2b88fe3..0617c27 100644 --- a/googletest/test/gtest_throw_on_failure_test_.cc +++ b/googletest/test/googletest-throw-on-failure-test_.cc @@ -32,7 +32,7 @@ // Tests Google Test's throw-on-failure mode with exceptions disabled. // // This program must be compiled with exceptions disabled. It will be -// invoked by gtest_throw_on_failure_test.py, and is expected to exit +// invoked by googletest-throw-on-failure-test.py, and is expected to exit // with non-zero in the throw-on-failure mode or 0 otherwise. #include "gtest/gtest.h" diff --git a/googletest/test/gtest-tuple_test.cc b/googletest/test/googletest-tuple-test.cc index bfaa3e0..bfaa3e0 100644 --- a/googletest/test/gtest-tuple_test.cc +++ b/googletest/test/googletest-tuple-test.cc diff --git a/googletest/test/gtest_uninitialized_test.py b/googletest/test/googletest-uninitialized-test.py index ae91f2a..e3df5fa 100755 --- a/googletest/test/gtest_uninitialized_test.py +++ b/googletest/test/googletest-uninitialized-test.py @@ -35,7 +35,7 @@ __author__ = 'wan@google.com (Zhanyong Wan)' import gtest_test_utils -COMMAND = gtest_test_utils.GetTestExecutablePath('gtest_uninitialized_test_') +COMMAND = gtest_test_utils.GetTestExecutablePath('googletest-uninitialized-test_') def Assert(condition): diff --git a/googletest/test/gtest_uninitialized_test_.cc b/googletest/test/googletest-uninitialized-test_.cc index 2ba0e8b..2ba0e8b 100644 --- a/googletest/test/gtest_uninitialized_test_.cc +++ b/googletest/test/googletest-uninitialized-test_.cc diff --git a/googletest/test/gtest_all_test.cc b/googletest/test/gtest_all_test.cc index e6c1b01..656066d 100644 --- a/googletest/test/gtest_all_test.cc +++ b/googletest/test/gtest_all_test.cc @@ -33,14 +33,14 @@ // // Sometimes it's desirable to build most of Google Test's own tests // by compiling a single file. This file serves this purpose. -#include "gtest-filepath_test.cc" -#include "gtest-linked_ptr_test.cc" -#include "gtest-message_test.cc" -#include "gtest-options_test.cc" -#include "gtest-port_test.cc" +#include "googletest-filepath-test.cc" +#include "googletest-linked-ptr-test.cc" +#include "googletest-message-test.cc" +#include "googletest-options-test.cc" +#include "googletest-port-test.cc" #include "gtest_pred_impl_unittest.cc" #include "gtest_prod_test.cc" -#include "gtest-test-part_test.cc" +#include "googletest-test-part-test.cc" #include "gtest-typed-test_test.cc" #include "gtest-typed-test2_test.cc" #include "gtest_unittest.cc" diff --git a/googletest/test/gtest_test_macro_stack_footprint_test.cc b/googletest/test/gtest_test_macro_stack_footprint_test.cc new file mode 100644 index 0000000..48958b8 --- /dev/null +++ b/googletest/test/gtest_test_macro_stack_footprint_test.cc @@ -0,0 +1,90 @@ +// Copyright 2013, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Author: wan@google.com (Zhanyong Wan) +// +// Each TEST() expands to some static registration logic. GCC puts all +// such static initialization logic for a translation unit in a common, +// internal function. Since Google's build system restricts how much +// stack space a function can use, there's a limit on how many TEST()s +// one can put in a single C++ test file. This test ensures that a large +// number of TEST()s can be defined in the same translation unit. + +#include "gtest/gtest.h" + +// This macro defines 10 dummy tests. +#define TEN_TESTS_(test_case_name) \ + TEST(test_case_name, T0) {} \ + TEST(test_case_name, T1) {} \ + TEST(test_case_name, T2) {} \ + TEST(test_case_name, T3) {} \ + TEST(test_case_name, T4) {} \ + TEST(test_case_name, T5) {} \ + TEST(test_case_name, T6) {} \ + TEST(test_case_name, T7) {} \ + TEST(test_case_name, T8) {} \ + TEST(test_case_name, T9) {} + +// This macro defines 100 dummy tests. +#define HUNDRED_TESTS_(test_case_name_prefix) \ + TEN_TESTS_(test_case_name_prefix ## 0) \ + TEN_TESTS_(test_case_name_prefix ## 1) \ + TEN_TESTS_(test_case_name_prefix ## 2) \ + TEN_TESTS_(test_case_name_prefix ## 3) \ + TEN_TESTS_(test_case_name_prefix ## 4) \ + TEN_TESTS_(test_case_name_prefix ## 5) \ + TEN_TESTS_(test_case_name_prefix ## 6) \ + TEN_TESTS_(test_case_name_prefix ## 7) \ + TEN_TESTS_(test_case_name_prefix ## 8) \ + TEN_TESTS_(test_case_name_prefix ## 9) + +// This macro defines 1000 dummy tests. +#define THOUSAND_TESTS_(test_case_name_prefix) \ + HUNDRED_TESTS_(test_case_name_prefix ## 0) \ + HUNDRED_TESTS_(test_case_name_prefix ## 1) \ + HUNDRED_TESTS_(test_case_name_prefix ## 2) \ + HUNDRED_TESTS_(test_case_name_prefix ## 3) \ + HUNDRED_TESTS_(test_case_name_prefix ## 4) \ + HUNDRED_TESTS_(test_case_name_prefix ## 5) \ + HUNDRED_TESTS_(test_case_name_prefix ## 6) \ + HUNDRED_TESTS_(test_case_name_prefix ## 7) \ + HUNDRED_TESTS_(test_case_name_prefix ## 8) \ + HUNDRED_TESTS_(test_case_name_prefix ## 9) + +// Ensures that we can define 1000 TEST()s in the same translation +// unit. +THOUSAND_TESTS_(T) + +int main(int argc, char **argv) { + testing::InitGoogleTest(&argc, argv); + + // We don't actually need to run the dummy tests - the purpose is to + // ensure that they compile. + return 0; +} diff --git a/googletest/test/gtest_unittest.cc b/googletest/test/gtest_unittest.cc index c5987ae..033bc3a 100644 --- a/googletest/test/gtest_unittest.cc +++ b/googletest/test/gtest_unittest.cc @@ -4689,7 +4689,7 @@ TEST(MacroTest, ADD_FAILURE_AT) { // Unfortunately, we cannot verify that the failure message contains // the right file path and line number the same way, as // EXPECT_NONFATAL_FAILURE() doesn't get to see the file path and - // line number. Instead, we do that in gtest_output_test_.cc. + // line number. Instead, we do that in googletest-output-test_.cc. } // Tests FAIL. |