diff options
Diffstat (limited to 'test/std/experimental/filesystem/class.path')
6 files changed, 61 insertions, 13 deletions
diff --git a/test/std/experimental/filesystem/class.path/path.member/path.append.pass.cpp b/test/std/experimental/filesystem/class.path/path.member/path.append.pass.cpp index f344e11530718..a6172d1981cf6 100644 --- a/test/std/experimental/filesystem/class.path/path.member/path.append.pass.cpp +++ b/test/std/experimental/filesystem/class.path/path.member/path.append.pass.cpp @@ -131,7 +131,7 @@ void doAppendSourceAllocTest(AppendOperatorTestcase const& TC) assert(LHS == E); } // input iterator - For non-native char types, appends needs to copy the - // iterator range into a contigious block of memory before it can perform the + // iterator range into a contiguous block of memory before it can perform the // code_cvt conversions. // For "char" no allocations will be performed because no conversion is // required. diff --git a/test/std/experimental/filesystem/class.path/path.member/path.assign/braced_init.pass.cpp b/test/std/experimental/filesystem/class.path/path.member/path.assign/braced_init.pass.cpp new file mode 100644 index 0000000000000..c5da52f652483 --- /dev/null +++ b/test/std/experimental/filesystem/class.path/path.member/path.assign/braced_init.pass.cpp @@ -0,0 +1,32 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++98, c++03 + +// <experimental/filesystem> + +// class path + +// path& operator=(path const&); + +#include <experimental/filesystem> +#include <type_traits> +#include <cassert> + +#include "test_macros.h" +#include "count_new.hpp" + +namespace fs = std::experimental::filesystem; + +int main() { + using namespace fs; + path p("abc"); + p = {}; + assert(p.native() == ""); +} diff --git a/test/std/experimental/filesystem/class.path/path.member/path.assign/source.pass.cpp b/test/std/experimental/filesystem/class.path/path.member/path.assign/source.pass.cpp index 9e48cbf1e7f21..8c31ef51d9448 100644 --- a/test/std/experimental/filesystem/class.path/path.member/path.assign/source.pass.cpp +++ b/test/std/experimental/filesystem/class.path/path.member/path.assign/source.pass.cpp @@ -15,6 +15,7 @@ // template <class Source> // path& operator=(Source const&); +// path& operator=(string_type&&); // template <class Source> // path& assign(Source const&); // template <class InputIterator> @@ -49,7 +50,7 @@ void RunTestCase(MultiStringType const& MS) { const std::basic_string<CharT> S(TestPath); path p; PathReserve(p, S.length() + 1); { - // string provides a contigious iterator. No allocation needed. + // string provides a contiguous iterator. No allocation needed. DisableAllocationGuard g; path& pref = (p = S); assert(&pref == &p); @@ -75,7 +76,7 @@ void RunTestCase(MultiStringType const& MS) { const std::basic_string_view<CharT> S(TestPath); path p; PathReserve(p, S.length() + 1); { - // string provides a contigious iterator. No allocation needed. + // string provides a contiguous iterator. No allocation needed. DisableAllocationGuard g; path& pref = (p = S); assert(&pref == &p); @@ -101,7 +102,7 @@ void RunTestCase(MultiStringType const& MS) { { path p; PathReserve(p, Size + 1); { - // char* pointers are contigious and can be used with code_cvt directly. + // char* pointers are contiguous and can be used with code_cvt directly. // no allocations needed. DisableAllocationGuard g; path& pref = (p = TestPath); @@ -213,12 +214,29 @@ void test_sfinae() { } } +void RunStringMoveTest(const char* Expect) { + using namespace fs; + std::string ss(Expect); + path p; + { + DisableAllocationGuard g; ((void)g); + path& pr = (p = std::move(ss)); + assert(&pr == &p); + } + assert(p == Expect); + { + // Signature test + ASSERT_NOEXCEPT(p = std::move(ss)); + } +} + int main() { for (auto const& MS : PathList) { RunTestCase<char>(MS); RunTestCase<wchar_t>(MS); RunTestCase<char16_t>(MS); RunTestCase<char32_t>(MS); + RunStringMoveTest(MS); } test_sfinae(); } diff --git a/test/std/experimental/filesystem/class.path/path.member/path.concat.pass.cpp b/test/std/experimental/filesystem/class.path/path.member/path.concat.pass.cpp index 89269362d06fe..76df0e9eef76a 100644 --- a/test/std/experimental/filesystem/class.path/path.member/path.concat.pass.cpp +++ b/test/std/experimental/filesystem/class.path/path.member/path.concat.pass.cpp @@ -132,7 +132,7 @@ void doConcatSourceAllocTest(ConcatOperatorTestcase const& TC) assert(LHS == E); } // input iterator - For non-native char types, appends needs to copy the - // iterator range into a contigious block of memory before it can perform the + // iterator range into a contiguous block of memory before it can perform the // code_cvt conversions. // For "char" no allocations will be performed because no conversion is // required. diff --git a/test/std/experimental/filesystem/class.path/path.member/path.decompose/path.decompose.pass.cpp b/test/std/experimental/filesystem/class.path/path.member/path.decompose/path.decompose.pass.cpp index 4c83481aaf2d8..078e006663e93 100644 --- a/test/std/experimental/filesystem/class.path/path.member/path.decompose/path.decompose.pass.cpp +++ b/test/std/experimental/filesystem/class.path/path.member/path.decompose/path.decompose.pass.cpp @@ -54,12 +54,6 @@ #include "count_new.hpp" #include "filesystem_test_helper.hpp" -template <class It> -std::reverse_iterator<It> mkRev(It it) { - return std::reverse_iterator<It>(it); -} - - namespace fs = std::experimental::filesystem; struct PathDecomposeTestcase { @@ -147,7 +141,11 @@ void decompPathTest() assert(checkCollectionsEqual(p.begin(), p.end(), TC.elements.begin(), TC.elements.end())); // check backwards - assert(checkCollectionsEqual(mkRev(p.end()), mkRev(p.begin()), + + std::vector<fs::path> Parts; + for (auto it = p.end(); it != p.begin(); ) + Parts.push_back(*--it); + assert(checkCollectionsEqual(Parts.begin(), Parts.end(), TC.elements.rbegin(), TC.elements.rend())); } } diff --git a/test/std/experimental/filesystem/class.path/synop.pass.cpp b/test/std/experimental/filesystem/class.path/synop.pass.cpp index b0a7b5cd65e21..883feb287d06c 100644 --- a/test/std/experimental/filesystem/class.path/synop.pass.cpp +++ b/test/std/experimental/filesystem/class.path/synop.pass.cpp @@ -32,7 +32,7 @@ int main() { { ASSERT_SAME_TYPE(const path::value_type, decltype(path::preferred_separator)); static_assert(path::preferred_separator == '/', ""); - // Make preferred_separator ODR used by taking it's address. + // Make preferred_separator ODR used by taking its address. const char* dummy = &path::preferred_separator; ((void)dummy); } |