aboutsummaryrefslogtreecommitdiffstats
path: root/googletest/test
diff options
context:
space:
mode:
authorGennadiy Civil <gennadiycivil@users.noreply.github.com>2018-01-18 17:42:34 -0500
committerGitHub <noreply@github.com>2018-01-18 17:42:34 -0500
commit1489dc8daad3a9eaff89789752c1cadc5f2ece72 (patch)
tree38e051e8e4fd2a7b82b95d01b1b63cfc3e2f0251 /googletest/test
parentea8f6f0e6959c74b1c9ac1f30cbfdc94715d606b (diff)
parent051053054df6d2dbedd5f572ae288f2f82a289b7 (diff)
downloadgoogletest-1489dc8daad3a9eaff89789752c1cadc5f2ece72.tar.gz
googletest-1489dc8daad3a9eaff89789752c1cadc5f2ece72.tar.bz2
googletest-1489dc8daad3a9eaff89789752c1cadc5f2ece72.zip
Merge branch 'master' into support_xboxone
Diffstat (limited to 'googletest/test')
-rw-r--r--googletest/test/BUILD.bazel244
-rwxr-xr-xgoogletest/test/gtest_output_test.py3
-rw-r--r--googletest/test/gtest_output_test_.cc7
-rw-r--r--googletest/test/gtest_output_test_golden_lin.txt17
4 files changed, 265 insertions, 6 deletions
diff --git a/googletest/test/BUILD.bazel b/googletest/test/BUILD.bazel
index 62b88da4..3c700b15 100644
--- a/googletest/test/BUILD.bazel
+++ b/googletest/test/BUILD.bazel
@@ -1,4 +1,4 @@
-# Copyright 2017 Google Inc.
+# Copyright 2017 Google Inc.
# All Rights Reserved.
#
#
@@ -119,3 +119,245 @@ cc_test(
"//:gtest",
],
)
+# Py tests
+
+py_library(
+ name = "gtest_test_utils",
+ testonly = 1,
+ srcs = ["gtest_test_utils.py"],
+
+)
+
+cc_binary(
+ name = "gtest_help_test_",
+ testonly = 1,
+ srcs = ["gtest_help_test_.cc"],
+ deps = ["//:gtest_main"],
+)
+py_test(
+ name = "gtest_help_test",
+ size = "small",
+ srcs = ["gtest_help_test.py"],
+ data = [":gtest_help_test_"],
+ deps = [":gtest_test_utils"],
+)
+
+cc_binary(
+ name = "gtest_output_test_",
+ testonly = 1,
+ srcs = ["gtest_output_test_.cc"],
+ deps = ["//:gtest"],
+)
+
+py_test(
+ name = "gtest_output_test",
+ size = "small",
+ srcs = ["gtest_output_test.py"],
+ data = [
+ "gtest_output_test_golden_lin.txt",
+ ":gtest_output_test_",
+ ],
+ deps = [":gtest_test_utils"],
+)
+
+cc_binary(
+ name = "gtest_color_test_",
+ testonly = 1,
+ srcs = ["gtest_color_test_.cc"],
+ deps = ["//:gtest"],
+)
+py_test(
+ name = "gtest_color_test",
+ size = "small",
+ srcs = ["gtest_color_test.py"],
+ data = [":gtest_color_test_"],
+ deps = [":gtest_test_utils"],
+)
+
+cc_binary(
+ name = "gtest_env_var_test_",
+ testonly = 1,
+ srcs = ["gtest_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_"],
+ deps = [":gtest_test_utils"],
+)
+
+cc_binary(
+ name = "gtest_filter_unittest_",
+ testonly = 1,
+ srcs = ["gtest_filter_unittest_.cc"],
+ deps = ["//:gtest"],
+)
+
+py_test(
+ name = "gtest_filter_unittest",
+ size = "small",
+ srcs = ["gtest_filter_unittest.py"],
+ data = [":gtest_filter_unittest_"],
+ deps = [":gtest_test_utils"],
+)
+
+cc_binary(
+ name = "gtest_break_on_failure_unittest_",
+ testonly = 1,
+ srcs = ["gtest_break_on_failure_unittest_.cc"],
+ deps = ["//:gtest"],
+)
+
+py_test(
+ name = "gtest_break_on_failure_unittest",
+ size = "small",
+ srcs = ["gtest_break_on_failure_unittest.py"],
+ data = [":gtest_break_on_failure_unittest_"],
+ deps = [":gtest_test_utils"],
+)
+
+cc_binary(
+ name = "gtest_throw_on_failure_test_",
+ testonly = 1,
+ srcs = ["gtest_throw_on_failure_test_.cc"],
+ deps = ["//:gtest"],
+)
+
+py_test(
+ name = "gtest_throw_on_failure_test",
+ size = "small",
+ srcs = ["gtest_throw_on_failure_test.py"],
+ data = [":gtest_throw_on_failure_test_"],
+ deps = [":gtest_test_utils"],
+)
+
+cc_binary(
+ name = "gtest_list_tests_unittest_",
+ testonly = 1,
+ srcs = ["gtest_list_tests_unittest_.cc"],
+ deps = ["//:gtest"],
+)
+
+py_test(
+ name = "gtest_list_tests_unittest",
+ size = "small",
+ srcs = ["gtest_list_tests_unittest.py"],
+ data = [":gtest_list_tests_unittest_"],
+ deps = [":gtest_test_utils"],
+)
+
+cc_binary(
+ name = "gtest_shuffle_test_",
+ srcs = ["gtest_shuffle_test_.cc"],
+ deps = ["//:gtest"],
+)
+
+py_test(
+ name = "gtest_shuffle_test",
+ size = "small",
+ srcs = ["gtest_shuffle_test.py"],
+ data = [":gtest_shuffle_test_"],
+ deps = [":gtest_test_utils"],
+)
+
+cc_binary(
+ name = "gtest_catch_exceptions_no_ex_test_",
+ testonly = 1,
+ srcs = ["gtest_catch_exceptions_test_.cc"],
+ deps = ["//:gtest_main"],
+)
+
+cc_binary(
+ name = "gtest_catch_exceptions_ex_test_",
+ testonly = 1,
+ srcs = ["gtest_catch_exceptions_test_.cc"],
+ copts = ["-fexceptions"],
+ deps = ["//:gtest_main"],
+)
+
+py_test(
+ name = "gtest_catch_exceptions_test",
+ size = "small",
+ srcs = ["gtest_catch_exceptions_test.py"],
+ data = [
+ ":gtest_catch_exceptions_ex_test_",
+ ":gtest_catch_exceptions_no_ex_test_",
+ ],
+ deps = [":gtest_test_utils"],
+)
+
+cc_binary(
+ name = "gtest_xml_output_unittest_",
+ testonly = 1,
+ srcs = ["gtest_xml_output_unittest_.cc"],
+ deps = ["//:gtest"],
+)
+
+cc_test(
+ name = "gtest_no_test_unittest",
+ size = "small",
+ srcs = ["gtest_no_test_unittest.cc"],
+ deps = ["//:gtest"],
+)
+
+py_test(
+ name = "gtest_xml_output_unittest",
+ size = "small",
+ srcs = [
+ "gtest_xml_output_unittest.py",
+ "gtest_xml_test_utils.py",
+ ],
+ data = [
+ # We invoke gtest_no_test_unittest to verify the XML output
+ # when the test program contains no test definition.
+ ":gtest_no_test_unittest",
+ ":gtest_xml_output_unittest_",
+ ],
+ deps = [":gtest_test_utils"],
+)
+
+cc_binary(
+ name = "gtest_xml_outfile1_test_",
+ testonly = 1,
+ srcs = ["gtest_xml_outfile1_test_.cc"],
+ deps = ["//:gtest_main"],
+)
+
+cc_binary(
+ name = "gtest_xml_outfile2_test_",
+ testonly = 1,
+ srcs = ["gtest_xml_outfile2_test_.cc"],
+ deps = ["//:gtest_main"],
+)
+
+py_test(
+ name = "gtest_xml_outfiles_test",
+ size = "small",
+ srcs = [
+ "gtest_xml_outfiles_test.py",
+ "gtest_xml_test_utils.py",
+ ],
+ data = [
+ ":gtest_xml_outfile1_test_",
+ ":gtest_xml_outfile2_test_",
+ ],
+ deps = [":gtest_test_utils"],
+)
+
+cc_binary(
+ name = "gtest_uninitialized_test_",
+ testonly = 1,
+ srcs = ["gtest_uninitialized_test_.cc"],
+ deps = ["//:gtest"],
+)
+
+py_test(
+ name = "gtest_uninitialized_test",
+ size = "medium",
+ srcs = ["gtest_uninitialized_test.py"],
+ data = [":gtest_uninitialized_test_"],
+ deps = [":gtest_test_utils"],
+)
diff --git a/googletest/test/gtest_output_test.py b/googletest/test/gtest_output_test.py
index 06dbee09..78a00156 100755
--- a/googletest/test/gtest_output_test.py
+++ b/googletest/test/gtest_output_test.py
@@ -99,7 +99,8 @@ def RemoveLocations(test_output):
'FILE_NAME:#: '.
"""
- return re.sub(r'.*[/\\](.+)(\:\d+|\(\d+\))\: ', r'\1:#: ', test_output)
+ return re.sub(r'.*[/\\]((gtest_output_test_|gtest).cc)(\:\d+|\(\d+\))\: ',
+ r'\1:#: ', test_output)
def RemoveStackTraceDetails(output):
diff --git a/googletest/test/gtest_output_test_.cc b/googletest/test/gtest_output_test_.cc
index 6aaba977..04ca5e5e 100644
--- a/googletest/test/gtest_output_test_.cc
+++ b/googletest/test/gtest_output_test_.cc
@@ -315,6 +315,13 @@ TEST(SCOPED_TRACETest, WorksConcurrently) {
}
#endif // GTEST_IS_THREADSAFE
+// Tests basic functionality of the ScopedTrace utility (most of its features
+// are already tested in SCOPED_TRACETest).
+TEST(ScopedTraceTest, WithExplicitFileAndLine) {
+ testing::ScopedTrace trace("explicit_file.cc", 123, "expected trace message");
+ ADD_FAILURE() << "Check that the trace is attached to a particular location.";
+}
+
TEST(DisabledTestsWarningTest,
DISABLED_AlsoRunDisabledTestsFlagSuppressesWarning) {
// This test body is intentionally empty. Its sole purpose is for
diff --git a/googletest/test/gtest_output_test_golden_lin.txt b/googletest/test/gtest_output_test_golden_lin.txt
index 677d9f40..48f55932 100644
--- a/googletest/test/gtest_output_test_golden_lin.txt
+++ b/googletest/test/gtest_output_test_golden_lin.txt
@@ -8,7 +8,7 @@ gtest_output_test_.cc:#: Failure
Expected equality of these values:
2
3
-[==========] Running 66 tests from 29 test cases.
+[==========] Running 67 tests from 30 test cases.
[----------] Global test environment set-up.
FooEnvironment::SetUp() called.
BarEnvironment::SetUp() called.
@@ -212,6 +212,14 @@ gtest_output_test_.cc:#: Failure
Failed
Expected failure #6 (in thread A, no trace alive).
[ FAILED ] SCOPED_TRACETest.WorksConcurrently
+[----------] 1 test from ScopedTraceTest
+[ RUN ] ScopedTraceTest.WithExplicitFileAndLine
+gtest_output_test_.cc:#: Failure
+Failed
+Check that the trace is attached to a particular location.
+Google Test trace:
+explicit_file.cc:123: expected trace message
+[ FAILED ] ScopedTraceTest.WithExplicitFileAndLine
[----------] 1 test from NonFatalFailureInFixtureConstructorTest
[ RUN ] NonFatalFailureInFixtureConstructorTest.FailureInConstructor
(expecting 5 failures)
@@ -636,9 +644,9 @@ FooEnvironment::TearDown() called.
gtest_output_test_.cc:#: Failure
Failed
Expected fatal failure.
-[==========] 66 tests from 29 test cases ran.
+[==========] 67 tests from 30 test cases ran.
[ PASSED ] 22 tests.
-[ FAILED ] 44 tests, listed below:
+[ FAILED ] 45 tests, listed below:
[ FAILED ] NonfatalFailureTest.EscapesStringOperands
[ FAILED ] NonfatalFailureTest.DiffForLongStrings
[ FAILED ] FatalFailureTest.FatalFailureInSubroutine
@@ -651,6 +659,7 @@ Expected fatal failure.
[ FAILED ] SCOPED_TRACETest.CanBeNested
[ FAILED ] SCOPED_TRACETest.CanBeRepeated
[ FAILED ] SCOPED_TRACETest.WorksConcurrently
+[ FAILED ] ScopedTraceTest.WithExplicitFileAndLine
[ FAILED ] NonFatalFailureInFixtureConstructorTest.FailureInConstructor
[ FAILED ] FatalFailureInFixtureConstructorTest.FailureInConstructor
[ FAILED ] NonFatalFailureInSetUpTest.FailureInSetUp
@@ -684,7 +693,7 @@ Expected fatal failure.
[ FAILED ] PrintingFailingParams/FailingParamTest.Fails/0, where GetParam() = 2
[ FAILED ] PrintingStrings/ParamTest.Failure/a, where GetParam() = "a"
-44 FAILED TESTS
+45 FAILED TESTS
 YOU HAVE 1 DISABLED TEST
Note: Google Test filter = FatalFailureTest.*:LoggingTest.*