mirror of
https://github.com/lightpanda-io/browser.git
synced 2025-10-30 07:31:47 +00:00
wpt: extract filter on its own func
This commit is contained in:
@@ -91,6 +91,10 @@ pub fn main() !void {
|
||||
|
||||
if (safe) {
|
||||
for (list.items) |tc| {
|
||||
if (!shouldRun(filter.items, tc)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// TODO use std.ChildProcess.run after next zig upgrade.
|
||||
var child = std.ChildProcess.init(&.{ execname, tc }, alloc);
|
||||
child.stdin_behavior = .Ignore;
|
||||
@@ -138,7 +142,7 @@ pub fn main() !void {
|
||||
continue;
|
||||
}
|
||||
|
||||
// std.debug.print("{s}\n", .{stderr.items});
|
||||
std.debug.print("{s}\n", .{stderr.items});
|
||||
}
|
||||
|
||||
return;
|
||||
@@ -163,21 +167,8 @@ pub fn main() !void {
|
||||
var run: usize = 0;
|
||||
var failures: usize = 0;
|
||||
for (list.items) |tc| {
|
||||
if (filter.items.len > 0) {
|
||||
var match = false;
|
||||
for (filter.items) |f| {
|
||||
if (std.mem.startsWith(u8, tc, f)) {
|
||||
match = true;
|
||||
break;
|
||||
}
|
||||
if (std.mem.endsWith(u8, tc, f)) {
|
||||
match = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!match) {
|
||||
continue;
|
||||
}
|
||||
if (!shouldRun(filter.items, tc)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
run += 1;
|
||||
@@ -279,3 +270,19 @@ pub fn main() !void {
|
||||
std.os.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
fn shouldRun(filter: [][]const u8, tc: []const u8) bool {
|
||||
if (filter.len == 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
for (filter) |f| {
|
||||
if (std.mem.startsWith(u8, tc, f)) {
|
||||
return true;
|
||||
}
|
||||
if (std.mem.endsWith(u8, tc, f)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user