diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2019-11-15 19:58:15 +0000 |
---|---|---|
committer | Jonathan Wakely <redi@gcc.gnu.org> | 2019-11-15 19:58:15 +0000 |
commit | 01eb211bade92275e39254cc5a0dc21834dbcac4 (patch) | |
tree | 5bc1f1bc46184968c816940f078b28e0f8840525 /libstdc++-v3/testsuite/27_io/filesystem | |
parent | 838fd641a6ffb7e4734321de14385bece3e4506b (diff) |
libstdc++: Implement LWG 3070 in path::lexically_relative
* src/c++17/fs_path.cc [_GLIBCXX_FILESYSTEM_IS_WINDOWS]
(is_disk_designator): New helper function.
(path::_Parser::root_path()): Use is_disk_designator.
(path::lexically_relative(const path&)): Implement resolution of
LWG 3070.
* testsuite/27_io/filesystem/path/generation/relative.cc: Check with
path components that look like a root-name.
From-SVN: r278313
Diffstat (limited to 'libstdc++-v3/testsuite/27_io/filesystem')
-rw-r--r-- | libstdc++-v3/testsuite/27_io/filesystem/path/generation/relative.cc | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/libstdc++-v3/testsuite/27_io/filesystem/path/generation/relative.cc b/libstdc++-v3/testsuite/27_io/filesystem/path/generation/relative.cc index dde08d46f2c..b2ac27293b2 100644 --- a/libstdc++-v3/testsuite/27_io/filesystem/path/generation/relative.cc +++ b/libstdc++-v3/testsuite/27_io/filesystem/path/generation/relative.cc @@ -77,10 +77,26 @@ test03() compare_paths( path("/dir/.").lexically_relative("/dir/."), "." ); } +void +test04() +{ +#if defined(__MING32__) || defined(__MINGW64__) + // DR 3070 + compare_paths(path("c:/f:o/bar").lexically_relative("c:/f:o/bar"), "."); + compare_paths(path("c:/foo/bar").lexically_relative("c:/foo/b:r"), "..\\bar"); + compare_paths(path("c:/foo/b:r").lexically_relative("c:/foo/bar"), "..\\b:r"); + compare_paths(path("c:/foo/b:").lexically_relative("c:/foo/b:"), ""); + compare_paths(path("c:/foo/bar").lexically_relative("c:/foo/b:"), ""); + compare_paths(path("c:/f:/bar").lexically_relative("c:/foo/bar"), ""); + compare_paths(path("foo/bar").lexically_relative("foo/b:/bar"), ""); +#endif +} + int main() { test01(); test02(); test03(); + test04(); } |