mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 06:27:45 +00: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
1 changed files with 8 additions and 1 deletions
|
@ -240,7 +240,14 @@ static ErrorOr<TestResult> run_test(HeadlessWebContentView& view, StringView inp
|
||||||
if (result.is_error())
|
if (result.is_error())
|
||||||
return result.release_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 expectation = TRY(String::from_utf8(StringView(TRY(expectation_file->read_until_eof()).bytes())));
|
||||||
|
|
||||||
auto actual = result.release_value();
|
auto actual = result.release_value();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue