From 0fdab5eb69ca4b2e9048526b33948af72976c7bc Mon Sep 17 00:00:00 2001 From: Eric Fiselier Date: Sat, 23 Jul 2016 03:10:56 +0000 Subject: Implement P0392r0. Integrate filesystem::path and string_view. llvm-svn: 276511 --- .../path.member/path.assign/source.pass.cpp | 27 ++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'libcxx/test/std/experimental/filesystem/class.path/path.member/path.assign/source.pass.cpp') diff --git a/libcxx/test/std/experimental/filesystem/class.path/path.member/path.assign/source.pass.cpp b/libcxx/test/std/experimental/filesystem/class.path/path.member/path.assign/source.pass.cpp index 4c2d5112d10..ae725a88590 100644 --- a/libcxx/test/std/experimental/filesystem/class.path/path.member/path.assign/source.pass.cpp +++ b/libcxx/test/std/experimental/filesystem/class.path/path.member/path.assign/source.pass.cpp @@ -23,6 +23,7 @@ #include #include +#include #include #include "test_macros.h" @@ -69,6 +70,32 @@ void RunTestCase(MultiStringType const& MS) { assert(p.string() == TestPath); assert(p.string() == S); } + // basic_string + { + const std::basic_string_view 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() == TestPath); + assert(p.string() == S); + } + { + const std::basic_string_view 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() == TestPath); + assert(p.string() == S); + } ////////////////////////////////////////////////////////////////////////////// // Char* pointers { -- cgit v1.2.3