]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libstdc++: Add testcase for std::filesystem::copy [PR118699]
authorJonathan Wakely <jwakely@redhat.com>
Thu, 30 Jan 2025 17:02:47 +0000 (17:02 +0000)
committerJonathan Wakely <redi@gcc.gnu.org>
Tue, 25 Mar 2025 12:33:38 +0000 (12:33 +0000)
This was fixed last year by r15-2409-g017e3f89b081e4 (and backports), so
just add the testcase.

libstdc++-v3/ChangeLog:

PR libstdc++/118699
* testsuite/27_io/filesystem/operations/copy.cc: Check copying a
file to a directory.

libstdc++-v3/testsuite/27_io/filesystem/operations/copy.cc

index c302d9ad2a0cea004a225deaba6c1a59c6d7e439..289bef6160bf048a3b39d4ffe2cf6945241d0af9 100644 (file)
@@ -228,6 +228,23 @@ test_pr99290()
   remove_all(dir);
 }
 
+void
+test_pr118699()
+{
+  auto dir = __gnu_test::nonexistent_path();
+  fs::create_directories(dir/"a");
+  fs::create_directories(dir/"c");
+  std::ofstream{dir/"a/b.txt"} << "b";
+  std::ofstream{dir/"a/bb.txt"} << "bb";
+
+  fs::copy(dir/"a/b.txt", dir/"c");
+  auto ec = make_error_code(std::errc::invalid_argument);
+  fs::copy(dir/"a/bb.txt", dir/"c", ec);
+  VERIFY( !ec );
+
+  remove_all(dir);
+}
+
 int
 main()
 {
@@ -237,4 +254,5 @@ main()
   test04();
   test05();
   test_pr99290();
+  test_pr118699();
 }