MCPcopy Create free account
hub / github.com/boostorg/filesystem / test_copy_errors

Function test_copy_errors

test/copy_test.cpp:263–288  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

261}
262
263void test_copy_errors(fs::path const& root_dir, bool symlinks_supported)
264{
265 std::cout << "test_copy_errors" << std::endl;
266
267 fs::path target_dir = fs::unique_path();
268 fs::create_directory(target_dir);
269
270 BOOST_TEST_THROWS(fs::copy(root_dir / "non-existing", target_dir), fs::filesystem_error);
271
272 create_file(target_dir / "f1");
273
274 BOOST_TEST_THROWS(fs::copy(root_dir / "f1", target_dir), fs::filesystem_error);
275 BOOST_TEST_THROWS(fs::copy(root_dir / "f1", target_dir / "f1"), fs::filesystem_error);
276 BOOST_TEST_THROWS(fs::copy(root_dir / "d1", target_dir / "f1"), fs::filesystem_error);
277
278 BOOST_TEST_THROWS(fs::copy(target_dir, target_dir), fs::filesystem_error);
279 BOOST_TEST_THROWS(fs::copy(target_dir / "f1", target_dir / "f1"), fs::filesystem_error);
280
281 if (symlinks_supported)
282 {
283 // Should fail with is_a_directory error code
284 BOOST_TEST_THROWS(fs::copy(root_dir, target_dir, fs::copy_options::create_symlinks), fs::filesystem_error);
285 }
286
287 fs::remove_all(target_dir);
288}
289
290} // namespace
291

Callers 1

mainFunction · 0.85

Calls 5

create_fileFunction · 0.70
unique_pathFunction · 0.50
create_directoryFunction · 0.50
copyFunction · 0.50
remove_allFunction · 0.50

Tested by

no test coverage detected