소스 검색

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.
Ben Wiederhake 2 년 전
부모
커밋
07dd719e3e
1개의 변경된 파일2개의 추가작업 그리고 3개의 파일을 삭제
  1. 2 3
      Userland/Libraries/LibCodeComprehension/Cpp/Tests.cpp

+ 2 - 3
Userland/Libraries/LibCodeComprehension/Cpp/Tests.cpp

@@ -89,9 +89,8 @@ int run_tests()
 
 
 static void add_file(FileDB& filedb, DeprecatedString const& name)
 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()
 void test_complete_local_args()