Merge branch 'master' into master

This commit is contained in:
Gennadiy Civil 2018-09-23 02:25:01 -04:00 committed by GitHub
commit c6f11f2158
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 33 additions and 24 deletions

View File

@ -29,10 +29,6 @@ matrix:
group: deprecated-2017Q4
compiler: gcc
env: BUILD_TYPE=Debug VERBOSE=1 CXX_FLAGS=-std=c++11
- os: linux
group: deprecated-2017Q4
compiler: clang
env: BUILD_TYPE=Debug VERBOSE=1
- os: linux
group: deprecated-2017Q4
compiler: clang
@ -40,16 +36,9 @@ matrix:
- os: linux
compiler: clang
env: BUILD_TYPE=Release VERBOSE=1 CXX_FLAGS=-std=c++11 NO_EXCEPTION=ON NO_RTTI=ON COMPILER_IS_GNUCXX=ON
- os: osx
compiler: gcc
env: BUILD_TYPE=Debug VERBOSE=1
- os: osx
compiler: gcc
env: BUILD_TYPE=Release VERBOSE=1 CXX_FLAGS=-std=c++11
- os: osx
compiler: clang
env: BUILD_TYPE=Debug VERBOSE=1
if: type != pull_request
- os: osx
env: BUILD_TYPE=Release VERBOSE=1 CXX_FLAGS=-std=c++11
if: type != pull_request

View File

@ -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)

View File

@ -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_

View File

@ -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)

View File

@ -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.

View File

@ -63,9 +63,7 @@ TEST(CommandLineFlagsTest, CanBeAccessedInCodeOnceGTestHIsIncluded) {
#include <map>
#include <vector>
#include <ostream>
#if GTEST_LANG_CXX11
#include <unordered_set>
#endif // GTEST_LANG_CXX11
#include "gtest/gtest-spi.h"
#include "src/gtest-internal-inl.h"
@ -5156,8 +5154,7 @@ TEST(AssertionResultTest, CanStreamOstreamManipulators) {
EXPECT_STREQ("Data\n\\0Will be visible", r.message());
}
// The next test uses explicit conversion operators -- a C++11 feature.
#if GTEST_LANG_CXX11
// The next test uses explicit conversion operators
TEST(AssertionResultTest, ConstructibleFromContextuallyConvertibleToBool) {
struct ExplicitlyConvertibleToBool {
@ -5170,8 +5167,6 @@ TEST(AssertionResultTest, ConstructibleFromContextuallyConvertibleToBool) {
EXPECT_TRUE(v2);
}
#endif // GTEST_LANG_CXX11
struct ConvertibleToAssertionResult {
operator AssertionResult() const { return AssertionResult(true); }
};
@ -6831,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");
@ -7555,7 +7550,6 @@ TEST(IsContainerTestTest, WorksForContainer) {
sizeof(IsContainerTest<std::map<int, double> >(0)));
}
#if GTEST_LANG_CXX11
struct ConstOnlyContainerWithPointerIterator {
using const_iterator = int*;
const_iterator begin() const;
@ -7577,7 +7571,6 @@ TEST(IsContainerTestTest, ConstOnlyContainer) {
EXPECT_EQ(sizeof(IsContainer),
sizeof(IsContainerTest<ConstOnlyContainerWithClassIterator>(0)));
}
#endif // GTEST_LANG_CXX11
// Tests IsHashTable.
struct AHashTable {
@ -7590,10 +7583,8 @@ struct NotReallyAHashTable {
TEST(IsHashTable, Basic) {
EXPECT_TRUE(testing::internal::IsHashTable<AHashTable>::value);
EXPECT_FALSE(testing::internal::IsHashTable<NotReallyAHashTable>::value);
#if GTEST_LANG_CXX11
EXPECT_FALSE(testing::internal::IsHashTable<std::vector<int>>::value);
EXPECT_TRUE(testing::internal::IsHashTable<std::unordered_set<int>>::value);
#endif // GTEST_LANG_CXX11
#if GTEST_HAS_HASH_SET_
EXPECT_TRUE(testing::internal::IsHashTable<__gnu_cxx::hash_set<int>>::value);
#endif // GTEST_HAS_HASH_SET_