]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/std/experimental/filesystem/class.path/path.member/path.modifiers/clear.pass.cpp
Vendor import of libc++ trunk r290819:
[FreeBSD/FreeBSD.git] / test / std / experimental / filesystem / class.path / path.member / path.modifiers / clear.pass.cpp
1 //===----------------------------------------------------------------------===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9
10 // UNSUPPORTED: c++98, c++03
11
12 // <experimental/filesystem>
13
14 // class path
15
16 // void clear() noexcept
17
18 #include <experimental/filesystem>
19 #include <type_traits>
20 #include <cassert>
21
22 #include "test_macros.h"
23 #include "test_iterators.h"
24 #include "count_new.hpp"
25 #include "filesystem_test_helper.hpp"
26
27 namespace fs = std::experimental::filesystem;
28
29 int main() {
30   using namespace fs;
31   {
32     path p;
33     ASSERT_NOEXCEPT(p.clear());
34     ASSERT_SAME_TYPE(void, decltype(p.clear()));
35     p.clear();
36     assert(p.empty());
37   }
38   {
39     const path p("/foo/bar/baz");
40     path p2(p);
41     assert(p == p2);
42     p2.clear();
43     assert(p2.empty());
44   }
45 }