From 2f7ceb120eb0ece24c671b27680025ffe75eae9d Mon Sep 17 00:00:00 2001 From: Saleem Abdulrasool Date: Sun, 5 Feb 2017 17:21:52 +0000 Subject: filesystem: fix n4100 conformance for `temp_directory_path` N4100 states that an error shall be reported if `!exists(p) || !is_directory(p)`. We were missing the first half of the conditional. Invert the error and normal code paths to make the code easier to follow. llvm-svn: 294127 --- .../fs.op.funcs/fs.op.temp_dir_path/temp_directory_path.pass.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'libcxx/test/std') diff --git a/libcxx/test/std/experimental/filesystem/fs.op.funcs/fs.op.temp_dir_path/temp_directory_path.pass.cpp b/libcxx/test/std/experimental/filesystem/fs.op.funcs/fs.op.temp_dir_path/temp_directory_path.pass.cpp index 148564e6196..021dd7fc816 100644 --- a/libcxx/test/std/experimental/filesystem/fs.op.funcs/fs.op.temp_dir_path/temp_directory_path.pass.cpp +++ b/libcxx/test/std/experimental/filesystem/fs.op.funcs/fs.op.temp_dir_path/temp_directory_path.pass.cpp @@ -97,6 +97,14 @@ TEST_CASE(basic_tests) TEST_CHECK(ec == std::make_error_code(std::errc::permission_denied)); TEST_CHECK(ret == ""); + // Set the env variable to point to a non-existent dir + PutEnv(TC.name, TC.p / "does_not_exist"); + ec = GetTestEC(); + ret = temp_directory_path(ec); + TEST_CHECK(ec != GetTestEC()); + TEST_CHECK(ec); + TEST_CHECK(ret == ""); + // Finally erase this env variable UnsetEnv(TC.name); } -- cgit v1.2.3