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 10 // UNSUPPORTED: c++98, c++03 11 12 // <experimental/filesystem> 13 14 // class directory_entry 15 16 // file_status symlink_status() const; 17 // file_status symlink_status(error_code&) const noexcept; 18 19 #include <experimental/filesystem> 20 #include <type_traits> 21 #include <cassert> 22 23 #include "filesystem_test_helper.hpp" 24 25 int main() { 26 using namespace fs; 27 { 28 const directory_entry e("foo"); 29 std::error_code ec; 30 static_assert(std::is_same<decltype(e.symlink_status()), file_status>::value, ""); 31 static_assert(std::is_same<decltype(e.symlink_status(ec)), file_status>::value, ""); 32 static_assert(noexcept(e.symlink_status()) == false, ""); 33 static_assert(noexcept(e.symlink_status(ec)) == true, ""); 34 } 35 auto TestFn = [](path const& p) { 36 const directory_entry e(p); 37 std::error_code pec, eec; 38 file_status ps = fs::symlink_status(p, pec); 39 file_status es = e.symlink_status(eec); 40 assert(ps.type() == es.type()); 41 assert(ps.permissions() == es.permissions()); 42 assert(pec == eec); 43 }; 44 { 45 TestFn(StaticEnv::File); 46 TestFn(StaticEnv::Dir); 47 TestFn(StaticEnv::SymlinkToFile); 48 TestFn(StaticEnv::DNE); 49 } 50 } 51