From 19b5774ccf6c20d7a8d076de9e791629e72ffc0d Mon Sep 17 00:00:00 2001 From: Gennadiy Civil Date: Thu, 4 Jan 2018 21:49:27 -0500 Subject: [PATCH 1/2] code cleanup in preparation for merges, cl 180857299 --- googletest/test/gtest-death-test_test.cc | 4 ++-- googletest/test/gtest-filepath_test.cc | 6 ++---- googletest/test/gtest-options_test.cc | 1 - googletest/test/gtest-param-test2_test.cc | 1 + googletest/test/gtest-port_test.cc | 4 ++-- googletest/test/gtest_break_on_failure_unittest_.cc | 3 +-- googletest/test/gtest_output_test_.cc | 10 ++++++++++ googletest/test/gtest_repeat_test.cc | 1 + googletest/test/gtest_stress_test.cc | 1 - googletest/test/gtest_xml_outfile1_test_.cc | 1 - googletest/test/gtest_xml_outfile2_test_.cc | 1 - googletest/test/gtest_xml_output_unittest_.cc | 2 -- 12 files changed, 19 insertions(+), 16 deletions(-) diff --git a/googletest/test/gtest-death-test_test.cc b/googletest/test/gtest-death-test_test.cc index 0e1e87b7..b7846b2c 100644 --- a/googletest/test/gtest-death-test_test.cc +++ b/googletest/test/gtest-death-test_test.cc @@ -305,14 +305,14 @@ void DieWithEmbeddedNul() { } # if GTEST_USES_PCRE + // Tests that EXPECT_DEATH and ASSERT_DEATH work when the error // message has a NUL character in it. TEST_F(TestForDeathTest, EmbeddedNulInMessage) { - // TODO(wan@google.com): doesn't support matching strings - // with embedded NUL characters - find a way to workaround it. EXPECT_DEATH(DieWithEmbeddedNul(), "my null world"); ASSERT_DEATH(DieWithEmbeddedNul(), "my null world"); } + # endif // GTEST_USES_PCRE // Tests that death test macros expand to code which interacts well with switch diff --git a/googletest/test/gtest-filepath_test.cc b/googletest/test/gtest-filepath_test.cc index cc4883bc..29cea3d1 100644 --- a/googletest/test/gtest-filepath_test.cc +++ b/googletest/test/gtest-filepath_test.cc @@ -27,16 +27,14 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // -// Authors: keith.ray@gmail.com (Keith Ray) // // Google Test filepath utilities // // This file tests classes and functions used internally by // Google Test. They are subject to change without notice. // -// This file is #included from gtest_unittest.cc, to avoid changing -// build or make-files for some existing Google Test clients. Do not -// #include this file anywhere else! +// This file is #included from gtest-internal.h. +// Do not #include this file anywhere else! #include "gtest/internal/gtest-filepath.h" #include "gtest/gtest.h" diff --git a/googletest/test/gtest-options_test.cc b/googletest/test/gtest-options_test.cc index 70f3ce94..25c9f394 100644 --- a/googletest/test/gtest-options_test.cc +++ b/googletest/test/gtest-options_test.cc @@ -27,7 +27,6 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // -// Authors: keith.ray@gmail.com (Keith Ray) // // Google Test UnitTestOptions tests // diff --git a/googletest/test/gtest-param-test2_test.cc b/googletest/test/gtest-param-test2_test.cc index e7afdc32..0c09b27e 100644 --- a/googletest/test/gtest-param-test2_test.cc +++ b/googletest/test/gtest-param-test2_test.cc @@ -59,3 +59,4 @@ INSTANTIATE_TEST_CASE_P(MultiplesOf33, INSTANTIATE_TEST_CASE_P(Sequence2, InstantiationInMultipleTranslaionUnitsTest, Values(42*3, 42*4, 42*5)); + diff --git a/googletest/test/gtest-port_test.cc b/googletest/test/gtest-port_test.cc index 2c59edc3..4ed4afca 100644 --- a/googletest/test/gtest-port_test.cc +++ b/googletest/test/gtest-port_test.cc @@ -67,8 +67,8 @@ TEST(IsXDigitTest, WorksForNarrowAscii) { } TEST(IsXDigitTest, ReturnsFalseForNarrowNonAscii) { - EXPECT_FALSE(IsXDigit('\x80')); - EXPECT_FALSE(IsXDigit(static_cast('0' | '\x80'))); + EXPECT_FALSE(IsXDigit(static_cast(0x80))); + EXPECT_FALSE(IsXDigit(static_cast('0' | 0x80))); } TEST(IsXDigitTest, WorksForWideAscii) { diff --git a/googletest/test/gtest_break_on_failure_unittest_.cc b/googletest/test/gtest_break_on_failure_unittest_.cc index dd07478c..1231ec28 100644 --- a/googletest/test/gtest_break_on_failure_unittest_.cc +++ b/googletest/test/gtest_break_on_failure_unittest_.cc @@ -80,8 +80,7 @@ int main(int argc, char **argv) { SetUnhandledExceptionFilter(ExitWithExceptionCode); # endif -#endif - +#endif // GTEST_OS_WINDOWS testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); diff --git a/googletest/test/gtest_output_test_.cc b/googletest/test/gtest_output_test_.cc index 6aaba977..c7ccc21c 100644 --- a/googletest/test/gtest_output_test_.cc +++ b/googletest/test/gtest_output_test_.cc @@ -168,6 +168,16 @@ void SubWithTrace(int n) { SubWithoutTrace(n); } +TEST(SCOPED_TRACETest, AcceptedValues) { + SCOPED_TRACE("literal string"); + SCOPED_TRACE(std::string("std::string")); + SCOPED_TRACE(1337); // streamable type + const char* null_value = NULL; + SCOPED_TRACE(null_value); + + ADD_FAILURE() << "Just checking that all these values work fine."; +} + // Tests that SCOPED_TRACE() obeys lexical scopes. TEST(SCOPED_TRACETest, ObeysScopes) { printf("(expected to fail)\n"); diff --git a/googletest/test/gtest_repeat_test.cc b/googletest/test/gtest_repeat_test.cc index dcaadd72..b9e65e4c 100644 --- a/googletest/test/gtest_repeat_test.cc +++ b/googletest/test/gtest_repeat_test.cc @@ -210,6 +210,7 @@ void TestRepeatWithFilterForFailedTests(int repeat) { int main(int argc, char **argv) { testing::InitGoogleTest(&argc, argv); + testing::AddGlobalTestEnvironment(new MyEnvironment); TestRepeatUnspecified(); diff --git a/googletest/test/gtest_stress_test.cc b/googletest/test/gtest_stress_test.cc index 59a1b623..cac405f8 100644 --- a/googletest/test/gtest_stress_test.cc +++ b/googletest/test/gtest_stress_test.cc @@ -34,7 +34,6 @@ #include "gtest/gtest.h" -#include #include #include "src/gtest-internal-inl.h" diff --git a/googletest/test/gtest_xml_outfile1_test_.cc b/googletest/test/gtest_xml_outfile1_test_.cc index 531ced49..e3d1dd1e 100644 --- a/googletest/test/gtest_xml_outfile1_test_.cc +++ b/googletest/test/gtest_xml_outfile1_test_.cc @@ -27,7 +27,6 @@ // (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: keith.ray@gmail.com (Keith Ray) // // gtest_xml_outfile1_test_ writes some xml via TestProperty used by // gtest_xml_outfiles_test.py diff --git a/googletest/test/gtest_xml_outfile2_test_.cc b/googletest/test/gtest_xml_outfile2_test_.cc index 7b400b27..55eb8f39 100644 --- a/googletest/test/gtest_xml_outfile2_test_.cc +++ b/googletest/test/gtest_xml_outfile2_test_.cc @@ -27,7 +27,6 @@ // (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: keith.ray@gmail.com (Keith Ray) // // gtest_xml_outfile2_test_ writes some xml via TestProperty used by // gtest_xml_outfiles_test.py diff --git a/googletest/test/gtest_xml_output_unittest_.cc b/googletest/test/gtest_xml_output_unittest_.cc index 48b8771b..2ee88380 100644 --- a/googletest/test/gtest_xml_output_unittest_.cc +++ b/googletest/test/gtest_xml_output_unittest_.cc @@ -27,8 +27,6 @@ // (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: eefacm@gmail.com (Sean Mcafee) - // Unit test for Google Test XML output. // // A user can specify XML output in a Google Test program to run via From 67476c1426dc520f1ff0eb16e6c00d050d489721 Mon Sep 17 00:00:00 2001 From: Gennadiy Civil Date: Fri, 5 Jan 2018 12:35:41 -0500 Subject: [PATCH 2/2] Revert one file for now --- googletest/test/gtest_output_test_.cc | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/googletest/test/gtest_output_test_.cc b/googletest/test/gtest_output_test_.cc index c7ccc21c..6aaba977 100644 --- a/googletest/test/gtest_output_test_.cc +++ b/googletest/test/gtest_output_test_.cc @@ -168,16 +168,6 @@ void SubWithTrace(int n) { SubWithoutTrace(n); } -TEST(SCOPED_TRACETest, AcceptedValues) { - SCOPED_TRACE("literal string"); - SCOPED_TRACE(std::string("std::string")); - SCOPED_TRACE(1337); // streamable type - const char* null_value = NULL; - SCOPED_TRACE(null_value); - - ADD_FAILURE() << "Just checking that all these values work fine."; -} - // Tests that SCOPED_TRACE() obeys lexical scopes. TEST(SCOPED_TRACETest, ObeysScopes) { printf("(expected to fail)\n");