diff options
author | Tor Egge <Tor.Egge@online.no> | 2022-06-01 19:12:45 +0200 |
---|---|---|
committer | Tor Egge <Tor.Egge@online.no> | 2022-06-01 19:12:45 +0200 |
commit | 4a326e9d3c040b9670d0de3a08add5036df19796 (patch) | |
tree | 1f1c6d31bfc5f182376421a2838ae94f7e0b7876 /vespalib/src/tests | |
parent | 2bb6689c54b39e4b11d3085c0c7a70179ece0347 (diff) |
Convert vespalib::rmdir to a deprecated shim.
Diffstat (limited to 'vespalib/src/tests')
-rw-r--r-- | vespalib/src/tests/io/fileutil/fileutiltest.cpp | 19 |
1 files changed, 4 insertions, 15 deletions
diff --git a/vespalib/src/tests/io/fileutil/fileutiltest.cpp b/vespalib/src/tests/io/fileutil/fileutiltest.cpp index 189bfef349b..51cf2055d33 100644 --- a/vespalib/src/tests/io/fileutil/fileutiltest.cpp +++ b/vespalib/src/tests/io/fileutil/fileutiltest.cpp @@ -1,9 +1,11 @@ // Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include <vespa/vespalib/io/fileutil.h> #include <vespa/vespalib/testkit/test_kit.h> +#include <filesystem> #include <iostream> #include <vector> #include <regex> +#include <system_error> #include <vespa/vespalib/util/exceptions.h> #include <vespa/vespalib/util/size_literals.h> @@ -237,9 +239,9 @@ TEST("require that vespalib::mkdir and vespalib::rmdir works") ASSERT_TRUE(mkdir("mydir/otherdir/evenmorestuff")); rmdir("mydir"); TEST_FATAL("Should not work without recursive option set"); - } catch (IoException& e) { + } catch (std::filesystem::filesystem_error& e) { //std::cerr << e.what() << "\n"; - EXPECT_EQUAL(IoException::DIRECTORY_HAVE_CONTENT, e.getType()); + EXPECT_EQUAL(make_error_code(std::errc::directory_not_empty), e.code()); } // Works with recursive option { @@ -247,19 +249,6 @@ TEST("require that vespalib::mkdir and vespalib::rmdir works") ASSERT_TRUE(!fileExists("mydir")); ASSERT_TRUE(!rmdir("mydir", true)); } - // Doesn't work on file - try{ - { - File f("myfile"); - f.open(File::CREATE); - f.write("foo", 3, 0); - } - rmdir("myfile"); - TEST_FATAL("Should have failed to run rmdir on file."); - } catch (IoException& e) { - //std::cerr << e.what() << "\n"; - EXPECT_EQUAL(IoException::ILLEGAL_PATH, e.getType()); - } // mkdir works when a path component is a symlink which points to // another directory and the final path component does not exist. |