Skip to content

Commit 4c402ae

Browse files
committed
[libcxx] [test] Don't leave test dirs behind in fs.op.current_path on Windows
Fix nesting of static_env and CWDGuard, restore the cwd (with CWDGuard) before cleaning up the static_env. Previously, every test run left 2 directories behind in the temp dir. Differential Revision: https://reviews.llvm.org/D98954
1 parent eb26afb commit 4c402ae

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.current_path/current_path.pass.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -51,17 +51,17 @@ TEST_CASE(current_path_test)
5151

5252
TEST_CASE(current_path_after_change_test)
5353
{
54-
CWDGuard guard;
5554
static_test_env static_env;
55+
CWDGuard guard;
5656
const path new_path = static_env.Dir;
5757
current_path(new_path);
5858
TEST_CHECK(current_path() == new_path);
5959
}
6060

6161
TEST_CASE(current_path_is_file_test)
6262
{
63-
CWDGuard guard;
6463
static_test_env static_env;
64+
CWDGuard guard;
6565
const path p = static_env.File;
6666
std::error_code ec;
6767
const path old_p = current_path();
@@ -72,8 +72,8 @@ TEST_CASE(current_path_is_file_test)
7272

7373
TEST_CASE(set_to_non_absolute_path)
7474
{
75-
CWDGuard guard;
7675
static_test_env static_env;
76+
CWDGuard guard;
7777
const path base = static_env.Dir;
7878
current_path(base);
7979
const path p = static_env.Dir2.filename();

0 commit comments

Comments
 (0)