diff options
| author | Gennadiy Civil <gennadiycivil@users.noreply.github.com> | 2018-09-20 14:30:26 -0400 | 
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-09-20 14:30:26 -0400 | 
| commit | 90943525c5d1fa4362cbc5c4b313dab761c02295 (patch) | |
| tree | ffef3579c23a986ad65dab298550d62e6302cd00 | |
| parent | 149c0d24148da9a339d6c9d03e638a39c59731f6 (diff) | |
| parent | 258def01a68e3a4d080fee6d4502035218e61e38 (diff) | |
| download | googletest-90943525c5d1fa4362cbc5c4b313dab761c02295.tar.gz googletest-90943525c5d1fa4362cbc5c4b313dab761c02295.tar.bz2 googletest-90943525c5d1fa4362cbc5c4b313dab761c02295.zip  | |
Merge branch 'master' into python3-tests
| -rw-r--r-- | googlemock/CMakeLists.txt | 3 | ||||
| -rw-r--r-- | googletest/include/gtest/gtest-printers.h | 9 | ||||
| -rw-r--r-- | googletest/include/gtest/internal/gtest-port-arch.h | 5 | ||||
| -rw-r--r-- | googletest/test/googletest-printers-test.cc | 16 | ||||
| -rw-r--r-- | googletest/test/gtest_unittest.cc | 2 | 
5 files changed, 32 insertions, 3 deletions
diff --git a/googlemock/CMakeLists.txt b/googlemock/CMakeLists.txt index 8a8de1f6..2a913080 100644 --- a/googlemock/CMakeLists.txt +++ b/googlemock/CMakeLists.txt @@ -157,6 +157,9 @@ if (gmock_build_tests)    cxx_test(gmock-generated-matchers_test gmock_main)    cxx_test(gmock-internal-utils_test gmock_main)    cxx_test(gmock-matchers_test gmock_main) +  if (MINGW) +    target_compile_options(gmock-matchers_test PRIVATE "-Wa,-mbig-obj") +  endif()    cxx_test(gmock-more-actions_test gmock_main)    cxx_test(gmock-nice-strict_test gmock_main)    cxx_test(gmock-port_test gmock_main) diff --git a/googletest/include/gtest/gtest-printers.h b/googletest/include/gtest/gtest-printers.h index 51865f84..39c5c463 100644 --- a/googletest/include/gtest/gtest-printers.h +++ b/googletest/include/gtest/gtest-printers.h @@ -100,6 +100,7 @@  #ifndef GTEST_INCLUDE_GTEST_GTEST_PRINTERS_H_  #define GTEST_INCLUDE_GTEST_GTEST_PRINTERS_H_ +#include <functional>  #include <ostream>  // NOLINT  #include <sstream>  #include <string> @@ -639,7 +640,15 @@ inline void PrintTo(absl::string_view sp, ::std::ostream* os) {  #endif  // GTEST_HAS_ABSL  #if GTEST_LANG_CXX11 +  inline void PrintTo(std::nullptr_t, ::std::ostream* os) { *os << "(nullptr)"; } + +template <typename T> +void PrintTo(std::reference_wrapper<T> ref, ::std::ostream* os) { +  // Delegate to wrapped value. +  PrintTo(ref.get(), os); +} +  #endif  // GTEST_LANG_CXX11  #if GTEST_HAS_TR1_TUPLE || GTEST_HAS_STD_TUPLE_ diff --git a/googletest/include/gtest/internal/gtest-port-arch.h b/googletest/include/gtest/internal/gtest-port-arch.h index f83700e0..587ed5e5 100644 --- a/googletest/include/gtest/internal/gtest-port-arch.h +++ b/googletest/include/gtest/internal/gtest-port-arch.h @@ -38,14 +38,15 @@  // Determines the platform on which Google Test is compiled.  #ifdef __CYGWIN__  # define GTEST_OS_CYGWIN 1 +# elif defined(__MINGW__) || defined(__MINGW32__) || defined(__MINGW64__) +#  define GTEST_OS_WINDOWS_MINGW 1 +#  define GTEST_OS_WINDOWS 1  #elif defined __SYMBIAN32__  # define GTEST_OS_SYMBIAN 1  #elif defined _WIN32  # define GTEST_OS_WINDOWS 1  # ifdef _WIN32_WCE  #  define GTEST_OS_WINDOWS_MOBILE 1 -# elif defined(__MINGW__) || defined(__MINGW32__) -#  define GTEST_OS_WINDOWS_MINGW 1  # elif defined(WINAPI_FAMILY)  #  include <winapifamily.h>  #  if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) diff --git a/googletest/test/googletest-printers-test.cc b/googletest/test/googletest-printers-test.cc index ea8369d2..6e26274e 100644 --- a/googletest/test/googletest-printers-test.cc +++ b/googletest/test/googletest-printers-test.cc @@ -1112,9 +1112,25 @@ TEST(PrintStdTupleTest, NestedTuple) {  #endif  // GTEST_LANG_CXX11  #if GTEST_LANG_CXX11 +  TEST(PrintNullptrT, Basic) {    EXPECT_EQ("(nullptr)", Print(nullptr));  } + +TEST(PrintReferenceWrapper, Printable) { +  int x = 5; +  EXPECT_EQ("5", Print(std::ref(x))); +  EXPECT_EQ("5", Print(std::cref(x))); +} + +TEST(PrintReferenceWrapper, Unprintable) { +  ::foo::UnprintableInFoo up; +  EXPECT_EQ("16-byte object <EF-12 00-00 34-AB 00-00 00-00 00-00 00-00 00-00>", +            Print(std::ref(up))); +  EXPECT_EQ("16-byte object <EF-12 00-00 34-AB 00-00 00-00 00-00 00-00 00-00>", +            Print(std::cref(up))); +} +  #endif  // GTEST_LANG_CXX11  // Tests printing user-defined unprintable types. diff --git a/googletest/test/gtest_unittest.cc b/googletest/test/gtest_unittest.cc index 701ba204..c03b3671 100644 --- a/googletest/test/gtest_unittest.cc +++ b/googletest/test/gtest_unittest.cc @@ -6826,7 +6826,7 @@ TEST(ColoredOutputTest, UsesColorsWhenStdoutIsTty) {  TEST(ColoredOutputTest, UsesColorsWhenTermSupportsColors) {    GTEST_FLAG(color) = "auto"; -#if GTEST_OS_WINDOWS +#if GTEST_OS_WINDOWS && !GTEST_OS_WINDOWS_MINGW    // On Windows, we ignore the TERM variable as it's usually not set.    SetEnv("TERM", "dumb");  | 
