summaryrefslogtreecommitdiffstats
path: root/libcxx/test/std/experimental/filesystem/class.path
diff options
context:
space:
mode:
Diffstat (limited to 'libcxx/test/std/experimental/filesystem/class.path')
-rw-r--r--libcxx/test/std/experimental/filesystem/class.path/path.member/path.assign/braced_init.pass.cpp32
-rw-r--r--libcxx/test/std/experimental/filesystem/class.path/path.member/path.assign/source.pass.cpp18
2 files changed, 50 insertions, 0 deletions
diff --git a/libcxx/test/std/experimental/filesystem/class.path/path.member/path.assign/braced_init.pass.cpp b/libcxx/test/std/experimental/filesystem/class.path/path.member/path.assign/braced_init.pass.cpp
new file mode 100644
index 00000000000..c5da52f6524
--- /dev/null
+++ b/libcxx/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/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 9e48cbf1e7f..987c873218c 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
@@ -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>
@@ -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();
}
OpenPOWER on IntegriCloud