diff --git a/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.temp_dir_path/temp_directory_path.pass.cpp b/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.temp_dir_path/temp_directory_path.pass.cpp --- a/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.temp_dir_path/temp_directory_path.pass.cpp +++ b/libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.temp_dir_path/temp_directory_path.pass.cpp @@ -55,10 +55,16 @@ std::string name; path p; } cases[] = { +#ifdef _WIN32 + {"TMP", env.create_dir("dir2")}, + {"TEMP", env.create_dir("dir3")}, + {"USERPROFILE", env.create_dir("dir4")} +#else {"TMPDIR", env.create_dir("dir1")}, {"TMP", env.create_dir("dir2")}, {"TEMP", env.create_dir("dir3")}, {"TEMPDIR", env.create_dir("dir4")} +#endif }; for (auto& TC : cases) { PutEnv(TC.name, TC.p); @@ -112,7 +118,10 @@ std::error_code ec = GetTestEC(); path ret = temp_directory_path(ec); TEST_CHECK(!ec); +#ifndef _WIN32 + // On Windows, the function falls back to C:\Windows instead. TEST_CHECK(ret == "/tmp"); +#endif TEST_CHECK(is_directory(ret)); } }