Skip to content
Snippets Groups Projects
Commit a8526d28 authored by Gleb Natapov's avatar Gleb Natapov Committed by Pekka Enberg
Browse files

test: add test for renaming of opened file.

parent 3f050ee4
No related branches found
No related tags found
No related merge requests found
...@@ -91,6 +91,19 @@ static void test_rename(const fs::path& src, const fs::path& dst) ...@@ -91,6 +91,19 @@ static void test_rename(const fs::path& src, const fs::path& dst)
BOOST_CHECK_MESSAGE(fs::remove(dst), "Sould be possible to remove new file"); BOOST_CHECK_MESSAGE(fs::remove(dst), "Sould be possible to remove new file");
} }
static void test_rename_from_open_file(const fs::path& src, const fs::path& dst)
{
prepare_file(src);
fs::ifstream file(src);
assert_renames(src, dst);
check_file(dst);
BOOST_CHECK_MESSAGE(!fs::exists(src), "Old file should not exist");
BOOST_CHECK_MESSAGE(fs::remove(dst), "Sould be possible to remove new file");
}
static void test_file_rename_fails(const fs::path& src, const fs::path& dst, std::vector<int> errnos) static void test_file_rename_fails(const fs::path& src, const fs::path& dst, std::vector<int> errnos)
{ {
prepare_file(src); prepare_file(src);
...@@ -107,6 +120,10 @@ BOOST_AUTO_TEST_CASE(test_renaming_in_the_same_directory) ...@@ -107,6 +120,10 @@ BOOST_AUTO_TEST_CASE(test_renaming_in_the_same_directory)
dir / "file1", dir / "file1",
dir / "file2"); dir / "file2");
test_rename_from_open_file(
dir / "file1",
dir / "file2");
test_rename( test_rename(
dir / "a", dir / "a",
dir / "aaaaa"); dir / "aaaaa");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment