diff options
Diffstat (limited to 'test/test_directory.cpp')
-rw-r--r-- | test/test_directory.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/test/test_directory.cpp b/test/test_directory.cpp index 6597195..c2af281 100644 --- a/test/test_directory.cpp +++ b/test/test_directory.cpp @@ -109,26 +109,27 @@ TEST(FudDirectory, Basic) ASSERT_EQ(writeResult.status, expected.status); } - Directory directory{testDirName}; - ASSERT_EQ(directory.status(), FudStatus::Success); + auto directoryResult{Directory::make(testDirName)}; + ASSERT_TRUE(directoryResult.isOkay()); + Directory directory{directoryResult.takeOkay()}; ASSERT_EQ(directory.errorCode(), 0); const Array<DirectoryEntry, 4> expectedFiles{ DirectoryEntry{String::makeFromCString(".").takeOkay(), 0, 0, 2, 0, DirectoryEntryType::Directory}, DirectoryEntry{String::makeFromCString("..").takeOkay(), 0, 0, 1, 0, DirectoryEntryType::Directory}, - DirectoryEntry{files[0], 0, files[0].size(), 1, 0, DirectoryEntryType::RegularFile}, - DirectoryEntry{files[1], 0, files[1].size(), 1, 0, DirectoryEntryType::RegularFile}, + DirectoryEntry{String::from(files[0]).takeOkay(), 0, files[0].size(), 1, 0, DirectoryEntryType::RegularFile}, + DirectoryEntry{String::from(files[1]).takeOkay(), 0, files[1].size(), 1, 0, DirectoryEntryType::RegularFile}, }; ASSERT_TRUE(expectedFiles[0].name.compare(expectedFiles[0].name)); for (auto idx = 0; idx < expectedFiles.size(); ++idx) { auto dirEntryResult = directory.getNextEntry(); EXPECT_TRUE(dirEntryResult.isOkay()); - const auto dirEntryOpt = dirEntryResult.getOkay(); + auto dirEntryOpt = dirEntryResult.takeOkay(); if (dirEntryOpt == std::nullopt) { break; } - const auto dirEntry = *dirEntryOpt; + auto dirEntry{std::move(dirEntryOpt.value())}; const auto* expected = std::find_if( expectedFiles.begin(), expectedFiles.end(), |