37 "true if and only if Google Mock should report leaked "
38 "mock objects as failures.");
41 "Controls how verbose Google Mock's output is."
43 " info - prints all messages.\n"
44 " warning - prints warnings and errors.\n"
45 " error - prints errors only.");
48 "Controls the default behavior of mocks."
50 " 0 - by default, mocks act as NiceMocks.\n"
51 " 1 - by default, mocks act as NaggyMocks.\n"
52 " 2 - by default, mocks act as StrictMocks.");
65 if (str ==
nullptr || flag ==
nullptr)
return nullptr;
68 const std::string flag_str = std::string(
"--gmock_") + flag;
69 const size_t flag_len = flag_str.length();
70 if (strncmp(str, flag_str.c_str(), flag_len) != 0)
return nullptr;
73 const char* flag_end = str + flag_len;
76 if (def_optional && (flag_end[0] ==
'\0')) {
83 if (flag_end[0] !=
'=')
return nullptr;
100 if (value_str ==
nullptr)
return false;
103 *value = !(*value_str ==
'0' || *value_str ==
'f' || *value_str ==
'F');
112 template <
typename String>
119 if (value_str ==
nullptr)
return false;
132 if (value_str ==
nullptr)
return false;
143 template <
typename CharType>
148 if (*argc <= 0)
return;
150 for (
int i = 1;
i != *argc;
i++) {
152 const char*
const arg = arg_string.c_str();
164 for (
int j = i; j != *argc; j++) {
165 argv[j] = argv[j + 1];
206 const auto arg0 =
"dummy";
207 char* argv0 =
const_cast<char*
>(arg0);
208 char** argv = &argv0;
GTEST_API_ void InitGoogleMock(int *argc, char **argv)
const char kWarningVerbosity[]
std::string StreamableToString(const T &streamable)
GTEST_API_ bool ParseInt32(const Message &src_text, const char *str, int32_t *value)
static bool ParseGoogleMockBoolFlag(const char *str, const char *flag, bool *value)
static bool ParseGoogleMockIntFlag(const char *str, const char *flag, int32_t *value)
void InitGoogleMockImpl(int *argc, CharType **argv)
GMOCK_DEFINE_string_(verbose, internal::kWarningVerbosity,"Controls how verbose Google Mock's output is."" Valid values:\n"" info - prints all messages.\n"" warning - prints warnings and errors.\n"" error - prints errors only.")
static const char * ParseGoogleMockFlagValue(const char *str, const char *flag, bool def_optional)
GTEST_API_ void InitGoogleTest(int *argc, char **argv)
static bool ParseGoogleMockStringFlag(const char *str, const char *flag, String *value)
GMOCK_DEFINE_int32_(default_mock_behavior, 1,"Controls the default behavior of mocks."" Valid values:\n"" 0 - by default, mocks act as NiceMocks.\n"" 1 - by default, mocks act as NaggyMocks.\n"" 2 - by default, mocks act as StrictMocks.")
GMOCK_DEFINE_bool_(catch_leaked_mocks, true,"true if and only if Google Mock should report leaked ""mock objects as failures.")