Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions tests/std/tests/P0218R1_filesystem/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2248,6 +2248,26 @@ void test_copy_symlink() {
}
}

void test_copy_directory_as_symlink() {
const path dirpath{L"./test-lwg2682-dir"sv};
error_code ec;
create_directory(dirpath, ec);
EXPECT(good(ec));
try {
copy(dirpath, L"./symlink"sv, copy_options::create_symlinks);
EXPECT(false);
} catch (filesystem_error& e) {
EXPECT(e.code().value() == static_cast<int>(errc::is_a_directory));
}
{
error_code copy_ec;
copy(dirpath, L"./symlink"sv, copy_options::create_symlinks, copy_ec);
EXPECT(copy_ec.value() == static_cast<int>(errc::is_a_directory));
}
remove_all(dirpath, ec);
EXPECT(good(ec));
}

void equivalent_failure_test_case(const path& left, const path& right) {
EXPECT(throws_filesystem_error([&] { EXPECT(!equivalent(left, right)); }, "equivalent", left, right));

Expand Down Expand Up @@ -3997,6 +4017,8 @@ int wmain(int argc, wchar_t* argv[]) {

test_copy_symlink();

test_copy_directory_as_symlink(); // per LWG-2682

test_conversions();

test_file_size();
Expand Down