summaryrefslogtreecommitdiffstats
path: root/googlemock/test/gmock_test.cc
diff options
context:
space:
mode:
Diffstat (limited to 'googlemock/test/gmock_test.cc')
-rw-r--r--googlemock/test/gmock_test.cc41
1 files changed, 41 insertions, 0 deletions
diff --git a/googlemock/test/gmock_test.cc b/googlemock/test/gmock_test.cc
index d8d0c57..2899534 100644
--- a/googlemock/test/gmock_test.cc
+++ b/googlemock/test/gmock_test.cc
@@ -40,6 +40,7 @@
#if !defined(GTEST_CUSTOM_INIT_GOOGLE_TEST_FUNCTION_)
+using testing::GMOCK_FLAG(default_mock_behavior);
using testing::GMOCK_FLAG(verbose);
using testing::InitGoogleMock;
@@ -103,6 +104,26 @@ TEST(InitGoogleMockTest, ParsesSingleFlag) {
TestInitGoogleMock(argv, new_argv, "info");
}
+TEST(InitGoogleMockTest, ParsesMultipleFlags) {
+ int old_default_behavior = GMOCK_FLAG(default_mock_behavior);
+ const wchar_t* argv[] = {
+ L"foo.exe",
+ L"--gmock_verbose=info",
+ L"--gmock_default_mock_behavior=2",
+ NULL
+ };
+
+ const wchar_t* new_argv[] = {
+ L"foo.exe",
+ NULL
+ };
+
+ TestInitGoogleMock(argv, new_argv, "info");
+ EXPECT_EQ(2, GMOCK_FLAG(default_mock_behavior));
+ EXPECT_NE(2, old_default_behavior);
+ GMOCK_FLAG(default_mock_behavior) = old_default_behavior;
+}
+
TEST(InitGoogleMockTest, ParsesUnrecognizedFlag) {
const char* argv[] = {
"foo.exe",
@@ -177,6 +198,26 @@ TEST(WideInitGoogleMockTest, ParsesSingleFlag) {
TestInitGoogleMock(argv, new_argv, "info");
}
+TEST(WideInitGoogleMockTest, ParsesMultipleFlags) {
+ int old_default_behavior = GMOCK_FLAG(default_mock_behavior);
+ const wchar_t* argv[] = {
+ L"foo.exe",
+ L"--gmock_verbose=info",
+ L"--gmock_default_mock_behavior=2",
+ NULL
+ };
+
+ const wchar_t* new_argv[] = {
+ L"foo.exe",
+ NULL
+ };
+
+ TestInitGoogleMock(argv, new_argv, "info");
+ EXPECT_EQ(2, GMOCK_FLAG(default_mock_behavior));
+ EXPECT_NE(2, old_default_behavior);
+ GMOCK_FLAG(default_mock_behavior) = old_default_behavior;
+}
+
TEST(WideInitGoogleMockTest, ParsesUnrecognizedFlag) {
const wchar_t* argv[] = {
L"foo.exe",