Debian Codegraph @

libcxx/test/std/input.output/filesystems/class.rec.dir.itr/rec.dir.itr.members/disable_recursion_pending.pass.cpp

raw
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 // REQUIRES: can-create-symlinks
10 // UNSUPPORTED: c++03, c++11, c++14
11 // UNSUPPORTED: no-filesystem
12 // UNSUPPORTED: availability-filesystem-missing
13
14 // <filesystem>
15
16 // class recursive_directory_iterator
17
18 // void disable_recursion_pending();
19
20 #include <filesystem>
21 #include <type_traits>
22 #include <set>
23 #include <cassert>
24
25 #include "test_macros.h"
26 #include "filesystem_test_helper.h"
27 namespace fs = std::filesystem;
28 using namespace fs;
29
30 // NOTE: The main semantics of disable_recursion_pending are tested
31 // in the 'recursion_pending()' tests.
32 static void basic_test()
33 {
34 static_test_env static_env;
35 recursive_directory_iterator it(static_env.Dir);
36 assert(it.recursion_pending() == true);
37 it.disable_recursion_pending();
38 assert(it.recursion_pending() == false);
39 it.disable_recursion_pending();
40 assert(it.recursion_pending() == false);
41 }
42
43 int main(int, char**) {
44 basic_test();
45
46 return 0;
47 }