Implement filesystem NB comments, relative paths, and related issues.
This is a fairly large patch that implements all of the filesystem NB comments
and the relative paths changes (ex. adding weakly_canonical). These issues
and papers are all interrelated so their implementation couldn't be split up
nicely.
This patch upgrades <experimental/filesystem> to match the C++17 spec and not
the published experimental TS spec. Some of the changes in this patch are both
API and ABI breaking, however libc++ makes no guarantee about stability for
experimental implementations.
The major changes in this patch are:
* Implement NB comments for filesystem (P0492R2), including:
* Implement `perm_options` enum as part of NB comments, and update the
`permissions` function to match.
* Implement changes to `remove_filename` and `replace_filename`
* Implement changes to `path::stem()` and `path::extension()` which support
splitting examples like `.profile`.
* Change path iteration to return an empty path instead of '.' for trailing
separators.
* Change `operator/=` to handle absolute paths on the RHS.
* Change `absolute` to no longer accept a current path argument.
* Implement relative paths according to NB comments (P0219r1)
* Combine `path.cpp` and `operations.cpp` since some path functions require
access to the operations internals, and some fs operations require access
to the path parser.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@329028 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -26,6 +26,7 @@
|
||||
//
|
||||
// size_t hash_value(path const&) noexcept;
|
||||
|
||||
|
||||
#include "filesystem_include.hpp"
|
||||
#include <type_traits>
|
||||
#include <vector>
|
||||
@@ -35,7 +36,7 @@
|
||||
#include "test_iterators.h"
|
||||
#include "count_new.hpp"
|
||||
#include "filesystem_test_helper.hpp"
|
||||
|
||||
#include "verbose_assert.h"
|
||||
|
||||
struct PathCompareTest {
|
||||
const char* LHS;
|
||||
@@ -57,8 +58,9 @@ const PathCompareTest CompareTestCases[] =
|
||||
{"a/b/c", "b/a/c", -1},
|
||||
{"a/b", "a/b/c", -1},
|
||||
{"a/b/c", "a/b", 1},
|
||||
{"a/b/", "a/b/.", 0},
|
||||
{"a/b//////", "a/b/////.", 0},
|
||||
{"a/b/", "a/b/.", -1},
|
||||
{"a/b/", "a/b", 1},
|
||||
{"a/b//////", "a/b/////.", -1},
|
||||
{"a/.././b", "a///..//.////b", 0},
|
||||
{"//foo//bar///baz////", "//foo/bar/baz/", 0}, // duplicate separators
|
||||
{"///foo/bar", "/foo/bar", 0}, // "///" is not a root directory
|
||||
@@ -94,8 +96,13 @@ int main()
|
||||
int ret2 = normalize_ret(p1.compare(R));
|
||||
int ret3 = normalize_ret(p1.compare(TC.RHS));
|
||||
int ret4 = normalize_ret(p1.compare(RV));
|
||||
assert(ret1 == ret2 && ret1 == ret3 && ret1 == ret4);
|
||||
assert(ret1 == E);
|
||||
|
||||
g.release();
|
||||
ASSERT_EQ(ret1, ret2);
|
||||
ASSERT_EQ(ret1, ret3);
|
||||
ASSERT_EQ(ret1, ret4);
|
||||
ASSERT_EQ(ret1, E)
|
||||
<< DISPLAY(TC.LHS) << DISPLAY(TC.RHS);
|
||||
|
||||
// check signatures
|
||||
ASSERT_NOEXCEPT(p1.compare(p2));
|
||||
|
||||
Reference in New Issue
Block a user