From 07dd719e3eb77df96ec574dfbe988932a77bd001 Mon Sep 17 00:00:00 2001 From: Ben Wiederhake Date: Sat, 13 May 2023 18:40:42 +0200 Subject: [PATCH] LibCodeComprehension: Prefer File::read_until_eof over DeprecatedFile Note that LibTest/Macros.h and therefore the macro TRY_OR_FAIL are not available, so using these would require some in-depth rework. release_value_but_fixme_should_propagate_errors should generate a reasonably obvious hint that the test didn't find some expected file. Note that I intentionally did not choose MUST(), since it should be a TRY_OR_FAIL() in some form. --- Userland/Libraries/LibCodeComprehension/Cpp/Tests.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Userland/Libraries/LibCodeComprehension/Cpp/Tests.cpp b/Userland/Libraries/LibCodeComprehension/Cpp/Tests.cpp index 15e0211408b..5fb9f6530db 100644 --- a/Userland/Libraries/LibCodeComprehension/Cpp/Tests.cpp +++ b/Userland/Libraries/LibCodeComprehension/Cpp/Tests.cpp @@ -89,9 +89,8 @@ int run_tests() static void add_file(FileDB& filedb, DeprecatedString const& name) { - auto file = Core::DeprecatedFile::open(LexicalPath::join(TESTS_ROOT_DIR, name).string(), Core::OpenMode::ReadOnly); - VERIFY(!file.is_error()); - filedb.add(name, DeprecatedString::copy(file.value()->read_all())); + auto file = Core::File::open(LexicalPath::join(TESTS_ROOT_DIR, name).string(), Core::File::OpenMode::Read).release_value_but_fixme_should_propagate_errors(); + filedb.add(name, DeprecatedString::copy(MUST(file->read_until_eof()))); } void test_complete_local_args()