diff options
Diffstat (limited to 'googlemock/test')
-rw-r--r-- | googlemock/test/gmock-internal-utils_test.cc | 22 | ||||
-rw-r--r-- | googlemock/test/gmock-nice-strict_test.cc | 43 | ||||
-rw-r--r-- | googlemock/test/gmock-spec-builders_test.cc | 41 | ||||
-rw-r--r-- | googlemock/test/gmock_output_test_.cc | 12 | ||||
-rw-r--r-- | googlemock/test/gmock_test.cc | 36 |
5 files changed, 75 insertions, 79 deletions
diff --git a/googlemock/test/gmock-internal-utils_test.cc b/googlemock/test/gmock-internal-utils_test.cc index b30eb8c..8722418 100644 --- a/googlemock/test/gmock-internal-utils_test.cc +++ b/googlemock/test/gmock-internal-utils_test.cc @@ -361,27 +361,27 @@ TEST(ExpectTest, FailsNonfatallyOnFalse) { class LogIsVisibleTest : public ::testing::Test { protected: - void SetUp() override { original_verbose_ = GMOCK_FLAG(verbose); } + void SetUp() override { original_verbose_ = GMOCK_FLAG_GET(verbose); } - void TearDown() override { GMOCK_FLAG(verbose) = original_verbose_; } + void TearDown() override { GMOCK_FLAG_SET(verbose, original_verbose_); } std::string original_verbose_; }; TEST_F(LogIsVisibleTest, AlwaysReturnsTrueIfVerbosityIsInfo) { - GMOCK_FLAG(verbose) = kInfoVerbosity; + GMOCK_FLAG_SET(verbose, kInfoVerbosity); EXPECT_TRUE(LogIsVisible(kInfo)); EXPECT_TRUE(LogIsVisible(kWarning)); } TEST_F(LogIsVisibleTest, AlwaysReturnsFalseIfVerbosityIsError) { - GMOCK_FLAG(verbose) = kErrorVerbosity; + GMOCK_FLAG_SET(verbose, kErrorVerbosity); EXPECT_FALSE(LogIsVisible(kInfo)); EXPECT_FALSE(LogIsVisible(kWarning)); } TEST_F(LogIsVisibleTest, WorksWhenVerbosityIsWarning) { - GMOCK_FLAG(verbose) = kWarningVerbosity; + GMOCK_FLAG_SET(verbose, kWarningVerbosity); EXPECT_FALSE(LogIsVisible(kInfo)); EXPECT_TRUE(LogIsVisible(kWarning)); } @@ -395,7 +395,7 @@ TEST_F(LogIsVisibleTest, WorksWhenVerbosityIsWarning) { void TestLogWithSeverity(const std::string& verbosity, LogSeverity severity, bool should_print) { const std::string old_flag = GMOCK_FLAG(verbose); - GMOCK_FLAG(verbose) = verbosity; + GMOCK_FLAG_SET(verbose, verbosity); CaptureStdout(); Log(severity, "Test log.\n", 0); if (should_print) { @@ -407,18 +407,18 @@ void TestLogWithSeverity(const std::string& verbosity, LogSeverity severity, } else { EXPECT_STREQ("", GetCapturedStdout().c_str()); } - GMOCK_FLAG(verbose) = old_flag; + GMOCK_FLAG_SET(verbose, old_flag); } // Tests that when the stack_frames_to_skip parameter is negative, // Log() doesn't include the stack trace in the output. TEST(LogTest, NoStackTraceWhenStackFramesToSkipIsNegative) { const std::string saved_flag = GMOCK_FLAG(verbose); - GMOCK_FLAG(verbose) = kInfoVerbosity; + GMOCK_FLAG_SET(verbose, kInfoVerbosity); CaptureStdout(); Log(kInfo, "Test log.\n", -1); EXPECT_STREQ("\nTest log.\n", GetCapturedStdout().c_str()); - GMOCK_FLAG(verbose) = saved_flag; + GMOCK_FLAG_SET(verbose, saved_flag); } struct MockStackTraceGetter : testing::internal::OsStackTraceGetterInterface { @@ -500,10 +500,10 @@ TEST(LogTest, OnlyWarningsArePrintedWhenVerbosityIsInvalid) { // and log severity. std::string GrabOutput(void(*logger)(), const char* verbosity) { const std::string saved_flag = GMOCK_FLAG(verbose); - GMOCK_FLAG(verbose) = verbosity; + GMOCK_FLAG_SET(verbose, verbosity); CaptureStdout(); logger(); - GMOCK_FLAG(verbose) = saved_flag; + GMOCK_FLAG_SET(verbose, saved_flag); return GetCapturedStdout(); } diff --git a/googlemock/test/gmock-nice-strict_test.cc b/googlemock/test/gmock-nice-strict_test.cc index 25558eb..319b18d 100644 --- a/googlemock/test/gmock-nice-strict_test.cc +++ b/googlemock/test/gmock-nice-strict_test.cc @@ -50,7 +50,6 @@ class Mock { namespace testing { namespace gmock_nice_strict_test { -using testing::GMOCK_FLAG(verbose); using testing::HasSubstr; using testing::NaggyMock; using testing::NiceMock; @@ -140,8 +139,8 @@ class MockBaz { // Tests that a raw mock generates warnings for uninteresting calls. TEST(RawMockTest, WarningForUninterestingCall) { - const std::string saved_flag = GMOCK_FLAG(verbose); - GMOCK_FLAG(verbose) = "warning"; + const std::string saved_flag = GMOCK_FLAG_GET(verbose); + GMOCK_FLAG_SET(verbose, "warning"); MockFoo raw_foo; @@ -151,14 +150,14 @@ TEST(RawMockTest, WarningForUninterestingCall) { EXPECT_THAT(GetCapturedStdout(), HasSubstr("Uninteresting mock function call")); - GMOCK_FLAG(verbose) = saved_flag; + GMOCK_FLAG_SET(verbose, saved_flag); } // Tests that a raw mock generates warnings for uninteresting calls // that delete the mock object. TEST(RawMockTest, WarningForUninterestingCallAfterDeath) { - const std::string saved_flag = GMOCK_FLAG(verbose); - GMOCK_FLAG(verbose) = "warning"; + const std::string saved_flag = GMOCK_FLAG_GET(verbose); + GMOCK_FLAG_SET(verbose, "warning"); MockFoo* const raw_foo = new MockFoo; @@ -170,7 +169,7 @@ TEST(RawMockTest, WarningForUninterestingCallAfterDeath) { EXPECT_THAT(GetCapturedStdout(), HasSubstr("Uninteresting mock function call")); - GMOCK_FLAG(verbose) = saved_flag; + GMOCK_FLAG_SET(verbose, saved_flag); } // Tests that a raw mock generates informational logs for @@ -178,14 +177,14 @@ TEST(RawMockTest, WarningForUninterestingCallAfterDeath) { TEST(RawMockTest, InfoForUninterestingCall) { MockFoo raw_foo; - const std::string saved_flag = GMOCK_FLAG(verbose); - GMOCK_FLAG(verbose) = "info"; + const std::string saved_flag = GMOCK_FLAG_GET(verbose); + GMOCK_FLAG_SET(verbose, "info"); CaptureStdout(); raw_foo.DoThis(); EXPECT_THAT(GetCapturedStdout(), HasSubstr("Uninteresting mock function call")); - GMOCK_FLAG(verbose) = saved_flag; + GMOCK_FLAG_SET(verbose, saved_flag); } TEST(RawMockTest, IsNaggy_IsNice_IsStrict) { @@ -223,14 +222,14 @@ TEST(NiceMockTest, NoWarningForUninterestingCallAfterDeath) { TEST(NiceMockTest, InfoForUninterestingCall) { NiceMock<MockFoo> nice_foo; - const std::string saved_flag = GMOCK_FLAG(verbose); - GMOCK_FLAG(verbose) = "info"; + const std::string saved_flag = GMOCK_FLAG_GET(verbose); + GMOCK_FLAG_SET(verbose, "info"); CaptureStdout(); nice_foo.DoThis(); EXPECT_THAT(GetCapturedStdout(), HasSubstr("Uninteresting mock function call")); - GMOCK_FLAG(verbose) = saved_flag; + GMOCK_FLAG_SET(verbose, saved_flag); } #endif // GTEST_HAS_STREAM_REDIRECTION @@ -326,8 +325,8 @@ TEST(NiceMockTest, IsNaggy_IsNice_IsStrict) { // Tests that a naggy mock generates warnings for uninteresting calls. TEST(NaggyMockTest, WarningForUninterestingCall) { - const std::string saved_flag = GMOCK_FLAG(verbose); - GMOCK_FLAG(verbose) = "warning"; + const std::string saved_flag = GMOCK_FLAG_GET(verbose); + GMOCK_FLAG_SET(verbose, "warning"); NaggyMock<MockFoo> naggy_foo; @@ -337,14 +336,14 @@ TEST(NaggyMockTest, WarningForUninterestingCall) { EXPECT_THAT(GetCapturedStdout(), HasSubstr("Uninteresting mock function call")); - GMOCK_FLAG(verbose) = saved_flag; + GMOCK_FLAG_SET(verbose, saved_flag); } // Tests that a naggy mock generates a warning for an uninteresting call // that deletes the mock object. TEST(NaggyMockTest, WarningForUninterestingCallAfterDeath) { - const std::string saved_flag = GMOCK_FLAG(verbose); - GMOCK_FLAG(verbose) = "warning"; + const std::string saved_flag = GMOCK_FLAG_GET(verbose); + GMOCK_FLAG_SET(verbose, "warning"); NaggyMock<MockFoo>* const naggy_foo = new NaggyMock<MockFoo>; @@ -356,7 +355,7 @@ TEST(NaggyMockTest, WarningForUninterestingCallAfterDeath) { EXPECT_THAT(GetCapturedStdout(), HasSubstr("Uninteresting mock function call")); - GMOCK_FLAG(verbose) = saved_flag; + GMOCK_FLAG_SET(verbose, saved_flag); } #endif // GTEST_HAS_STREAM_REDIRECTION @@ -419,8 +418,8 @@ TEST(NaggyMockTest, AcceptsClassNamedMock) { } TEST(NaggyMockTest, IsNaggyInDestructor) { - const std::string saved_flag = GMOCK_FLAG(verbose); - GMOCK_FLAG(verbose) = "warning"; + const std::string saved_flag = GMOCK_FLAG_GET(verbose); + GMOCK_FLAG_SET(verbose, "warning"); CaptureStdout(); { @@ -431,7 +430,7 @@ TEST(NaggyMockTest, IsNaggyInDestructor) { EXPECT_THAT(GetCapturedStdout(), HasSubstr("Uninteresting mock function call")); - GMOCK_FLAG(verbose) = saved_flag; + GMOCK_FLAG_SET(verbose, saved_flag); } TEST(NaggyMockTest, IsNaggy_IsNice_IsStrict) { diff --git a/googlemock/test/gmock-spec-builders_test.cc b/googlemock/test/gmock-spec-builders_test.cc index fa97411..b13e1c1 100644 --- a/googlemock/test/gmock-spec-builders_test.cc +++ b/googlemock/test/gmock-spec-builders_test.cc @@ -76,7 +76,6 @@ using testing::DoDefault; using testing::Eq; using testing::Expectation; using testing::ExpectationSet; -using testing::GMOCK_FLAG(verbose); using testing::Gt; using testing::IgnoreResult; using testing::InSequence; @@ -696,9 +695,9 @@ TEST(ExpectCallSyntaxTest, WarnsOnTooFewActions) { } TEST(ExpectCallSyntaxTest, WarningIsErrorWithFlag) { - int original_behavior = testing::GMOCK_FLAG(default_mock_behavior); + int original_behavior = GMOCK_FLAG_GET(default_mock_behavior); - testing::GMOCK_FLAG(default_mock_behavior) = kAllow; + GMOCK_FLAG_SET(default_mock_behavior, kAllow); CaptureStdout(); { MockA a; @@ -707,7 +706,7 @@ TEST(ExpectCallSyntaxTest, WarningIsErrorWithFlag) { std::string output = GetCapturedStdout(); EXPECT_TRUE(output.empty()) << output; - testing::GMOCK_FLAG(default_mock_behavior) = kWarn; + GMOCK_FLAG_SET(default_mock_behavior, kWarn); CaptureStdout(); { MockA a; @@ -718,14 +717,14 @@ TEST(ExpectCallSyntaxTest, WarningIsErrorWithFlag) { EXPECT_PRED_FORMAT2(IsSubstring, "Uninteresting mock function call", warning_output); - testing::GMOCK_FLAG(default_mock_behavior) = kFail; + GMOCK_FLAG_SET(default_mock_behavior, kFail); EXPECT_NONFATAL_FAILURE({ MockA a; a.DoA(0); }, "Uninteresting mock function call"); // Out of bounds values are converted to kWarn - testing::GMOCK_FLAG(default_mock_behavior) = -1; + GMOCK_FLAG_SET(default_mock_behavior, -1); CaptureStdout(); { MockA a; @@ -735,7 +734,7 @@ TEST(ExpectCallSyntaxTest, WarningIsErrorWithFlag) { EXPECT_PRED_FORMAT2(IsSubstring, "GMOCK WARNING", warning_output); EXPECT_PRED_FORMAT2(IsSubstring, "Uninteresting mock function call", warning_output); - testing::GMOCK_FLAG(default_mock_behavior) = 3; + GMOCK_FLAG_SET(default_mock_behavior, 3); CaptureStdout(); { MockA a; @@ -746,7 +745,7 @@ TEST(ExpectCallSyntaxTest, WarningIsErrorWithFlag) { EXPECT_PRED_FORMAT2(IsSubstring, "Uninteresting mock function call", warning_output); - testing::GMOCK_FLAG(default_mock_behavior) = original_behavior; + GMOCK_FLAG_SET(default_mock_behavior, original_behavior); } #endif // GTEST_HAS_STREAM_REDIRECTION @@ -2024,10 +2023,10 @@ class MockC { class VerboseFlagPreservingFixture : public testing::Test { protected: VerboseFlagPreservingFixture() - : saved_verbose_flag_(GMOCK_FLAG(verbose)) {} + : saved_verbose_flag_(GMOCK_FLAG_GET(verbose)) {} ~VerboseFlagPreservingFixture() override { - GMOCK_FLAG(verbose) = saved_verbose_flag_; + GMOCK_FLAG_SET(verbose, saved_verbose_flag_); } private: @@ -2043,7 +2042,7 @@ class VerboseFlagPreservingFixture : public testing::Test { // --gmock_verbose=warning is specified. TEST(FunctionCallMessageTest, UninterestingCallOnNaggyMockGeneratesNoStackTraceWhenVerboseWarning) { - GMOCK_FLAG(verbose) = kWarningVerbosity; + GMOCK_FLAG_SET(verbose, kWarningVerbosity); NaggyMock<MockC> c; CaptureStdout(); c.VoidMethod(false, 5, "Hi", nullptr, Printable(), Unprintable()); @@ -2057,7 +2056,7 @@ TEST(FunctionCallMessageTest, // --gmock_verbose=info is specified. TEST(FunctionCallMessageTest, UninterestingCallOnNaggyMockGeneratesFyiWithStackTraceWhenVerboseInfo) { - GMOCK_FLAG(verbose) = kInfoVerbosity; + GMOCK_FLAG_SET(verbose, kInfoVerbosity); NaggyMock<MockC> c; CaptureStdout(); c.VoidMethod(false, 5, "Hi", nullptr, Printable(), Unprintable()); @@ -2213,7 +2212,7 @@ class GMockVerboseFlagTest : public VerboseFlagPreservingFixture { // Tests that --gmock_verbose=info causes both expected and // uninteresting calls to be reported. TEST_F(GMockVerboseFlagTest, Info) { - GMOCK_FLAG(verbose) = kInfoVerbosity; + GMOCK_FLAG_SET(verbose, kInfoVerbosity); TestExpectedCall(true); TestUninterestingCallOnNaggyMock(true); } @@ -2221,7 +2220,7 @@ TEST_F(GMockVerboseFlagTest, Info) { // Tests that --gmock_verbose=warning causes uninteresting calls to be // reported. TEST_F(GMockVerboseFlagTest, Warning) { - GMOCK_FLAG(verbose) = kWarningVerbosity; + GMOCK_FLAG_SET(verbose, kWarningVerbosity); TestExpectedCall(false); TestUninterestingCallOnNaggyMock(true); } @@ -2229,7 +2228,7 @@ TEST_F(GMockVerboseFlagTest, Warning) { // Tests that --gmock_verbose=warning causes neither expected nor // uninteresting calls to be reported. TEST_F(GMockVerboseFlagTest, Error) { - GMOCK_FLAG(verbose) = kErrorVerbosity; + GMOCK_FLAG_SET(verbose, kErrorVerbosity); TestExpectedCall(false); TestUninterestingCallOnNaggyMock(false); } @@ -2237,7 +2236,7 @@ TEST_F(GMockVerboseFlagTest, Error) { // Tests that --gmock_verbose=SOME_INVALID_VALUE has the same effect // as --gmock_verbose=warning. TEST_F(GMockVerboseFlagTest, InvalidFlagIsTreatedAsWarning) { - GMOCK_FLAG(verbose) = "invalid"; // Treated as "warning". + GMOCK_FLAG_SET(verbose, "invalid"); // Treated as "warning". TestExpectedCall(false); TestUninterestingCallOnNaggyMock(true); } @@ -2270,21 +2269,21 @@ class GMockLogTest : public VerboseFlagPreservingFixture { }; TEST_F(GMockLogTest, DoesNotPrintGoodCallInternallyIfVerbosityIsWarning) { - GMOCK_FLAG(verbose) = kWarningVerbosity; + GMOCK_FLAG_SET(verbose, kWarningVerbosity); EXPECT_CALL(helper_, Foo(_)) .WillOnce(Return(PrintMeNot())); helper_.Foo(PrintMeNot()); // This is an expected call. } TEST_F(GMockLogTest, DoesNotPrintGoodCallInternallyIfVerbosityIsError) { - GMOCK_FLAG(verbose) = kErrorVerbosity; + GMOCK_FLAG_SET(verbose, kErrorVerbosity); EXPECT_CALL(helper_, Foo(_)) .WillOnce(Return(PrintMeNot())); helper_.Foo(PrintMeNot()); // This is an expected call. } TEST_F(GMockLogTest, DoesNotPrintWarningInternallyIfVerbosityIsError) { - GMOCK_FLAG(verbose) = kErrorVerbosity; + GMOCK_FLAG_SET(verbose, kErrorVerbosity); ON_CALL(helper_, Foo(_)) .WillByDefault(Return(PrintMeNot())); helper_.Foo(PrintMeNot()); // This should generate a warning. @@ -2768,8 +2767,8 @@ int main(int argc, char **argv) { testing::InitGoogleMock(&argc, argv); // Ensures that the tests pass no matter what value of // --gmock_catch_leaked_mocks and --gmock_verbose the user specifies. - testing::GMOCK_FLAG(catch_leaked_mocks) = true; - testing::GMOCK_FLAG(verbose) = testing::internal::kWarningVerbosity; + GMOCK_FLAG_SET(catch_leaked_mocks, true); + GMOCK_FLAG_SET(verbose, testing::internal::kWarningVerbosity); return RUN_ALL_TESTS(); } diff --git a/googlemock/test/gmock_output_test_.cc b/googlemock/test/gmock_output_test_.cc index 3955c73..b1dac45 100644 --- a/googlemock/test/gmock_output_test_.cc +++ b/googlemock/test/gmock_output_test_.cc @@ -72,21 +72,21 @@ class GMockOutputTest : public testing::Test { }; TEST_F(GMockOutputTest, ExpectedCall) { - testing::GMOCK_FLAG(verbose) = "info"; + GMOCK_FLAG_SET(verbose, "info"); EXPECT_CALL(foo_, Bar2(0, _)); foo_.Bar2(0, 0); // Expected call - testing::GMOCK_FLAG(verbose) = "warning"; + GMOCK_FLAG_SET(verbose, "warning"); } TEST_F(GMockOutputTest, ExpectedCallToVoidFunction) { - testing::GMOCK_FLAG(verbose) = "info"; + GMOCK_FLAG_SET(verbose, "info"); EXPECT_CALL(foo_, Bar3(0, _)); foo_.Bar3(0, 0); // Expected call - testing::GMOCK_FLAG(verbose) = "warning"; + GMOCK_FLAG_SET(verbose, "warning"); } TEST_F(GMockOutputTest, ExplicitActionsRunOut) { @@ -297,8 +297,8 @@ int main(int argc, char **argv) { testing::InitGoogleMock(&argc, argv); // Ensures that the tests pass no matter what value of // --gmock_catch_leaked_mocks and --gmock_verbose the user specifies. - testing::GMOCK_FLAG(catch_leaked_mocks) = true; - testing::GMOCK_FLAG(verbose) = "warning"; + GMOCK_FLAG_SET(catch_leaked_mocks, true); + GMOCK_FLAG_SET(verbose, "warning"); TestCatchesLeakedMocksInAdHocTests(); return RUN_ALL_TESTS(); diff --git a/googlemock/test/gmock_test.cc b/googlemock/test/gmock_test.cc index e9840a3..9a2bd93 100644 --- a/googlemock/test/gmock_test.cc +++ b/googlemock/test/gmock_test.cc @@ -40,8 +40,6 @@ #if !defined(GTEST_CUSTOM_INIT_GOOGLE_TEST_FUNCTION_) -using testing::GMOCK_FLAG(default_mock_behavior); -using testing::GMOCK_FLAG(verbose); using testing::InitGoogleMock; // Verifies that calling InitGoogleMock() on argv results in new_argv, @@ -49,7 +47,7 @@ using testing::InitGoogleMock; template <typename Char, int M, int N> void TestInitGoogleMock(const Char* (&argv)[M], const Char* (&new_argv)[N], const ::std::string& expected_gmock_verbose) { - const ::std::string old_verbose = GMOCK_FLAG(verbose); + const ::std::string old_verbose = GMOCK_FLAG_GET(verbose); int argc = M - 1; InitGoogleMock(&argc, const_cast<Char**>(argv)); @@ -59,8 +57,8 @@ void TestInitGoogleMock(const Char* (&argv)[M], const Char* (&new_argv)[N], EXPECT_STREQ(new_argv[i], argv[i]); } - EXPECT_EQ(expected_gmock_verbose, GMOCK_FLAG(verbose).c_str()); - GMOCK_FLAG(verbose) = old_verbose; // Restores the gmock_verbose flag. + EXPECT_EQ(expected_gmock_verbose, GMOCK_FLAG_GET(verbose)); + GMOCK_FLAG_SET(verbose, old_verbose); // Restores the gmock_verbose flag. } TEST(InitGoogleMockTest, ParsesInvalidCommandLine) { @@ -68,7 +66,7 @@ TEST(InitGoogleMockTest, ParsesInvalidCommandLine) { const char* new_argv[] = {nullptr}; - TestInitGoogleMock(argv, new_argv, GMOCK_FLAG(verbose)); + TestInitGoogleMock(argv, new_argv, GMOCK_FLAG_GET(verbose)); } TEST(InitGoogleMockTest, ParsesEmptyCommandLine) { @@ -76,7 +74,7 @@ TEST(InitGoogleMockTest, ParsesEmptyCommandLine) { const char* new_argv[] = {"foo.exe", nullptr}; - TestInitGoogleMock(argv, new_argv, GMOCK_FLAG(verbose)); + TestInitGoogleMock(argv, new_argv, GMOCK_FLAG_GET(verbose)); } TEST(InitGoogleMockTest, ParsesSingleFlag) { @@ -88,16 +86,16 @@ TEST(InitGoogleMockTest, ParsesSingleFlag) { } TEST(InitGoogleMockTest, ParsesMultipleFlags) { - int old_default_behavior = GMOCK_FLAG(default_mock_behavior); + int old_default_behavior = GMOCK_FLAG_GET(default_mock_behavior); const wchar_t* argv[] = {L"foo.exe", L"--gmock_verbose=info", L"--gmock_default_mock_behavior=2", nullptr}; const wchar_t* new_argv[] = {L"foo.exe", nullptr}; TestInitGoogleMock(argv, new_argv, "info"); - EXPECT_EQ(2, GMOCK_FLAG(default_mock_behavior)); + EXPECT_EQ(2, GMOCK_FLAG_GET(default_mock_behavior)); EXPECT_NE(2, old_default_behavior); - GMOCK_FLAG(default_mock_behavior) = old_default_behavior; + GMOCK_FLAG_SET(default_mock_behavior, old_default_behavior); } TEST(InitGoogleMockTest, ParsesUnrecognizedFlag) { @@ -105,7 +103,7 @@ TEST(InitGoogleMockTest, ParsesUnrecognizedFlag) { const char* new_argv[] = {"foo.exe", "--non_gmock_flag=blah", nullptr}; - TestInitGoogleMock(argv, new_argv, GMOCK_FLAG(verbose)); + TestInitGoogleMock(argv, new_argv, GMOCK_FLAG_GET(verbose)); } TEST(InitGoogleMockTest, ParsesGoogleMockFlagAndUnrecognizedFlag) { @@ -122,7 +120,7 @@ TEST(WideInitGoogleMockTest, ParsesInvalidCommandLine) { const wchar_t* new_argv[] = {nullptr}; - TestInitGoogleMock(argv, new_argv, GMOCK_FLAG(verbose)); + TestInitGoogleMock(argv, new_argv, GMOCK_FLAG_GET(verbose)); } TEST(WideInitGoogleMockTest, ParsesEmptyCommandLine) { @@ -130,7 +128,7 @@ TEST(WideInitGoogleMockTest, ParsesEmptyCommandLine) { const wchar_t* new_argv[] = {L"foo.exe", nullptr}; - TestInitGoogleMock(argv, new_argv, GMOCK_FLAG(verbose)); + TestInitGoogleMock(argv, new_argv, GMOCK_FLAG_GET(verbose)); } TEST(WideInitGoogleMockTest, ParsesSingleFlag) { @@ -142,16 +140,16 @@ TEST(WideInitGoogleMockTest, ParsesSingleFlag) { } TEST(WideInitGoogleMockTest, ParsesMultipleFlags) { - int old_default_behavior = GMOCK_FLAG(default_mock_behavior); + int old_default_behavior = GMOCK_FLAG_GET(default_mock_behavior); const wchar_t* argv[] = {L"foo.exe", L"--gmock_verbose=info", L"--gmock_default_mock_behavior=2", nullptr}; const wchar_t* new_argv[] = {L"foo.exe", nullptr}; TestInitGoogleMock(argv, new_argv, "info"); - EXPECT_EQ(2, GMOCK_FLAG(default_mock_behavior)); + EXPECT_EQ(2, GMOCK_FLAG_GET(default_mock_behavior)); EXPECT_NE(2, old_default_behavior); - GMOCK_FLAG(default_mock_behavior) = old_default_behavior; + GMOCK_FLAG_SET(default_mock_behavior, old_default_behavior); } TEST(WideInitGoogleMockTest, ParsesUnrecognizedFlag) { @@ -159,7 +157,7 @@ TEST(WideInitGoogleMockTest, ParsesUnrecognizedFlag) { const wchar_t* new_argv[] = {L"foo.exe", L"--non_gmock_flag=blah", nullptr}; - TestInitGoogleMock(argv, new_argv, GMOCK_FLAG(verbose)); + TestInitGoogleMock(argv, new_argv, GMOCK_FLAG_GET(verbose)); } TEST(WideInitGoogleMockTest, ParsesGoogleMockFlagAndUnrecognizedFlag) { @@ -175,7 +173,7 @@ TEST(WideInitGoogleMockTest, ParsesGoogleMockFlagAndUnrecognizedFlag) { // Makes sure Google Mock flags can be accessed in code. TEST(FlagTest, IsAccessibleInCode) { - bool dummy = testing::GMOCK_FLAG(catch_leaked_mocks) && - testing::GMOCK_FLAG(verbose) == ""; + bool dummy = + GMOCK_FLAG_GET(catch_leaked_mocks) && GMOCK_FLAG_GET(verbose) == ""; (void)dummy; // Avoids the "unused local variable" warning. } |