1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-14 09:34:59 +00:00

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.
This commit is contained in:
Ben Wiederhake 2023-05-13 18:40:42 +02:00 committed by Jelle Raaijmakers
parent 41b45d5599
commit 07dd719e3e

View file

@ -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()