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