| 261 | } |
| 262 | |
| 263 | void 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 |
no test coverage detected