mirror of
https://github.com/lightpanda-io/browser.git
synced 2025-10-29 07:03:29 +00:00
Remove setup/teardown functionality. YAGNI
This commit is contained in:
@@ -56,15 +56,6 @@ pub fn main() !void {
|
||||
const printer = Printer.init();
|
||||
printer.fmt("\r\x1b[0K", .{}); // beginning of line and clear to end of line
|
||||
|
||||
for (builtin.test_functions) |t| {
|
||||
if (isSetup(t)) {
|
||||
t.func() catch |err| {
|
||||
printer.status(.fail, "\nsetup \"{s}\" failed: {}\n", .{ t.name, err });
|
||||
return err;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
for (builtin.test_functions) |t| {
|
||||
if (std.mem.eql(u8, t.name, "unit_tests.test_0")) {
|
||||
// don't display anything for this test
|
||||
@@ -72,10 +63,6 @@ pub fn main() !void {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (isSetup(t) or isTeardown(t)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
var status = Status.pass;
|
||||
slowest.startTiming();
|
||||
|
||||
@@ -138,15 +125,6 @@ pub fn main() !void {
|
||||
}
|
||||
}
|
||||
|
||||
for (builtin.test_functions) |t| {
|
||||
if (isTeardown(t)) {
|
||||
t.func() catch |err| {
|
||||
printer.status(.fail, "\nteardown \"{s}\" failed: {}\n", .{ t.name, err });
|
||||
return err;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
const total_tests = pass + fail;
|
||||
const status = if (fail == 0) Status.pass else Status.fail;
|
||||
printer.status(status, "\n{d} of {d} test{s} passed\n", .{ pass, total_tests, if (total_tests != 1) "s" else "" });
|
||||
@@ -316,14 +294,6 @@ fn isUnnamed(t: std.builtin.TestFn) bool {
|
||||
return true;
|
||||
}
|
||||
|
||||
fn isSetup(t: std.builtin.TestFn) bool {
|
||||
return std.mem.endsWith(u8, t.name, "tests:beforeAll");
|
||||
}
|
||||
|
||||
fn isTeardown(t: std.builtin.TestFn) bool {
|
||||
return std.mem.endsWith(u8, t.name, "tests:afterAll");
|
||||
}
|
||||
|
||||
fn serverHTTP(listener: *std.net.Server) !void {
|
||||
var read_buffer: [1024]u8 = undefined;
|
||||
ACCEPT: while (true) {
|
||||
|
||||
Reference in New Issue
Block a user