• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 file_status
15 
16 // void type(file_type) noexcept;
17 // void permissions(perms) noexcept;
18 
19 #include <experimental/filesystem>
20 #include <type_traits>
21 #include <cassert>
22 
23 namespace fs = std::experimental::filesystem;
24 
main()25 int main() {
26   using namespace fs;
27 
28   file_status st;
29 
30   // type test
31   {
32     static_assert(noexcept(st.type(file_type::regular)),
33                   "operation must be noexcept");
34     static_assert(std::is_same<decltype(st.type(file_type::regular)), void>::value,
35                  "operation must return void");
36     assert(st.type() != file_type::regular);
37     st.type(file_type::regular);
38     assert(st.type() == file_type::regular);
39   }
40   // permissions test
41   {
42     static_assert(noexcept(st.permissions(perms::owner_read)),
43                   "operation must be noexcept");
44     static_assert(std::is_same<decltype(st.permissions(perms::owner_read)), void>::value,
45                  "operation must return void");
46     assert(st.permissions() != perms::owner_read);
47     st.permissions(perms::owner_read);
48     assert(st.permissions() == perms::owner_read);
49   }
50 }
51