summaryrefslogtreecommitdiffstats
path: root/googlemock/test/gmock_test.cc
diff options
context:
space:
mode:
authorAbseil Team <absl-team@google.com>2018-10-04 22:28:05 (GMT)
committerGennadiy Civil <misterg@google.com>2018-10-05 16:54:14 (GMT)
commit4bb49ed640e34e23187ad7ea689693ef9927033f (patch)
tree31bfca77d3e46134fddebe28118bcba3af711e45 /googlemock/test/gmock_test.cc
parentf13bbe2992d188e834339abe6f715b2b2f840a77 (diff)
downloadgoogletest-4bb49ed640e34e23187ad7ea689693ef9927033f.zip
googletest-4bb49ed640e34e23187ad7ea689693ef9927033f.tar.gz
googletest-4bb49ed640e34e23187ad7ea689693ef9927033f.tar.bz2
Apply clang-tidy modernize-use-nullptr to googletest.
Now that googletest has moved to C++11, it should no longer use NULL or 0 for the null pointer. This patch converts all such usages to nullptr using clang-tidy. This prevents LLVM from issuing -Wzero-as-null-pointer-constant warnings. PiperOrigin-RevId: 215814400
Diffstat (limited to 'googlemock/test/gmock_test.cc')
-rw-r--r--googlemock/test/gmock_test.cc148
1 files changed, 34 insertions, 114 deletions
diff --git a/googlemock/test/gmock_test.cc b/googlemock/test/gmock_test.cc
index 341a17d..e9840a3 100644
--- a/googlemock/test/gmock_test.cc
+++ b/googlemock/test/gmock_test.cc
@@ -64,59 +64,35 @@ void TestInitGoogleMock(const Char* (&argv)[M], const Char* (&new_argv)[N],
}
TEST(InitGoogleMockTest, ParsesInvalidCommandLine) {
- const char* argv[] = {
- NULL
- };
+ const char* argv[] = {nullptr};
- const char* new_argv[] = {
- NULL
- };
+ const char* new_argv[] = {nullptr};
TestInitGoogleMock(argv, new_argv, GMOCK_FLAG(verbose));
}
TEST(InitGoogleMockTest, ParsesEmptyCommandLine) {
- const char* argv[] = {
- "foo.exe",
- NULL
- };
+ const char* argv[] = {"foo.exe", nullptr};
- const char* new_argv[] = {
- "foo.exe",
- NULL
- };
+ const char* new_argv[] = {"foo.exe", nullptr};
TestInitGoogleMock(argv, new_argv, GMOCK_FLAG(verbose));
}
TEST(InitGoogleMockTest, ParsesSingleFlag) {
- const char* argv[] = {
- "foo.exe",
- "--gmock_verbose=info",
- NULL
- };
+ const char* argv[] = {"foo.exe", "--gmock_verbose=info", nullptr};
- const char* new_argv[] = {
- "foo.exe",
- NULL
- };
+ const char* new_argv[] = {"foo.exe", nullptr};
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
- };
+ const wchar_t* argv[] = {L"foo.exe", L"--gmock_verbose=info",
+ L"--gmock_default_mock_behavior=2", nullptr};
+
+ const wchar_t* new_argv[] = {L"foo.exe", nullptr};
TestInitGoogleMock(argv, new_argv, "info");
EXPECT_EQ(2, GMOCK_FLAG(default_mock_behavior));
@@ -125,92 +101,52 @@ TEST(InitGoogleMockTest, ParsesMultipleFlags) {
}
TEST(InitGoogleMockTest, ParsesUnrecognizedFlag) {
- const char* argv[] = {
- "foo.exe",
- "--non_gmock_flag=blah",
- NULL
- };
-
- const char* new_argv[] = {
- "foo.exe",
- "--non_gmock_flag=blah",
- NULL
- };
+ const char* argv[] = {"foo.exe", "--non_gmock_flag=blah", nullptr};
+
+ const char* new_argv[] = {"foo.exe", "--non_gmock_flag=blah", nullptr};
TestInitGoogleMock(argv, new_argv, GMOCK_FLAG(verbose));
}
TEST(InitGoogleMockTest, ParsesGoogleMockFlagAndUnrecognizedFlag) {
- const char* argv[] = {
- "foo.exe",
- "--non_gmock_flag=blah",
- "--gmock_verbose=error",
- NULL
- };
-
- const char* new_argv[] = {
- "foo.exe",
- "--non_gmock_flag=blah",
- NULL
- };
+ const char* argv[] = {"foo.exe", "--non_gmock_flag=blah",
+ "--gmock_verbose=error", nullptr};
+
+ const char* new_argv[] = {"foo.exe", "--non_gmock_flag=blah", nullptr};
TestInitGoogleMock(argv, new_argv, "error");
}
TEST(WideInitGoogleMockTest, ParsesInvalidCommandLine) {
- const wchar_t* argv[] = {
- NULL
- };
+ const wchar_t* argv[] = {nullptr};
- const wchar_t* new_argv[] = {
- NULL
- };
+ const wchar_t* new_argv[] = {nullptr};
TestInitGoogleMock(argv, new_argv, GMOCK_FLAG(verbose));
}
TEST(WideInitGoogleMockTest, ParsesEmptyCommandLine) {
- const wchar_t* argv[] = {
- L"foo.exe",
- NULL
- };
+ const wchar_t* argv[] = {L"foo.exe", nullptr};
- const wchar_t* new_argv[] = {
- L"foo.exe",
- NULL
- };
+ const wchar_t* new_argv[] = {L"foo.exe", nullptr};
TestInitGoogleMock(argv, new_argv, GMOCK_FLAG(verbose));
}
TEST(WideInitGoogleMockTest, ParsesSingleFlag) {
- const wchar_t* argv[] = {
- L"foo.exe",
- L"--gmock_verbose=info",
- NULL
- };
+ const wchar_t* argv[] = {L"foo.exe", L"--gmock_verbose=info", nullptr};
- const wchar_t* new_argv[] = {
- L"foo.exe",
- NULL
- };
+ const wchar_t* new_argv[] = {L"foo.exe", nullptr};
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
- };
+ const wchar_t* argv[] = {L"foo.exe", L"--gmock_verbose=info",
+ L"--gmock_default_mock_behavior=2", nullptr};
+
+ const wchar_t* new_argv[] = {L"foo.exe", nullptr};
TestInitGoogleMock(argv, new_argv, "info");
EXPECT_EQ(2, GMOCK_FLAG(default_mock_behavior));
@@ -219,34 +155,18 @@ TEST(WideInitGoogleMockTest, ParsesMultipleFlags) {
}
TEST(WideInitGoogleMockTest, ParsesUnrecognizedFlag) {
- const wchar_t* argv[] = {
- L"foo.exe",
- L"--non_gmock_flag=blah",
- NULL
- };
-
- const wchar_t* new_argv[] = {
- L"foo.exe",
- L"--non_gmock_flag=blah",
- NULL
- };
+ const wchar_t* argv[] = {L"foo.exe", L"--non_gmock_flag=blah", nullptr};
+
+ const wchar_t* new_argv[] = {L"foo.exe", L"--non_gmock_flag=blah", nullptr};
TestInitGoogleMock(argv, new_argv, GMOCK_FLAG(verbose));
}
TEST(WideInitGoogleMockTest, ParsesGoogleMockFlagAndUnrecognizedFlag) {
- const wchar_t* argv[] = {
- L"foo.exe",
- L"--non_gmock_flag=blah",
- L"--gmock_verbose=error",
- NULL
- };
-
- const wchar_t* new_argv[] = {
- L"foo.exe",
- L"--non_gmock_flag=blah",
- NULL
- };
+ const wchar_t* argv[] = {L"foo.exe", L"--non_gmock_flag=blah",
+ L"--gmock_verbose=error", nullptr};
+
+ const wchar_t* new_argv[] = {L"foo.exe", L"--non_gmock_flag=blah", nullptr};
TestInitGoogleMock(argv, new_argv, "error");
}