file_status.mods.pass.cpp 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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. // UNSUPPORTED: c++98, c++03
  10. // <experimental/filesystem>
  11. // class file_status
  12. // void type(file_type) noexcept;
  13. // void permissions(perms) noexcept;
  14. #include <experimental/filesystem>
  15. #include <type_traits>
  16. #include <cassert>
  17. namespace fs = std::experimental::filesystem;
  18. int main() {
  19. using namespace fs;
  20. file_status st;
  21. // type test
  22. {
  23. static_assert(noexcept(st.type(file_type::regular)),
  24. "operation must be noexcept");
  25. static_assert(std::is_same<decltype(st.type(file_type::regular)), void>::value,
  26. "operation must return void");
  27. assert(st.type() != file_type::regular);
  28. st.type(file_type::regular);
  29. assert(st.type() == file_type::regular);
  30. }
  31. // permissions test
  32. {
  33. static_assert(noexcept(st.permissions(perms::owner_read)),
  34. "operation must be noexcept");
  35. static_assert(std::is_same<decltype(st.permissions(perms::owner_read)), void>::value,
  36. "operation must return void");
  37. assert(st.permissions() != perms::owner_read);
  38. st.permissions(perms::owner_read);
  39. assert(st.permissions() == perms::owner_read);
  40. }
  41. }