Implement P0392r0. Integrate filesystem::path and string_view.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@276511 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Eric Fiselier
2016-07-23 03:10:56 +00:00
parent bdbae4cbad
commit 2645dbe87f
9 changed files with 211 additions and 70 deletions

View File

@@ -24,6 +24,7 @@
#include <experimental/filesystem>
#include <type_traits>
#include <string_view>
#include <cassert>
#include "test_macros.h"
@@ -77,6 +78,7 @@ void doAppendSourceAllocTest(AppendOperatorTestcase const& TC)
using namespace fs;
using Ptr = CharT const*;
using Str = std::basic_string<CharT>;
using StrView = std::basic_string_view<CharT>;
using InputIter = input_iterator<Ptr>;
const Ptr L = TC.lhs;
@@ -99,6 +101,16 @@ void doAppendSourceAllocTest(AppendOperatorTestcase const& TC)
}
assert(LHS == E);
}
// basic_string_view
{
path LHS(L); PathReserve(LHS, ReserveSize);
StrView RHS(R);
{
DisableAllocationGuard g;
LHS /= RHS;
}
assert(LHS == E);
}
// CharT*
{
path LHS(L); PathReserve(LHS, ReserveSize);
@@ -153,6 +165,7 @@ void doAppendSourceTest(AppendOperatorTestcase const& TC)
using namespace fs;
using Ptr = CharT const*;
using Str = std::basic_string<CharT>;
using StrView = std::basic_string_view<CharT>;
using InputIter = input_iterator<Ptr>;
const Ptr L = TC.lhs;
const Ptr R = TC.rhs;
@@ -172,6 +185,21 @@ void doAppendSourceTest(AppendOperatorTestcase const& TC)
assert(LHS == E);
assert(&Ref == &LHS);
}
// basic_string_view
{
path LHS(L);
StrView RHS(R);
path& Ref = (LHS /= RHS);
assert(LHS == E);
assert(&Ref == &LHS);
}
{
path LHS(L);
StrView RHS(R);
path& Ref = LHS.append(RHS);
assert(LHS == E);
assert(&Ref == &LHS);
}
// Char*
{
path LHS(L);