41#if !defined(GTEST_CUSTOM_INIT_GOOGLE_TEST_FUNCTION_)
47template <
typename Char,
int M,
int N>
49 const ::std::string& expected_gmock_verbose) {
53 InitGoogleMock(&argc,
const_cast<Char**
>(argv));
54 ASSERT_EQ(N - 1, argc) <<
"The new argv has wrong number of elements.";
56 for (
int i = 0;
i < N;
i++) {
64TEST(InitGoogleMockTest, ParsesInvalidCommandLine) {
65 const char* argv[] = {
nullptr};
67 const char* new_argv[] = {
nullptr};
72TEST(InitGoogleMockTest, ParsesEmptyCommandLine) {
73 const char* argv[] = {
"foo.exe",
nullptr};
75 const char* new_argv[] = {
"foo.exe",
nullptr};
80TEST(InitGoogleMockTest, ParsesSingleFlag) {
81 const char* argv[] = {
"foo.exe",
"--gmock_verbose=info",
nullptr};
83 const char* new_argv[] = {
"foo.exe",
nullptr};
88TEST(InitGoogleMockTest, ParsesMultipleFlags) {
90 const wchar_t* argv[] = {L
"foo.exe", L
"--gmock_verbose=info",
91 L
"--gmock_default_mock_behavior=2",
nullptr};
93 const wchar_t* new_argv[] = {L
"foo.exe",
nullptr};
101TEST(InitGoogleMockTest, ParsesUnrecognizedFlag) {
102 const char* argv[] = {
"foo.exe",
"--non_gmock_flag=blah",
nullptr};
104 const char* new_argv[] = {
"foo.exe",
"--non_gmock_flag=blah",
nullptr};
109TEST(InitGoogleMockTest, ParsesGoogleMockFlagAndUnrecognizedFlag) {
110 const char* argv[] = {
"foo.exe",
"--non_gmock_flag=blah",
111 "--gmock_verbose=error",
nullptr};
113 const char* new_argv[] = {
"foo.exe",
"--non_gmock_flag=blah",
nullptr};
118TEST(WideInitGoogleMockTest, ParsesInvalidCommandLine) {
119 const wchar_t* argv[] = {
nullptr};
121 const wchar_t* new_argv[] = {
nullptr};
126TEST(WideInitGoogleMockTest, ParsesEmptyCommandLine) {
127 const wchar_t* argv[] = {L
"foo.exe",
nullptr};
129 const wchar_t* new_argv[] = {L
"foo.exe",
nullptr};
134TEST(WideInitGoogleMockTest, ParsesSingleFlag) {
135 const wchar_t* argv[] = {L
"foo.exe", L
"--gmock_verbose=info",
nullptr};
137 const wchar_t* new_argv[] = {L
"foo.exe",
nullptr};
142TEST(WideInitGoogleMockTest, ParsesMultipleFlags) {
144 const wchar_t* argv[] = {L
"foo.exe", L
"--gmock_verbose=info",
145 L
"--gmock_default_mock_behavior=2",
nullptr};
147 const wchar_t* new_argv[] = {L
"foo.exe",
nullptr};
155TEST(WideInitGoogleMockTest, ParsesUnrecognizedFlag) {
156 const wchar_t* argv[] = {L
"foo.exe", L
"--non_gmock_flag=blah",
nullptr};
158 const wchar_t* new_argv[] = {L
"foo.exe", L
"--non_gmock_flag=blah",
nullptr};
163TEST(WideInitGoogleMockTest, ParsesGoogleMockFlagAndUnrecognizedFlag) {
164 const wchar_t* argv[] = {L
"foo.exe", L
"--non_gmock_flag=blah",
165 L
"--gmock_verbose=error",
nullptr};
167 const wchar_t* new_argv[] = {L
"foo.exe", L
"--non_gmock_flag=blah",
nullptr};
175TEST(FlagTest, IsAccessibleInCode) {
int i
Definition gmock-matchers-comparisons_test.cc:603
#define GMOCK_FLAG_GET(name)
Definition gmock-port.h:134
#define GMOCK_FLAG_SET(name, value)
Definition gmock-port.h:135
void TestInitGoogleMock(const Char *(&argv)[M], const Char *(&new_argv)[N], const ::std::string &expected_gmock_verbose)
Definition gmock_test.cc:48
#define ASSERT_EQ(val1, val2)
Definition gtest.h:1898
#define EXPECT_EQ(val1, val2)
Definition gtest.h:1868
#define EXPECT_NE(val1, val2)
Definition gtest.h:1870
#define TEST(test_suite_name, test_name)
Definition gtest.h:2176
#define EXPECT_STREQ(s1, s2)
Definition gtest.h:1937
GTEST_API_ void InitGoogleMock()
Definition gmock.cc:215