mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-25 04:02:28 +03:00
headless-browser: Improve error on failure to open expectation file
Mostly to output the path of the file which failed to open. This is mostly helpful if you create a test, but forget to 'touch' the expectation path.
This commit is contained in:
parent
590f0f85e0
commit
25153703c9
Notes:
sideshowbarker
2024-07-17 05:23:40 +09:00
Author: https://github.com/shannonbooth Commit: https://github.com/SerenityOS/serenity/commit/25153703c9 Pull-request: https://github.com/SerenityOS/serenity/pull/20278
@ -240,7 +240,14 @@ static ErrorOr<TestResult> run_test(HeadlessWebContentView& view, StringView inp
|
||||
if (result.is_error())
|
||||
return result.release_error();
|
||||
|
||||
auto expectation_file = TRY(Core::File::open(expectation_path, Core::File::OpenMode::Read));
|
||||
auto expectation_file_or_error = Core::File::open(expectation_path, Core::File::OpenMode::Read);
|
||||
if (expectation_file_or_error.is_error()) {
|
||||
warnln("Failed opening '{}': {}", expectation_path, expectation_file_or_error.error());
|
||||
return expectation_file_or_error.release_error();
|
||||
}
|
||||
|
||||
auto expectation_file = expectation_file_or_error.release_value();
|
||||
|
||||
auto expectation = TRY(String::from_utf8(StringView(TRY(expectation_file->read_until_eof()).bytes())));
|
||||
|
||||
auto actual = result.release_value();
|
||||
|
Loading…
Reference in New Issue
Block a user