diff options
author | Eric Fiselier <eric@efcs.ca> | 2016-07-23 03:10:56 +0000 |
---|---|---|
committer | Eric Fiselier <eric@efcs.ca> | 2016-07-23 03:10:56 +0000 |
commit | 0fdab5eb69ca4b2e9048526b33948af72976c7bc (patch) | |
tree | f46bce4590d4f9abf9281f6e0998bc8cbb6e57f8 /libcxx/test/std/experimental/filesystem/class.path/path.member/path.assign | |
parent | 796331c026a6cd33624c0f22e4e289fc89093b43 (diff) | |
download | bcm5719-llvm-0fdab5eb69ca4b2e9048526b33948af72976c7bc.tar.gz bcm5719-llvm-0fdab5eb69ca4b2e9048526b33948af72976c7bc.zip |
Implement P0392r0. Integrate filesystem::path and string_view.
llvm-svn: 276511
Diffstat (limited to 'libcxx/test/std/experimental/filesystem/class.path/path.member/path.assign')
-rw-r--r-- | libcxx/test/std/experimental/filesystem/class.path/path.member/path.assign/source.pass.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
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 <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 { |