file_status.mods.pass.cpp 1.4 KB

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