diff options
Diffstat (limited to 'libstdc++-v3/testsuite/27_io/filesystem/operations/absolute.cc')
-rw-r--r-- | libstdc++-v3/testsuite/27_io/filesystem/operations/absolute.cc | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/libstdc++-v3/testsuite/27_io/filesystem/operations/absolute.cc b/libstdc++-v3/testsuite/27_io/filesystem/operations/absolute.cc index 413a86758f0..3f1ed72424a 100644 --- a/libstdc++-v3/testsuite/27_io/filesystem/operations/absolute.cc +++ b/libstdc++-v3/testsuite/27_io/filesystem/operations/absolute.cc @@ -50,9 +50,37 @@ test02() VERIFY( absolute(p3) == (std::filesystem::current_path()/p3) ); } +void +test03() +{ + // PR libstdc++/90299 + const path p = __gnu_test::nonexistent_path(); + std::error_code ec; + const path pabs = absolute(p, ec); + VERIFY( !ec ); + VERIFY( pabs.is_absolute() ); + + const path pabs2 = absolute(p); + VERIFY( pabs2 == pabs ); + + const path eabs = absolute(path{}, ec); + VERIFY( ec == std::errc::invalid_argument ); + VERIFY( eabs.empty() ); + + try { + absolute(path{}); + VERIFY( false ); + } catch (const std::filesystem::filesystem_error& e) { + VERIFY( e.code() == std::errc::invalid_argument ); + VERIFY( e.path1().empty() ); + VERIFY( e.path2().empty() ); + } +} + int main() { test01(); test02(); + test03(); } |