|
|
|
@ -48,6 +48,13 @@ GMOCK_DEFINE_string_(verbose, internal::kWarningVerbosity, |
|
|
|
|
" warning - prints warnings and errors.\n" |
|
|
|
|
" error - prints errors only."); |
|
|
|
|
|
|
|
|
|
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."); |
|
|
|
|
|
|
|
|
|
namespace internal { |
|
|
|
|
|
|
|
|
|
// Parses a string as a command line flag. The string should have the
|
|
|
|
@ -120,6 +127,19 @@ static bool ParseGoogleMockStringFlag(const char* str, const char* flag, |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static bool ParseGoogleMockIntFlag(const char* str, const char* flag, |
|
|
|
|
int* value) { |
|
|
|
|
// Gets the value of the flag as a string.
|
|
|
|
|
const char* const value_str = ParseGoogleMockFlagValue(str, flag, true); |
|
|
|
|
|
|
|
|
|
// Aborts if the parsing failed.
|
|
|
|
|
if (value_str == NULL) return false; |
|
|
|
|
|
|
|
|
|
// Sets *value to the value of the flag.
|
|
|
|
|
*value = atoi(value_str); |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// The internal implementation of InitGoogleMock().
|
|
|
|
|
//
|
|
|
|
|
// The type parameter CharType can be instantiated to either char or
|
|
|
|
@ -138,7 +158,9 @@ void InitGoogleMockImpl(int* argc, CharType** argv) { |
|
|
|
|
// Do we see a Google Mock flag?
|
|
|
|
|
if (ParseGoogleMockBoolFlag(arg, "catch_leaked_mocks", |
|
|
|
|
&GMOCK_FLAG(catch_leaked_mocks)) || |
|
|
|
|
ParseGoogleMockStringFlag(arg, "verbose", &GMOCK_FLAG(verbose))) { |
|
|
|
|
ParseGoogleMockStringFlag(arg, "verbose", &GMOCK_FLAG(verbose)) || |
|
|
|
|
ParseGoogleMockIntFlag(arg, "default_mock_behavior", |
|
|
|
|
&GMOCK_FLAG(default_mock_behavior))) { |
|
|
|
|
// Yes. Shift the remainder of the argv list left by one. Note
|
|
|
|
|
// that argv has (*argc + 1) elements, the last one always being
|
|
|
|
|
// NULL. The following loop moves the trailing NULL element as
|
|
|
|
|