Merge branch 'master' into master

This commit is contained in:
Gennadiy Civil 2018-09-14 12:31:37 -04:00 committed by GitHub
commit 2d200a7b35
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 57 additions and 93 deletions

View File

@ -38,6 +38,7 @@ install:
- ps: |
Write-Output "Compiler: $env:compiler"
Write-Output "Generator: $env:generator"
Write-Output "Env:Configuation: $env:configuration"
if (-not (Test-Path env:APPVEYOR_PULL_REQUEST_NUMBER)) {
Write-Output "This is *NOT* a pull request build"
} else {

View File

@ -1,5 +1,5 @@
AC_INIT([Google C++ Mocking and Testing Frameworks],
[1.8.0],
[1.9.0],
[googlemock@googlegroups.com],
[googletest])

View File

@ -246,35 +246,6 @@ We list the most frequently used macros below. For a complete list,
see file [${GTEST\_DIR}/include/gtest/internal/gtest-port.h](
../googletest/include/gtest/internal/gtest-port.h).
### Choosing a TR1 Tuple Library ###
Google Mock uses the C++ Technical Report 1 (TR1) tuple library
heavily. Unfortunately TR1 tuple is not yet widely available with all
compilers. The good news is that Google Test 1.4.0+ implements a
subset of TR1 tuple that's enough for Google Mock's need. Google Mock
will automatically use that implementation when the compiler doesn't
provide TR1 tuple.
Usually you don't need to care about which tuple library Google Test
and Google Mock use. However, if your project already uses TR1 tuple,
you need to tell Google Test and Google Mock to use the same TR1 tuple
library the rest of your project uses, or the two tuple
implementations will clash. To do that, add
-DGTEST_USE_OWN_TR1_TUPLE=0
to the compiler flags while compiling Google Test, Google Mock, and
your tests. If you want to force Google Test and Google Mock to use
their own tuple library, just add
-DGTEST_USE_OWN_TR1_TUPLE=1
to the compiler flags instead.
If you want to use Boost's TR1 tuple library with Google Mock, please
refer to the Boost website (http://www.boost.org/) for how to obtain
it and set it up.
### As a Shared Library (DLL) ###
Google Mock is compact, so most users can build and link it as a static

View File

@ -1405,8 +1405,9 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) {
private:\
::std::string FormatDescription(bool negation) const {\
::std::string gmock_description = (description);\
if (!gmock_description.empty())\
if (!gmock_description.empty()) {\
return gmock_description;\
}\
return ::testing::internal::FormatMatcherDescription(\
negation, #name, \
::testing::internal::UniversalTersePrintTupleFieldsToStrings(\
@ -1454,8 +1455,9 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) {
private:\
::std::string FormatDescription(bool negation) const {\
::std::string gmock_description = (description);\
if (!gmock_description.empty())\
if (!gmock_description.empty()) {\
return gmock_description;\
}\
return ::testing::internal::FormatMatcherDescription(\
negation, #name, \
::testing::internal::UniversalTersePrintTupleFieldsToStrings(\
@ -1509,8 +1511,9 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) {
private:\
::std::string FormatDescription(bool negation) const {\
::std::string gmock_description = (description);\
if (!gmock_description.empty())\
if (!gmock_description.empty()) {\
return gmock_description;\
}\
return ::testing::internal::FormatMatcherDescription(\
negation, #name, \
::testing::internal::UniversalTersePrintTupleFieldsToStrings(\
@ -1570,8 +1573,9 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) {
private:\
::std::string FormatDescription(bool negation) const {\
::std::string gmock_description = (description);\
if (!gmock_description.empty())\
if (!gmock_description.empty()) {\
return gmock_description;\
}\
return ::testing::internal::FormatMatcherDescription(\
negation, #name, \
::testing::internal::UniversalTersePrintTupleFieldsToStrings(\
@ -1638,8 +1642,9 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) {
private:\
::std::string FormatDescription(bool negation) const {\
::std::string gmock_description = (description);\
if (!gmock_description.empty())\
if (!gmock_description.empty()) {\
return gmock_description;\
}\
return ::testing::internal::FormatMatcherDescription(\
negation, #name, \
::testing::internal::UniversalTersePrintTupleFieldsToStrings(\
@ -1715,8 +1720,9 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) {
private:\
::std::string FormatDescription(bool negation) const {\
::std::string gmock_description = (description);\
if (!gmock_description.empty())\
if (!gmock_description.empty()) {\
return gmock_description;\
}\
return ::testing::internal::FormatMatcherDescription(\
negation, #name, \
::testing::internal::UniversalTersePrintTupleFieldsToStrings(\
@ -1796,8 +1802,9 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) {
private:\
::std::string FormatDescription(bool negation) const {\
::std::string gmock_description = (description);\
if (!gmock_description.empty())\
if (!gmock_description.empty()) {\
return gmock_description;\
}\
return ::testing::internal::FormatMatcherDescription(\
negation, #name, \
::testing::internal::UniversalTersePrintTupleFieldsToStrings(\
@ -1883,8 +1890,9 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) {
private:\
::std::string FormatDescription(bool negation) const {\
::std::string gmock_description = (description);\
if (!gmock_description.empty())\
if (!gmock_description.empty()) {\
return gmock_description;\
}\
return ::testing::internal::FormatMatcherDescription(\
negation, #name, \
::testing::internal::UniversalTersePrintTupleFieldsToStrings(\
@ -1979,8 +1987,9 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) {
private:\
::std::string FormatDescription(bool negation) const {\
::std::string gmock_description = (description);\
if (!gmock_description.empty())\
if (!gmock_description.empty()) {\
return gmock_description;\
}\
return ::testing::internal::FormatMatcherDescription(\
negation, #name, \
::testing::internal::UniversalTersePrintTupleFieldsToStrings(\
@ -2081,8 +2090,9 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) {
private:\
::std::string FormatDescription(bool negation) const {\
::std::string gmock_description = (description);\
if (!gmock_description.empty())\
if (!gmock_description.empty()) {\
return gmock_description;\
}\
return ::testing::internal::FormatMatcherDescription(\
negation, #name, \
::testing::internal::UniversalTersePrintTupleFieldsToStrings(\
@ -2190,8 +2200,9 @@ AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) {
private:\
::std::string FormatDescription(bool negation) const {\
::std::string gmock_description = (description);\
if (!gmock_description.empty())\
if (!gmock_description.empty()) {\
return gmock_description;\
}\
return ::testing::internal::FormatMatcherDescription(\
negation, #name, \
::testing::internal::UniversalTersePrintTupleFieldsToStrings(\

View File

@ -647,8 +647,9 @@ $var param_field_decls2 = [[$for j
private:\
::std::string FormatDescription(bool negation) const {\
::std::string gmock_description = (description);\
if (!gmock_description.empty())\
if (!gmock_description.empty()) {\
return gmock_description;\
}\
return ::testing::internal::FormatMatcherDescription(\
negation, #name, \
::testing::internal::UniversalTersePrintTupleFieldsToStrings(\

View File

@ -1307,9 +1307,6 @@ class StrEqualityMatcher {
#if GTEST_HAS_ABSL
bool MatchAndExplain(const absl::string_view& s,
MatchResultListener* listener) const {
if (s.data() == NULL) {
return !expect_eq_;
}
// This should fail to compile if absl::string_view is used with wide
// strings.
const StringType& str = string(s);
@ -1380,9 +1377,6 @@ class HasSubstrMatcher {
#if GTEST_HAS_ABSL
bool MatchAndExplain(const absl::string_view& s,
MatchResultListener* listener) const {
if (s.data() == NULL) {
return false;
}
// This should fail to compile if absl::string_view is used with wide
// strings.
const StringType& str = string(s);
@ -1440,9 +1434,6 @@ class StartsWithMatcher {
#if GTEST_HAS_ABSL
bool MatchAndExplain(const absl::string_view& s,
MatchResultListener* listener) const {
if (s.data() == NULL) {
return false;
}
// This should fail to compile if absl::string_view is used with wide
// strings.
const StringType& str = string(s);
@ -1499,9 +1490,6 @@ class EndsWithMatcher {
#if GTEST_HAS_ABSL
bool MatchAndExplain(const absl::string_view& s,
MatchResultListener* listener) const {
if (s.data() == NULL) {
return false;
}
// This should fail to compile if absl::string_view is used with wide
// strings.
const StringType& str = string(s);
@ -1558,7 +1546,7 @@ class MatchesRegexMatcher {
#if GTEST_HAS_ABSL
bool MatchAndExplain(const absl::string_view& s,
MatchResultListener* listener) const {
return s.data() && MatchAndExplain(string(s), listener);
return MatchAndExplain(string(s), listener);
}
#endif // GTEST_HAS_ABSL

View File

@ -1335,6 +1335,11 @@ TEST(StrEqTest, MatchesEqualString) {
EXPECT_TRUE(m3.Matches(absl::string_view("Hello")));
EXPECT_FALSE(m3.Matches(absl::string_view("hello")));
EXPECT_FALSE(m3.Matches(absl::string_view()));
Matcher<const absl::string_view&> m_empty = StrEq("");
EXPECT_TRUE(m_empty.Matches(absl::string_view("")));
EXPECT_TRUE(m_empty.Matches(absl::string_view()));
EXPECT_FALSE(m_empty.Matches(absl::string_view("hello")));
#endif // GTEST_HAS_ABSL
}
@ -1459,6 +1464,10 @@ TEST(HasSubstrTest, WorksForStringClasses) {
const Matcher<const std::string&> m2 = HasSubstr("foo");
EXPECT_TRUE(m2.Matches(std::string("I love food.")));
EXPECT_FALSE(m2.Matches(std::string("tofo")));
const Matcher<std::string> m_empty = HasSubstr("");
EXPECT_TRUE(m_empty.Matches(std::string()));
EXPECT_TRUE(m_empty.Matches(std::string("not empty")));
}
// Tests that HasSubstr() works for matching C-string-typed values.
@ -1472,6 +1481,11 @@ TEST(HasSubstrTest, WorksForCStrings) {
EXPECT_TRUE(m2.Matches("I love food."));
EXPECT_FALSE(m2.Matches("tofo"));
EXPECT_FALSE(m2.Matches(NULL));
const Matcher<const char*> m_empty = HasSubstr("");
EXPECT_TRUE(m_empty.Matches("not empty"));
EXPECT_TRUE(m_empty.Matches(""));
EXPECT_FALSE(m_empty.Matches(NULL));
}
#if GTEST_HAS_ABSL
@ -1489,7 +1503,8 @@ TEST(HasSubstrTest, WorksForStringViewClasses) {
const Matcher<const absl::string_view&> m3 = HasSubstr("");
EXPECT_TRUE(m3.Matches(absl::string_view("foo")));
EXPECT_FALSE(m3.Matches(absl::string_view()));
EXPECT_TRUE(m3.Matches(absl::string_view("")));
EXPECT_TRUE(m3.Matches(absl::string_view()));
}
#endif // GTEST_HAS_ABSL
@ -1713,6 +1728,13 @@ TEST(StartsWithTest, MatchesStringWithGivenPrefix) {
EXPECT_TRUE(m2.Matches("High"));
EXPECT_FALSE(m2.Matches("H"));
EXPECT_FALSE(m2.Matches(" Hi"));
#if GTEST_HAS_ABSL
const Matcher<absl::string_view> m_empty = StartsWith("");
EXPECT_TRUE(m_empty.Matches(absl::string_view()));
EXPECT_TRUE(m_empty.Matches(absl::string_view("")));
EXPECT_TRUE(m_empty.Matches(absl::string_view("not empty")));
#endif // GTEST_HAS_ABSL
}
TEST(StartsWithTest, CanDescribeSelf) {
@ -1748,9 +1770,8 @@ TEST(EndsWithTest, MatchesStringWithGivenSuffix) {
const Matcher<const absl::string_view&> m4 = EndsWith("");
EXPECT_TRUE(m4.Matches("Hi"));
EXPECT_TRUE(m4.Matches(""));
// Default-constructed absl::string_view should not match anything, in order
// to distinguish it from an empty string.
EXPECT_FALSE(m4.Matches(absl::string_view()));
EXPECT_TRUE(m4.Matches(absl::string_view()));
EXPECT_TRUE(m4.Matches(absl::string_view("")));
#endif // GTEST_HAS_ABSL
}
@ -1777,11 +1798,10 @@ TEST(MatchesRegexTest, MatchesStringMatchingGivenRegex) {
EXPECT_TRUE(m3.Matches(absl::string_view("az")));
EXPECT_TRUE(m3.Matches(absl::string_view("abcz")));
EXPECT_FALSE(m3.Matches(absl::string_view("1az")));
// Default-constructed absl::string_view should not match anything, in order
// to distinguish it from an empty string.
EXPECT_FALSE(m3.Matches(absl::string_view()));
const Matcher<const absl::string_view&> m4 = MatchesRegex("");
EXPECT_FALSE(m4.Matches(absl::string_view()));
EXPECT_TRUE(m4.Matches(absl::string_view("")));
EXPECT_TRUE(m4.Matches(absl::string_view()));
#endif // GTEST_HAS_ABSL
}
@ -1816,11 +1836,10 @@ TEST(ContainsRegexTest, MatchesStringContainingGivenRegex) {
EXPECT_TRUE(m3.Matches(absl::string_view("azbz")));
EXPECT_TRUE(m3.Matches(absl::string_view("az1")));
EXPECT_FALSE(m3.Matches(absl::string_view("1a")));
// Default-constructed absl::string_view should not match anything, in order
// to distinguish it from an empty string.
EXPECT_FALSE(m3.Matches(absl::string_view()));
const Matcher<const absl::string_view&> m4 = ContainsRegex("");
EXPECT_FALSE(m4.Matches(absl::string_view()));
EXPECT_TRUE(m4.Matches(absl::string_view("")));
EXPECT_TRUE(m4.Matches(absl::string_view()));
#endif // GTEST_HAS_ABSL
}

View File

@ -245,33 +245,6 @@ them to either 1 or 0 to enable or disable a certain feature.
We list the most frequently used macros below. For a complete list, see file
[include/gtest/internal/gtest-port.h](https://github.com/google/googletest/blob/master/include/gtest/internal/gtest-port.h).
### Choosing a TR1 Tuple Library
Some Google Test features require the C++ Technical Report 1 (TR1) tuple
library, which is not yet available with all compilers. The good news is that
Google Test implements a subset of TR1 tuple that's enough for its own need, and
will automatically use this when the compiler doesn't provide TR1 tuple.
Usually you don't need to care about which tuple library Google Test uses.
However, if your project already uses TR1 tuple, you need to tell Google Test to
use the same TR1 tuple library the rest of your project uses, or the two tuple
implementations will clash. To do that, add
-DGTEST_USE_OWN_TR1_TUPLE=0
to the compiler flags while compiling Google Test and your tests. If you want to
force Google Test to use its own tuple library, just add
-DGTEST_USE_OWN_TR1_TUPLE=1
to the compiler flags instead.
If you don't want Google Test to use tuple at all, add
-DGTEST_HAS_TR1_TUPLE=0
and all features using tuple will be disabled.
### Multi-threaded Tests
Google Test is thread-safe where the pthread library is available. After

View File

@ -2117,7 +2117,7 @@ class UnitTestRecordPropertyTestEnvironment : public Environment {
};
// This will test property recording outside of any test or test case.
static Environment* record_property_env =
static Environment* record_property_env GTEST_ATTRIBUTE_UNUSED_ =
AddGlobalTestEnvironment(new UnitTestRecordPropertyTestEnvironment);
// This group of tests is for predicate assertions (ASSERT_PRED*, etc)