mirror of
https://github.com/llvm-mirror/libcxx.git
synced 2025-10-24 03:32:35 +08:00
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:
@@ -23,6 +23,7 @@
|
||||
|
||||
#include <experimental/filesystem>
|
||||
#include <type_traits>
|
||||
#include <string_view>
|
||||
#include <cassert>
|
||||
|
||||
#include "test_macros.h"
|
||||
@@ -69,6 +70,32 @@ void RunTestCase(MultiStringType const& MS) {
|
||||
assert(p.string<CharT>() == TestPath);
|
||||
assert(p.string<CharT>() == S);
|
||||
}
|
||||
// basic_string<Char, Traits, Alloc>
|
||||
{
|
||||
const std::basic_string_view<CharT> S(TestPath);
|
||||
path p; PathReserve(p, S.length() + 1);
|
||||
{
|
||||
// string provides a contigious iterator. No allocation needed.
|
||||
DisableAllocationGuard g;
|
||||
path& pref = (p = S);
|
||||
assert(&pref == &p);
|
||||
}
|
||||
assert(p.native() == Expect);
|
||||
assert(p.string<CharT>() == TestPath);
|
||||
assert(p.string<CharT>() == S);
|
||||
}
|
||||
{
|
||||
const std::basic_string_view<CharT> S(TestPath);
|
||||
path p; PathReserve(p, S.length() + 1);
|
||||
{
|
||||
DisableAllocationGuard g;
|
||||
path& pref = p.assign(S);
|
||||
assert(&pref == &p);
|
||||
}
|
||||
assert(p.native() == Expect);
|
||||
assert(p.string<CharT>() == TestPath);
|
||||
assert(p.string<CharT>() == S);
|
||||
}
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// Char* pointers
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user