summaryrefslogtreecommitdiff
path: root/libstdc++-v3/testsuite/27_io/filesystem/path
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2018-12-20 18:12:11 +0000
committerJonathan Wakely <redi@gcc.gnu.org>2018-12-20 18:12:11 +0000
commit080cec7f9ac68c7ed44f7f5205349d43075cac8c (patch)
tree597b9e546f2f9b362453770365244380bab4bd2f /libstdc++-v3/testsuite/27_io/filesystem/path
parent159fdc3966a2b9501fea87930b21bf72d1202efd (diff)
Fix filesystem::path tests that fail on Windows
* testsuite/27_io/filesystem/operations/proximate.cc: Fix test for MinGW. * testsuite/27_io/filesystem/path/append/source.cc: Likewise. * testsuite/27_io/filesystem/path/compare/lwg2936.cc: Likewise. From-SVN: r267308
Diffstat (limited to 'libstdc++-v3/testsuite/27_io/filesystem/path')
-rw-r--r--libstdc++-v3/testsuite/27_io/filesystem/path/append/source.cc15
-rw-r--r--libstdc++-v3/testsuite/27_io/filesystem/path/compare/lwg2936.cc5
2 files changed, 16 insertions, 4 deletions
diff --git a/libstdc++-v3/testsuite/27_io/filesystem/path/append/source.cc b/libstdc++-v3/testsuite/27_io/filesystem/path/append/source.cc
index 21ae6be3d97..578d1350178 100644
--- a/libstdc++-v3/testsuite/27_io/filesystem/path/append/source.cc
+++ b/libstdc++-v3/testsuite/27_io/filesystem/path/append/source.cc
@@ -120,24 +120,31 @@ test05()
path p = "0/1/2/3/4/5/6";
// The string_view aliases the path's internal string:
s = p.native();
+ path::string_type expected(s);
+ expected += path::preferred_separator;
+ expected += s;
// Append that string_view, which must work correctly even though the
// internal string will be reallocated during the operation:
p /= s;
- VERIFY( p.string() == "0/1/2/3/4/5/6/0/1/2/3/4/5/6" );
+ compare_paths(p, expected);
// Same again with a trailing slash:
path p2 = "0/1/2/3/4/5/";
s = p2.native();
+ expected = s;
+ expected += s;
p2 /= s;
- VERIFY( p2.string() == "0/1/2/3/4/5/0/1/2/3/4/5/" );
+ compare_paths(p2, expected);
// And aliasing one of the components of the path:
path p3 = "0/123456789/a";
path::iterator second = std::next(p3.begin());
s = second->native();
+ expected = p3.native() + path::preferred_separator;
+ expected += s;
p3 /= s;
- VERIFY( p3.string() == "0/123456789/a/123456789" );
- }
+ compare_paths(p3, expected);
+}
void
test06()
diff --git a/libstdc++-v3/testsuite/27_io/filesystem/path/compare/lwg2936.cc b/libstdc++-v3/testsuite/27_io/filesystem/path/compare/lwg2936.cc
index 8a11043f143..a62f01c3fb6 100644
--- a/libstdc++-v3/testsuite/27_io/filesystem/path/compare/lwg2936.cc
+++ b/libstdc++-v3/testsuite/27_io/filesystem/path/compare/lwg2936.cc
@@ -60,7 +60,11 @@ test01()
check("c:", "d:", -1);
check("c:", "c:/", -1);
check("d:", "c:/", +1);
+#if defined(__MING32__) || defined(__MINGW64__)
+ check("c:/a/b", "c:a/b", +1);
+#else
check("c:/a/b", "c:a/b", -1);
+#endif
// These are root names on Cygwin (just relative paths elsewhere)
check("", "//c", -1);
@@ -68,6 +72,7 @@ test01()
check("//c", "//c/", -1);
check("//d", "//c/", +1);
+ check("a", "/", -1);
check("/a", "/b", -1);
check("a", "/b", -1);
check("/b", "b", +1);