From 70ce54a5cd5e8615542cb193253e97709b3ca262 Mon Sep 17 00:00:00 2001 From: Karl Seguin Date: Mon, 25 Aug 2025 10:40:23 +0800 Subject: [PATCH] Handle all case status (not just Pass and Fail) --- src/main_wpt.zig | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/main_wpt.zig b/src/main_wpt.zig index 80ff62fd..0dfc86c1 100644 --- a/src/main_wpt.zig +++ b/src/main_wpt.zig @@ -274,14 +274,24 @@ const Writer = struct { case_pass_count += 1; } else { // both cases names and messages can have | in them. Our only - // chance to "parse" this is to anchor off the |Fail. - const pos = std.mem.indexOf(u8, line, "|Fail") orelse { + // chance to "parse" this is to anchor off the |$Status. + const statuses = [_][]const u8{ "|Fail", "|Timeout", "|Not Run", "|Optional Feature Unsupported" }; + var pos_: ?usize = null; + var message_start: usize = 0; + for (statuses) |status| { + if (std.mem.indexOf(u8, line, status)) |idx| { + pos_ = idx; + message_start = idx + status.len; + break; + } + } + const pos = pos_ orelse { std.debug.print("invalid result line: {s}\n", .{line}); return error.InvalidResult; }; case_name = line[0..pos]; - case_message = line[pos + 1 ..]; + case_message = line[message_start..]; pass = false; case_fail_count += 1; }