[libcxx-commits] [libcxx] ab67fd3 - [libcxx] [test] Fix path.modifiers remove_filename and replace_filename for windows

Martin Storsjö via libcxx-commits libcxx-commits at lists.llvm.org
Sun Mar 7 00:47:58 PST 2021


Author: Martin Storsjö
Date: 2021-03-07T10:37:13+02:00
New Revision: ab67fd39fc144d911d926c4db886d301061d1368

URL: https://github.com/llvm/llvm-project/commit/ab67fd39fc144d911d926c4db886d301061d1368
DIFF: https://github.com/llvm/llvm-project/commit/ab67fd39fc144d911d926c4db886d301061d1368.diff

LOG: [libcxx] [test] Fix path.modifiers remove_filename and replace_filename for windows

Also fix the synopsis in the replace_filename test, while touching
that file.

Differential Revision: https://reviews.llvm.org/D98108

Added: 
    

Modified: 
    libcxx/test/std/input.output/filesystems/class.path/path.member/path.modifiers/remove_filename.pass.cpp
    libcxx/test/std/input.output/filesystems/class.path/path.member/path.modifiers/replace_filename.pass.cpp

Removed: 
    


################################################################################
diff  --git a/libcxx/test/std/input.output/filesystems/class.path/path.member/path.modifiers/remove_filename.pass.cpp b/libcxx/test/std/input.output/filesystems/class.path/path.member/path.modifiers/remove_filename.pass.cpp
index df71bbe0ad5c..324d0dca3256 100644
--- a/libcxx/test/std/input.output/filesystems/class.path/path.member/path.modifiers/remove_filename.pass.cpp
+++ b/libcxx/test/std/input.output/filesystems/class.path/path.member/path.modifiers/remove_filename.pass.cpp
@@ -34,13 +34,21 @@ const RemoveFilenameTestcase TestCases[] =
     , {"/", "/"}
     , {"//", "//"}
     , {"///", "///"}
+#ifdef _WIN32
+    , {"\\", "\\"}
+#else
     , {"\\", ""}
+#endif
     , {".", ""}
     , {"..", ""}
     , {"/foo", "/"}
     , {"foo/bar", "foo/"}
     , {"foo/", "foo/"}
+#ifdef _WIN32
+    , {"//foo", "//foo"}
+#else
     , {"//foo", "//"}
+#endif
     , {"//foo/", "//foo/"}
     , {"//foo///", "//foo///"}
     , {"///foo", "///"}
@@ -49,7 +57,11 @@ const RemoveFilenameTestcase TestCases[] =
     , {"/foo/.", "/foo/"}
     , {"/foo/..", "/foo/"}
     , {"/foo/////", "/foo/////"}
+#ifdef _WIN32
+    , {"/foo\\\\", "/foo\\\\"}
+#else
     , {"/foo\\\\", "/"}
+#endif
     , {"/foo//\\/", "/foo//\\/"}
     , {"///foo", "///"}
     , {"file.txt", ""}

diff  --git a/libcxx/test/std/input.output/filesystems/class.path/path.member/path.modifiers/replace_filename.pass.cpp b/libcxx/test/std/input.output/filesystems/class.path/path.member/path.modifiers/replace_filename.pass.cpp
index d9cdbcce8fdc..83ca785ff01b 100644
--- a/libcxx/test/std/input.output/filesystems/class.path/path.member/path.modifiers/replace_filename.pass.cpp
+++ b/libcxx/test/std/input.output/filesystems/class.path/path.member/path.modifiers/replace_filename.pass.cpp
@@ -12,7 +12,7 @@
 
 // class path
 
-// path& replace_filename()
+// path& replace_filename( const path& replacement );
 
 #include "filesystem_include.h"
 #include <type_traits>
@@ -35,10 +35,19 @@ const ReplaceFilenameTestcase TestCases[] =
     , {"/foo", "/", ""}
     , {"foo", "bar", "bar"}
     , {"/", "/bar", "bar"}
+#ifdef _WIN32
+    , {"\\", "\\bar", "bar"}
+#else
     , {"\\", "bar", "bar"}
+#endif
     , {"///", "///bar", "bar"}
+#ifdef _WIN32
+    , {"\\\\", "\\\\bar", "bar"}
+    , {"\\/\\", "\\/\\bar", "bar"}
+#else
     , {"\\\\", "bar", "bar"}
     , {"\\/\\", "\\/bar", "bar"}
+#endif
     , {".", "bar", "bar"}
     , {"..", "bar", "bar"}
     , {"/foo\\baz/bong/", "/foo\\baz/bong/bar", "bar"}


        


More information about the libcxx-commits mailing list