googletest-port-test.cc (googletest-release-1.10.0) | : | googletest-port-test.cc (googletest-release-1.11.0) | ||
---|---|---|---|---|
skipping to change at line 93 | skipping to change at line 93 | |||
} | } | |||
TEST(IsXDigitTest, ReturnsFalseForWideNonAscii) { | TEST(IsXDigitTest, ReturnsFalseForWideNonAscii) { | |||
EXPECT_FALSE(IsXDigit(static_cast<wchar_t>(0x80))); | EXPECT_FALSE(IsXDigit(static_cast<wchar_t>(0x80))); | |||
EXPECT_FALSE(IsXDigit(static_cast<wchar_t>(L'0' | 0x80))); | EXPECT_FALSE(IsXDigit(static_cast<wchar_t>(L'0' | 0x80))); | |||
EXPECT_FALSE(IsXDigit(static_cast<wchar_t>(L'0' | 0x100))); | EXPECT_FALSE(IsXDigit(static_cast<wchar_t>(L'0' | 0x100))); | |||
} | } | |||
class Base { | class Base { | |||
public: | public: | |||
// Copy constructor and assignment operator do exactly what we need, so we | ||||
// use them. | ||||
Base() : member_(0) {} | Base() : member_(0) {} | |||
explicit Base(int n) : member_(n) {} | explicit Base(int n) : member_(n) {} | |||
Base(const Base&) = default; | ||||
Base& operator=(const Base&) = default; | ||||
virtual ~Base() {} | virtual ~Base() {} | |||
int member() { return member_; } | int member() { return member_; } | |||
private: | private: | |||
int member_; | int member_; | |||
}; | }; | |||
class Derived : public Base { | class Derived : public Base { | |||
public: | public: | |||
explicit Derived(int n) : Base(n) {} | explicit Derived(int n) : Base(n) {} | |||
skipping to change at line 204 | skipping to change at line 204 | |||
To(bool* converted) { *converted = true; } // NOLINT | To(bool* converted) { *converted = true; } // NOLINT | |||
}; | }; | |||
TEST(ImplicitCastTest, CanUseImplicitConstructor) { | TEST(ImplicitCastTest, CanUseImplicitConstructor) { | |||
bool converted = false; | bool converted = false; | |||
To to = ::testing::internal::ImplicitCast_<To>(&converted); | To to = ::testing::internal::ImplicitCast_<To>(&converted); | |||
(void)to; | (void)to; | |||
EXPECT_TRUE(converted); | EXPECT_TRUE(converted); | |||
} | } | |||
// The following code intentionally tests a suboptimal syntax. | ||||
#ifdef __GNUC__ | ||||
#pragma GCC diagnostic push | ||||
#pragma GCC diagnostic ignored "-Wdangling-else" | ||||
#pragma GCC diagnostic ignored "-Wempty-body" | ||||
#pragma GCC diagnostic ignored "-Wpragmas" | ||||
#endif | ||||
TEST(GtestCheckSyntaxTest, BehavesLikeASingleStatement) { | TEST(GtestCheckSyntaxTest, BehavesLikeASingleStatement) { | |||
if (AlwaysFalse()) | if (AlwaysFalse()) | |||
GTEST_CHECK_(false) << "This should never be executed; " | GTEST_CHECK_(false) << "This should never be executed; " | |||
"It's a compilation test only."; | "It's a compilation test only."; | |||
if (AlwaysTrue()) | if (AlwaysTrue()) | |||
GTEST_CHECK_(true); | GTEST_CHECK_(true); | |||
else | else | |||
; // NOLINT | ; // NOLINT | |||
if (AlwaysFalse()) | if (AlwaysFalse()) | |||
; // NOLINT | ; // NOLINT | |||
else | else | |||
GTEST_CHECK_(true) << ""; | GTEST_CHECK_(true) << ""; | |||
} | } | |||
#ifdef __GNUC__ | ||||
#pragma GCC diagnostic pop | ||||
#endif | ||||
TEST(GtestCheckSyntaxTest, WorksWithSwitch) { | TEST(GtestCheckSyntaxTest, WorksWithSwitch) { | |||
switch (0) { | switch (0) { | |||
case 1: | case 1: | |||
break; | break; | |||
default: | default: | |||
GTEST_CHECK_(true); | GTEST_CHECK_(true); | |||
} | } | |||
switch (0) | switch (0) | |||
skipping to change at line 366 | skipping to change at line 376 | |||
# else | # else | |||
EXPECT_TRUE(GTEST_USES_SIMPLE_RE); | EXPECT_TRUE(GTEST_USES_SIMPLE_RE); | |||
# endif | # endif | |||
#endif // !GTEST_USES_PCRE | #endif // !GTEST_USES_PCRE | |||
} | } | |||
#if GTEST_USES_POSIX_RE | #if GTEST_USES_POSIX_RE | |||
# if GTEST_HAS_TYPED_TEST | ||||
template <typename Str> | template <typename Str> | |||
class RETest : public ::testing::Test {}; | class RETest : public ::testing::Test {}; | |||
// Defines StringTypes as the list of all string types that class RE | // Defines StringTypes as the list of all string types that class RE | |||
// supports. | // supports. | |||
typedef testing::Types< ::std::string, const char*> StringTypes; | typedef testing::Types< ::std::string, const char*> StringTypes; | |||
TYPED_TEST_SUITE(RETest, StringTypes); | TYPED_TEST_SUITE(RETest, StringTypes); | |||
// Tests RE's implicit constructors. | // Tests RE's implicit constructors. | |||
skipping to change at line 423 | skipping to change at line 431 | |||
EXPECT_TRUE(RE::PartialMatch(TypeParam("a"), empty)); | EXPECT_TRUE(RE::PartialMatch(TypeParam("a"), empty)); | |||
const RE re(TypeParam("a.*z")); | const RE re(TypeParam("a.*z")); | |||
EXPECT_TRUE(RE::PartialMatch(TypeParam("az"), re)); | EXPECT_TRUE(RE::PartialMatch(TypeParam("az"), re)); | |||
EXPECT_TRUE(RE::PartialMatch(TypeParam("axyz"), re)); | EXPECT_TRUE(RE::PartialMatch(TypeParam("axyz"), re)); | |||
EXPECT_TRUE(RE::PartialMatch(TypeParam("baz"), re)); | EXPECT_TRUE(RE::PartialMatch(TypeParam("baz"), re)); | |||
EXPECT_TRUE(RE::PartialMatch(TypeParam("azy"), re)); | EXPECT_TRUE(RE::PartialMatch(TypeParam("azy"), re)); | |||
EXPECT_FALSE(RE::PartialMatch(TypeParam("zza"), re)); | EXPECT_FALSE(RE::PartialMatch(TypeParam("zza"), re)); | |||
} | } | |||
# endif // GTEST_HAS_TYPED_TEST | ||||
#elif GTEST_USES_SIMPLE_RE | #elif GTEST_USES_SIMPLE_RE | |||
TEST(IsInSetTest, NulCharIsNotInAnySet) { | TEST(IsInSetTest, NulCharIsNotInAnySet) { | |||
EXPECT_FALSE(IsInSet('\0', "")); | EXPECT_FALSE(IsInSet('\0', "")); | |||
EXPECT_FALSE(IsInSet('\0', "\0")); | EXPECT_FALSE(IsInSet('\0', "\0")); | |||
EXPECT_FALSE(IsInSet('\0', "a")); | EXPECT_FALSE(IsInSet('\0', "a")); | |||
} | } | |||
TEST(IsInSetTest, WorksForNonNulChars) { | TEST(IsInSetTest, WorksForNonNulChars) { | |||
EXPECT_FALSE(IsInSet('a', "Ab")); | EXPECT_FALSE(IsInSet('a', "Ab")); | |||
skipping to change at line 1183 | skipping to change at line 1189 | |||
// to protect this access with a mutex. | // to protect this access with a mutex. | |||
DestructorCall::List()[index_]->ReportDestroyed(); | DestructorCall::List()[index_]->ReportDestroyed(); | |||
} | } | |||
private: | private: | |||
static size_t GetNewIndex() { | static size_t GetNewIndex() { | |||
DestructorCall::List().push_back(new DestructorCall); | DestructorCall::List().push_back(new DestructorCall); | |||
return DestructorCall::List().size() - 1; | return DestructorCall::List().size() - 1; | |||
} | } | |||
const size_t index_; | const size_t index_; | |||
GTEST_DISALLOW_ASSIGN_(DestructorTracker); | ||||
}; | }; | |||
typedef ThreadLocal<DestructorTracker>* ThreadParam; | typedef ThreadLocal<DestructorTracker>* ThreadParam; | |||
void CallThreadLocalGet(ThreadParam thread_local_param) { | void CallThreadLocalGet(ThreadParam thread_local_param) { | |||
thread_local_param->get(); | thread_local_param->get(); | |||
} | } | |||
// Tests that when a ThreadLocal object dies in a thread, it destroys | // Tests that when a ThreadLocal object dies in a thread, it destroys | |||
// the managed object for that thread. | // the managed object for that thread. | |||
End of changes. 7 change blocks. | ||||
8 lines changed or deleted | 12 lines changed or added |