summaryrefslogtreecommitdiff
path: root/libstdc++-v3/testsuite/27_io/filesystem/path
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2018-12-13 20:34:10 +0000
committerJonathan Wakely <redi@gcc.gnu.org>2018-12-13 20:34:10 +0000
commit2b462958e2db15dc6f55ed361d47cdbc62d64ea0 (patch)
tree24649584cde525313a354705adf2b63dcdb786fb /libstdc++-v3/testsuite/27_io/filesystem/path
parent4f87bb8d6e8dec21a07f1fba641a78a127281349 (diff)
Fix handling of POSIX paths containing a root-name
Fix path appending and concatenating to work correctly for a leading root-name. Check a new macro, SLASHSLASH_IS_ROOT_NAME, instead of making the behaviour depend directly on __CYGWIN__. * src/filesystem/std-path.cc (SLASHSLASH_IS_ROOT_NAME): New macro to control whether interpret paths with two slashes as a root-name. (path::operator/=(const path&)) [SLASHSLASH_IS_ROOT_NAME]: Add a root-directory when appending to a root-name. (path::_M_append(basic_string_view<value_type>)) [SLASHSLASH_IS_ROOT_NAME]: Likewise. (path::operator/=(const path&)) [SLASHSLASH_IS_ROOT_NAME]: Likewise. (path::_M_concat(basic_string_view<value_type>)) [SLASHSLASH_IS_ROOT_NAME]: Likewise. (path::lexically_normal()) [SLASHSLASH_IS_ROOT_NAME]: Use += instead of /= to add a root-directory to the result. * testsuite/27_io/filesystem/path/decompose/root_directory.cc: Fix expected result for Cygwin. From-SVN: r267107
Diffstat (limited to 'libstdc++-v3/testsuite/27_io/filesystem/path')
-rw-r--r--libstdc++-v3/testsuite/27_io/filesystem/path/decompose/root_directory.cc4
1 files changed, 4 insertions, 0 deletions
diff --git a/libstdc++-v3/testsuite/27_io/filesystem/path/decompose/root_directory.cc b/libstdc++-v3/testsuite/27_io/filesystem/path/decompose/root_directory.cc
index da5f377de94..40af1551eeb 100644
--- a/libstdc++-v3/testsuite/27_io/filesystem/path/decompose/root_directory.cc
+++ b/libstdc++-v3/testsuite/27_io/filesystem/path/decompose/root_directory.cc
@@ -35,7 +35,11 @@ test01()
path p2 = "/foo/bar";
VERIFY( p2.root_directory() == path("/") );
path p3 = "//foo";
+#ifdef __CYGWIN__
+ VERIFY( p3.root_directory() == path() );
+#else
VERIFY( p3.root_directory() == path("/") );
+#endif
path p4 = "///foo";
VERIFY( p4.root_directory() == path("/") );
}