mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-30 12:49:19 +00:00
headless-browser: Restore ability to rebaseline new tests
This regressed in commit 6eca60504e
.
If we are rebaslining tests, do not fail if we are unable to open the
expectation file for reading.
This commit is contained in:
parent
d80d951991
commit
10853898fc
Notes:
github-actions[bot]
2024-10-09 11:27:44 +00:00
Author: https://github.com/trflynn89
Commit: 10853898fc
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1693
Reviewed-by: https://github.com/awesomekling ✅
1 changed files with 5 additions and 3 deletions
|
@ -348,15 +348,17 @@ static void run_dump_test(HeadlessWebContentView& view, Test& test, URL::URL con
|
|||
};
|
||||
|
||||
ByteBuffer expectation;
|
||||
{
|
||||
auto expectation_file = TRY(open_expectation_file(Core::File::OpenMode::Read));
|
||||
expectation = TRY(expectation_file->read_until_eof());
|
||||
|
||||
if (auto expectation_file = open_expectation_file(Core::File::OpenMode::Read); !expectation_file.is_error()) {
|
||||
expectation = TRY(expectation_file.value()->read_until_eof());
|
||||
|
||||
auto result_trimmed = StringView { test.text }.trim("\n"sv, TrimMode::Right);
|
||||
auto expectation_trimmed = StringView { expectation }.trim("\n"sv, TrimMode::Right);
|
||||
|
||||
if (result_trimmed == expectation_trimmed)
|
||||
return TestResult::Pass;
|
||||
} else if (!Application::the().rebaseline) {
|
||||
return expectation_file.release_error();
|
||||
}
|
||||
|
||||
if (Application::the().rebaseline) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue