summaryrefslogtreecommitdiffstats
path: root/libcxx/test/std/experimental/filesystem
diff options
context:
space:
mode:
authorEric Fiselier <eric@efcs.ca>2018-02-04 02:43:32 +0000
committerEric Fiselier <eric@efcs.ca>2018-02-04 02:43:32 +0000
commit0f8c8f59df057a85d6d49913ec9877c6d597785b (patch)
treeb00dc4947430640171f3ac6482c33792fbe546b8 /libcxx/test/std/experimental/filesystem
parente1c661f3444f676c8cff5031810ed482c5576bbd (diff)
downloadbcm5719-llvm-0f8c8f59df057a85d6d49913ec9877c6d597785b.tar.gz
bcm5719-llvm-0f8c8f59df057a85d6d49913ec9877c6d597785b.zip
Address LWG 2849 and fix missing failure condition in copy_file.
Previously copy_file didn't handle the case where the input and output were the same file. llvm-svn: 324187
Diffstat (limited to 'libcxx/test/std/experimental/filesystem')
-rw-r--r--libcxx/test/std/experimental/filesystem/fs.op.funcs/fs.op.copy_file/copy_file.pass.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/libcxx/test/std/experimental/filesystem/fs.op.funcs/fs.op.copy_file/copy_file.pass.cpp b/libcxx/test/std/experimental/filesystem/fs.op.funcs/fs.op.copy_file/copy_file.pass.cpp
index 8c5241c71af..ee2ad1c46cf 100644
--- a/libcxx/test/std/experimental/filesystem/fs.op.funcs/fs.op.copy_file/copy_file.pass.cpp
+++ b/libcxx/test/std/experimental/filesystem/fs.op.funcs/fs.op.copy_file/copy_file.pass.cpp
@@ -70,17 +70,21 @@ TEST_CASE(test_error_reporting)
scoped_test_env env;
const path file = env.create_file("file1", 42);
const path file2 = env.create_file("file2", 55);
+ const path non_regular_file = env.create_fifo("non_reg");
const path dne = env.make_env_path("dne");
{ // exists(to) && equivalent(to, from)
std::error_code ec;
- TEST_CHECK(fs::copy_file(file, file, ec) == false);
+ TEST_CHECK(fs::copy_file(file, file, copy_options::overwrite_existing,
+ ec) == false);
TEST_REQUIRE(ec);
+ TEST_CHECK(ec == std::make_error_code(std::errc::file_exists));
TEST_CHECK(checkThrow(file, file, ec));
}
{ // exists(to) && !(skip_existing | overwrite_existing | update_existing)
std::error_code ec;
TEST_CHECK(fs::copy_file(file, file2, ec) == false);
TEST_REQUIRE(ec);
+ TEST_CHECK(ec == std::make_error_code(std::errc::file_exists));
TEST_CHECK(checkThrow(file, file2, ec));
}
}
@@ -181,6 +185,7 @@ TEST_CASE(non_regular_file_test)
TEST_REQUIRE(fs::copy_file(file, fifo, copy_options::overwrite_existing, ec) == false);
TEST_CHECK(ec);
TEST_CHECK(ec != GetTestEC());
+ TEST_CHECK(ec == std::make_error_code(std::errc::not_supported));
TEST_CHECK(is_fifo(fifo));
}
}
OpenPOWER on IntegriCloud