Added tests for copy_options::synchronize(_data).

This commit is contained in:
Andrey Semashev 2021-05-17 21:52:46 +03:00
parent 59e3644803
commit e320bfaa01

View File

@ -1750,6 +1750,36 @@ void copy_file_tests(const fs::path& f1x, const fs::path& d1x)
BOOST_TEST(file_copied); BOOST_TEST(file_copied);
BOOST_TEST_EQ(fs::file_size(d1x / "f2"), 7U); BOOST_TEST_EQ(fs::file_size(d1x / "f2"), 7U);
verify_file(d1x / "f2", "file-f1"); verify_file(d1x / "f2", "file-f1");
fs::remove(d1x / "f2");
file_copied = false;
copy_ex_ok = true;
try
{
file_copied = fs::copy_file(f1x, d1x / "f2", fs::copy_options::synchronize_data);
}
catch (const fs::filesystem_error&)
{
copy_ex_ok = false;
}
BOOST_TEST(copy_ex_ok);
BOOST_TEST(file_copied);
verify_file(d1x / "f2", "file-f1");
fs::remove(d1x / "f2");
file_copied = false;
copy_ex_ok = true;
try
{
file_copied = fs::copy_file(f1x, d1x / "f2", fs::copy_options::synchronize);
}
catch (const fs::filesystem_error&)
{
copy_ex_ok = false;
}
BOOST_TEST(copy_ex_ok);
BOOST_TEST(file_copied);
verify_file(d1x / "f2", "file-f1");
} }
// symlink_status_tests -------------------------------------------------------------// // symlink_status_tests -------------------------------------------------------------//