file_status.obs.pass.cpp 1.2 KB

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