file_status.obs.pass.cpp 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. //===----------------------------------------------------------------------===//
  2. //
  3. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  4. // See https://llvm.org/LICENSE.txt for license information.
  5. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  6. //
  7. //===----------------------------------------------------------------------===//
  8. // UNSUPPORTED: c++98, c++03
  9. // <filesystem>
  10. // class file_status
  11. // file_type type() const noexcept;
  12. // perms permissions(p) const noexcept;
  13. #include "filesystem_include.hpp"
  14. #include <type_traits>
  15. #include <cassert>
  16. int main(int, char**) {
  17. using namespace fs;
  18. const file_status st(file_type::regular, perms::owner_read);
  19. // type test
  20. {
  21. static_assert(noexcept(st.type()),
  22. "operation must be noexcept");
  23. static_assert(std::is_same<decltype(st.type()), file_type>::value,
  24. "operation must return file_type");
  25. assert(st.type() == file_type::regular);
  26. }
  27. // permissions test
  28. {
  29. static_assert(noexcept(st.permissions()),
  30. "operation must be noexcept");
  31. static_assert(std::is_same<decltype(st.permissions()), perms>::value,
  32. "operation must return perms");
  33. assert(st.permissions() == perms::owner_read);
  34. }
  35. return 0;
  36. }