1//===----------------------------------------------------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9// UNSUPPORTED: c++03, c++11, c++14
10// UNSUPPORTED: availability-filesystem-missing
11
12// <filesystem>
13
14// class path
15
16// void clear() noexcept
17
18#include <filesystem>
19#include <cassert>
20#include <type_traits>
21
22#include "assert_macros.h"
23#include "count_new.h"
24#include "test_iterators.h"
25namespace fs = std::filesystem;
26
27int main(int, char**) {
28 using namespace fs;
29 {
30 path p;
31 ASSERT_NOEXCEPT(p.clear());
32 ASSERT_SAME_TYPE(void, decltype(p.clear()));
33 p.clear();
34 assert(p.empty());
35 }
36 {
37 const path p("/foo/bar/baz");
38 path p2(p);
39 assert(p == p2);
40 p2.clear();
41 assert(p2.empty());
42 }
43
44 return 0;
45}
46

source code of libcxx/test/std/input.output/filesystems/class.path/path.member/path.modifiers/clear.pass.cpp