headless-browser: Improve output for failing tests a bit

- Colorize the "Test failed" part when stdout is a TTY
- Add missing newlines in the output
This commit is contained in:
Andreas Kling 2023-06-12 11:51:28 +02:00
commit b86ca27692
Notes: sideshowbarker 2024-07-16 21:45:42 +09:00

View file

@ -243,7 +243,10 @@ static ErrorOr<TestResult> run_test(HeadlessWebContentView& view, StringView inp
bool color_output = isatty(STDOUT_FILENO);
dbgln("Test failed: {}", input_path);
if (color_output)
outln("\n\033[33;1mTest failed\033[0m: {}", input_path);
else
outln("\nTest failed: {}", input_path);
auto hunks = Diff::from_text(expectation, actual);
for (auto const& hunk : hunks) {