From 53c4dcf374c66f1e9190f5a62a52d02fe11a69e6 Mon Sep 17 00:00:00 2001 From: Dominick Allen Date: Wed, 16 Oct 2024 22:25:08 -0500 Subject: First crack at allocators. --- test/test_directory.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'test/test_directory.cpp') 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 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(), -- cgit v1.2.3