aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAbseil Team <absl-team@google.com>2023-09-18 03:17:14 -0700
committerCopybara-Service <copybara-worker@google.com>2023-09-18 03:20:19 -0700
commit8be20cce6931433c8bc3124beea91922cd621423 (patch)
tree631637e850a39edab44c6ed85085f91704dc16ff
parentd1467f5813f4d363cfd11aba99c4e9fe47a85e99 (diff)
downloadgoogletest-8be20cce6931433c8bc3124beea91922cd621423.tar.gz
Use the `empty()` method to check for emptiness instead of `length()`
PiperOrigin-RevId: 566247438 Change-Id: I8199ef53310a057abbe23f8f4295507b60d6b707
-rw-r--r--googletest/src/gtest-filepath.cc2
-rw-r--r--googletest/src/gtest.cc2
2 files changed, 2 insertions, 2 deletions
diff --git a/googletest/src/gtest-filepath.cc b/googletest/src/gtest-filepath.cc
index 513e947f..902d8c7f 100644
--- a/googletest/src/gtest-filepath.cc
+++ b/googletest/src/gtest-filepath.cc
@@ -336,7 +336,7 @@ bool FilePath::CreateDirectoriesRecursively() const {
return false;
}
- if (pathname_.length() == 0 || this->DirectoryExists()) {
+ if (pathname_.empty() || this->DirectoryExists()) {
return true;
}
diff --git a/googletest/src/gtest.cc b/googletest/src/gtest.cc
index 62dfef66..99b22ed3 100644
--- a/googletest/src/gtest.cc
+++ b/googletest/src/gtest.cc
@@ -5400,7 +5400,7 @@ void UnitTest::RecordProperty(const std::string& key,
int UnitTest::Run() {
#ifdef GTEST_HAS_DEATH_TEST
const bool in_death_test_child_process =
- GTEST_FLAG_GET(internal_run_death_test).length() > 0;
+ !GTEST_FLAG_GET(internal_run_death_test).empty();
// Google Test implements this protocol for catching that a test
// program exits before returning control to Google Test: