file_status.obs.pass.cpp 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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. // file_type type() const noexcept;
  13. // perms permissions(p) const 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. const file_status st(file_type::regular, perms::owner_read);
  21. // type test
  22. {
  23. static_assert(noexcept(st.type()),
  24. "operation must be noexcept");
  25. static_assert(std::is_same<decltype(st.type()), file_type>::value,
  26. "operation must return file_type");
  27. assert(st.type() == file_type::regular);
  28. }
  29. // permissions test
  30. {
  31. static_assert(noexcept(st.permissions()),
  32. "operation must be noexcept");
  33. static_assert(std::is_same<decltype(st.permissions()), perms>::value,
  34. "operation must return perms");
  35. assert(st.permissions() == perms::owner_read);
  36. }
  37. }