summaryrefslogtreecommitdiffstats
path: root/googletest/test/gtest-unittest-api_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 /googletest/test/gtest-unittest-api_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 'googletest/test/gtest-unittest-api_test.cc')
-rw-r--r--googletest/test/gtest-unittest-api_test.cc12
1 files changed, 6 insertions, 6 deletions
diff --git a/googletest/test/gtest-unittest-api_test.cc b/googletest/test/gtest-unittest-api_test.cc
index f3ea03a..7898286 100644
--- a/googletest/test/gtest-unittest-api_test.cc
+++ b/googletest/test/gtest-unittest-api_test.cc
@@ -76,7 +76,7 @@ class UnitTestHelper {
if (0 == strcmp(test_case->name(), name))
return test_case;
}
- return NULL;
+ return nullptr;
}
// Returns the array of pointers to all tests in a particular test case
@@ -137,7 +137,7 @@ TEST(ApiTest, UnitTestImmutableAccessorsWork) {
}
AssertionResult IsNull(const char* str) {
- if (str != NULL) {
+ if (str != nullptr) {
return testing::AssertionFailure() << "argument is " << str;
}
return AssertionSuccess();
@@ -145,7 +145,7 @@ AssertionResult IsNull(const char* str) {
TEST(ApiTest, TestCaseImmutableAccessorsWork) {
const TestCase* test_case = UnitTestHelper::FindTestCase("ApiTest");
- ASSERT_TRUE(test_case != NULL);
+ ASSERT_TRUE(test_case != nullptr);
EXPECT_STREQ("ApiTest", test_case->name());
EXPECT_TRUE(IsNull(test_case->type_param()));
@@ -181,11 +181,11 @@ TEST(ApiTest, TestCaseImmutableAccessorsWork) {
EXPECT_TRUE(tests[3]->should_run());
delete[] tests;
- tests = NULL;
+ tests = nullptr;
#if GTEST_HAS_TYPED_TEST
test_case = UnitTestHelper::FindTestCase("TestCaseWithCommentTest/0");
- ASSERT_TRUE(test_case != NULL);
+ ASSERT_TRUE(test_case != nullptr);
EXPECT_STREQ("TestCaseWithCommentTest/0", test_case->name());
EXPECT_STREQ(GetTypeName<int>().c_str(), test_case->type_param());
@@ -208,7 +208,7 @@ TEST(ApiTest, TestCaseImmutableAccessorsWork) {
TEST(ApiTest, TestCaseDisabledAccessorsWork) {
const TestCase* test_case = UnitTestHelper::FindTestCase("DISABLED_Test");
- ASSERT_TRUE(test_case != NULL);
+ ASSERT_TRUE(test_case != nullptr);
EXPECT_STREQ("DISABLED_Test", test_case->name());
EXPECT_TRUE(IsNull(test_case->type_param()));