[libcxx-commits] [libcxx] b03ea05 - [libc++] NFC: Minor refactoring in filesystem_test_helper.h to ease readability
Louis Dionne via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Oct 26 13:34:31 PDT 2020
Author: Louis Dionne
Date: 2020-10-26T16:34:20-04:00
New Revision: b03ea054db1bcf9452b3a70e21d3372b6e58759a
URL: https://github.com/llvm/llvm-project/commit/b03ea054db1bcf9452b3a70e21d3372b6e58759a
DIFF: https://github.com/llvm/llvm-project/commit/b03ea054db1bcf9452b3a70e21d3372b6e58759a.diff
LOG: [libc++] NFC: Minor refactoring in filesystem_test_helper.h to ease readability
The variable declarations interleaved with logic was really difficult
to read. Instead, simply have two different implementations for _WIN32
and others.
Added:
Modified:
libcxx/test/support/filesystem_test_helper.h
Removed:
################################################################################
diff --git a/libcxx/test/support/filesystem_test_helper.h b/libcxx/test/support/filesystem_test_helper.h
index 7c3a6fc0e645..2841b67fde95 100644
--- a/libcxx/test/support/filesystem_test_helper.h
+++ b/libcxx/test/support/filesystem_test_helper.h
@@ -139,16 +139,17 @@ struct scoped_test_env
~scoped_test_env() {
#ifdef _WIN32
std::string cmd = "rmdir /s /q " + test_root.string();
- int ret;
+ int ret = std::system(cmd.c_str());
+ assert(ret == 0);
#else
std::string cmd = "chmod -R 777 " + test_root.string();
int ret = std::system(cmd.c_str());
assert(ret == 0);
cmd = "rm -r " + test_root.string();
-#endif
ret = std::system(cmd.c_str());
assert(ret == 0);
+#endif
}
scoped_test_env(scoped_test_env const &) = delete;
More information about the libcxx-commits
mailing list