summaryrefslogtreecommitdiff
path: root/googletest
diff options
context:
space:
mode:
authorAbseil Team <absl-team@google.com>2023-02-14 08:32:59 -0800
committerCopybara-Service <copybara-worker@google.com>2023-02-14 08:33:42 -0800
commit2057566e4e16c88f1fea4d6c96b2e2bfb87507a6 (patch)
treec4cf9bf2769074c39b5153097a5a1da4972d6668 /googletest
parentb80a07ffe627b20781516f51c548367d1e4d57dd (diff)
downloadgoogletest-git-2057566e4e16c88f1fea4d6c96b2e2bfb87507a6.tar.gz
Remove some filesystem APIs and tests under !GTEST_HAS_FILE_SYSTEM
PiperOrigin-RevId: 509537606 Change-Id: I68f7054e34b1fe76c1fd85099fffa4ee3c2b00c0
Diffstat (limited to 'googletest')
-rw-r--r--googletest/src/gtest.cc7
-rw-r--r--googletest/test/gtest_dirs_test.cc4
2 files changed, 10 insertions, 1 deletions
diff --git a/googletest/src/gtest.cc b/googletest/src/gtest.cc
index f79f915f..a60a042c 100644
--- a/googletest/src/gtest.cc
+++ b/googletest/src/gtest.cc
@@ -2325,7 +2325,9 @@ static std::vector<std::string> GetReservedAttributesForElement(
return std::vector<std::string>();
}
+#if GTEST_HAS_FILE_SYSTEM
// TODO(jdesprez): Merge the two getReserved attributes once skip is improved
+// This function is only used when file systems are enabled.
static std::vector<std::string> GetReservedOutputAttributesForElement(
const std::string& xml_element) {
if (xml_element == "testsuites") {
@@ -2340,6 +2342,7 @@ static std::vector<std::string> GetReservedOutputAttributesForElement(
// This code is unreachable but some compilers may not realizes that.
return std::vector<std::string>();
}
+#endif
static std::string FormatWordList(const std::vector<std::string>& words) {
Message word_list;
@@ -6802,7 +6805,7 @@ std::string TempDir() {
#endif
}
-#if !defined(GTEST_CUSTOM_SRCDIR_FUNCTION_)
+#if GTEST_HAS_FILE_SYSTEM && !defined(GTEST_CUSTOM_SRCDIR_FUNCTION_)
// Returns the directory path (including terminating separator) of the current
// executable as derived from argv[0].
static std::string GetCurrentExecutableDirectory() {
@@ -6811,6 +6814,7 @@ static std::string GetCurrentExecutableDirectory() {
}
#endif
+#if GTEST_HAS_FILE_SYSTEM
std::string SrcDir() {
#if defined(GTEST_CUSTOM_SRCDIR_FUNCTION_)
return GTEST_CUSTOM_SRCDIR_FUNCTION_();
@@ -6825,6 +6829,7 @@ std::string SrcDir() {
'/');
#endif
}
+#endif
// Class ScopedTrace
diff --git a/googletest/test/gtest_dirs_test.cc b/googletest/test/gtest_dirs_test.cc
index c0da9ac4..1a5b63d3 100644
--- a/googletest/test/gtest_dirs_test.cc
+++ b/googletest/test/gtest_dirs_test.cc
@@ -7,6 +7,8 @@
#include "gtest/gtest.h"
#include "gtest/internal/gtest-port.h"
+#if GTEST_HAS_FILE_SYSTEM
+
namespace {
class SetEnv {
@@ -94,4 +96,6 @@ TEST(SrcDirTest, NotInEnvironment) {
EXPECT_NE(testing::SrcDir(), "");
}
+#endif // GTEST_HAS_FILE_SYSTEM
+
} // namespace