remove MSVC workaround: accessing namespace scope from within nested classes

This commit is contained in:
Krystian Kuzniarek 2019-11-14 10:26:49 +01:00
parent f9665846e4
commit 21d276b5c4

View File

@ -2987,18 +2987,13 @@ TEST(MatcherAssertionTest, WorksWhenMatcherIsNotSatisfied) {
static unsigned short n; // NOLINT static unsigned short n; // NOLINT
n = 5; n = 5;
// VC++ prior to version 8.0 SP1 has a bug where it will not see any EXPECT_FATAL_FAILURE(ASSERT_THAT(n, Gt(10)),
// functions declared in the namespace scope from within nested classes.
// EXPECT/ASSERT_(NON)FATAL_FAILURE macros use nested classes so that all
// namespace-level functions invoked inside them need to be explicitly
// resolved.
EXPECT_FATAL_FAILURE(ASSERT_THAT(n, ::testing::Gt(10)),
"Value of: n\n" "Value of: n\n"
"Expected: is > 10\n" "Expected: is > 10\n"
" Actual: 5" + OfType("unsigned short")); " Actual: 5" + OfType("unsigned short"));
n = 0; n = 0;
EXPECT_NONFATAL_FAILURE( EXPECT_NONFATAL_FAILURE(
EXPECT_THAT(n, ::testing::AllOf(::testing::Le(7), ::testing::Ge(5))), EXPECT_THAT(n, AllOf(Le(7), Ge(5))),
"Value of: n\n" "Value of: n\n"
"Expected: (is <= 7) and (is >= 5)\n" "Expected: (is <= 7) and (is >= 5)\n"
" Actual: 0" + OfType("unsigned short")); " Actual: 0" + OfType("unsigned short"));
@ -3012,11 +3007,11 @@ TEST(MatcherAssertionTest, WorksForByRefArguments) {
static int n; static int n;
n = 0; n = 0;
EXPECT_THAT(n, AllOf(Le(7), Ref(n))); EXPECT_THAT(n, AllOf(Le(7), Ref(n)));
EXPECT_FATAL_FAILURE(ASSERT_THAT(n, ::testing::Not(::testing::Ref(n))), EXPECT_FATAL_FAILURE(ASSERT_THAT(n, Not(Ref(n))),
"Value of: n\n" "Value of: n\n"
"Expected: does not reference the variable @"); "Expected: does not reference the variable @");
// Tests the "Actual" part. // Tests the "Actual" part.
EXPECT_FATAL_FAILURE(ASSERT_THAT(n, ::testing::Not(::testing::Ref(n))), EXPECT_FATAL_FAILURE(ASSERT_THAT(n, Not(Ref(n))),
"Actual: 0" + OfType("int") + ", which is located @"); "Actual: 0" + OfType("int") + ", which is located @");
} }