[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
This commit is contained in:
Martin Storsjö 2020-10-15 13:47:36 +03:00
parent 39ad160468
commit ab67fd39fc
2 changed files with 22 additions and 1 deletions

View File

@ -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", ""}

View File

@ -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"}