41 #if !defined(GTEST_CUSTOM_INIT_GOOGLE_TEST_FUNCTION_)
49 template <
typename Char,
int M,
int N>
51 const ::std::string& expected_gmock_verbose) {
52 const ::std::string old_verbose =
GMOCK_FLAG(verbose);
56 ASSERT_EQ(N - 1, argc) <<
"The new argv has wrong number of elements.";
58 for (
int i = 0;
i <
N;
i++) {
66 TEST(InitGoogleMockTest, ParsesInvalidCommandLine) {
67 const char* argv[] = {
nullptr};
69 const char* new_argv[] = {
nullptr};
74 TEST(InitGoogleMockTest, ParsesEmptyCommandLine) {
75 const char* argv[] = {
"foo.exe",
nullptr};
77 const char* new_argv[] = {
"foo.exe",
nullptr};
82 TEST(InitGoogleMockTest, ParsesSingleFlag) {
83 const char* argv[] = {
"foo.exe",
"--gmock_verbose=info",
nullptr};
85 const char* new_argv[] = {
"foo.exe",
nullptr};
90 TEST(InitGoogleMockTest, ParsesMultipleFlags) {
91 int old_default_behavior =
GMOCK_FLAG(default_mock_behavior);
92 const wchar_t* argv[] = {L
"foo.exe", L
"--gmock_verbose=info",
93 L
"--gmock_default_mock_behavior=2",
nullptr};
95 const wchar_t* new_argv[] = {L
"foo.exe",
nullptr};
100 GMOCK_FLAG(default_mock_behavior) = old_default_behavior;
103 TEST(InitGoogleMockTest, ParsesUnrecognizedFlag) {
104 const char* argv[] = {
"foo.exe",
"--non_gmock_flag=blah",
nullptr};
106 const char* new_argv[] = {
"foo.exe",
"--non_gmock_flag=blah",
nullptr};
111 TEST(InitGoogleMockTest, ParsesGoogleMockFlagAndUnrecognizedFlag) {
112 const char* argv[] = {
"foo.exe",
"--non_gmock_flag=blah",
113 "--gmock_verbose=error",
nullptr};
115 const char* new_argv[] = {
"foo.exe",
"--non_gmock_flag=blah",
nullptr};
120 TEST(WideInitGoogleMockTest, ParsesInvalidCommandLine) {
121 const wchar_t* argv[] = {
nullptr};
123 const wchar_t* new_argv[] = {
nullptr};
128 TEST(WideInitGoogleMockTest, ParsesEmptyCommandLine) {
129 const wchar_t* argv[] = {L
"foo.exe",
nullptr};
131 const wchar_t* new_argv[] = {L
"foo.exe",
nullptr};
136 TEST(WideInitGoogleMockTest, ParsesSingleFlag) {
137 const wchar_t* argv[] = {L
"foo.exe", L
"--gmock_verbose=info",
nullptr};
139 const wchar_t* new_argv[] = {L
"foo.exe",
nullptr};
144 TEST(WideInitGoogleMockTest, ParsesMultipleFlags) {
145 int old_default_behavior =
GMOCK_FLAG(default_mock_behavior);
146 const wchar_t* argv[] = {L
"foo.exe", L
"--gmock_verbose=info",
147 L
"--gmock_default_mock_behavior=2",
nullptr};
149 const wchar_t* new_argv[] = {L
"foo.exe",
nullptr};
154 GMOCK_FLAG(default_mock_behavior) = old_default_behavior;
157 TEST(WideInitGoogleMockTest, ParsesUnrecognizedFlag) {
158 const wchar_t* argv[] = {L
"foo.exe", L
"--non_gmock_flag=blah",
nullptr};
160 const wchar_t* new_argv[] = {L
"foo.exe", L
"--non_gmock_flag=blah",
nullptr};
165 TEST(WideInitGoogleMockTest, ParsesGoogleMockFlagAndUnrecognizedFlag) {
166 const wchar_t* argv[] = {L
"foo.exe", L
"--non_gmock_flag=blah",
167 L
"--gmock_verbose=error",
nullptr};
169 const wchar_t* new_argv[] = {L
"foo.exe", L
"--non_gmock_flag=blah",
nullptr};
174 #endif // !defined(GTEST_CUSTOM_INIT_GOOGLE_TEST_FUNCTION_)
177 TEST(FlagTest, IsAccessibleInCode) {
void TestInitGoogleMock(const Char *(&argv)[M], const Char *(&new_argv)[N], const ::std::string &expected_gmock_verbose)
#define EXPECT_NE(val1, val2)
GTEST_API_ void InitGoogleMock(int *argc, char **argv)
#define TEST(test_suite_name, test_name)
#define ASSERT_EQ(val1, val2)
#define EXPECT_STREQ(s1, s2)
#define EXPECT_EQ(val1, val2)