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 #include // NOLINT #include #include @@ -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 +void PrintTo(std::reference_wrapper 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 # 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 ", + Print(std::ref(up))); + EXPECT_EQ("16-byte object ", + 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");