test: refacto dump test units

This commit is contained in:
Pierre Tachoire
2024-02-28 14:40:31 +01:00
parent 810bd11a5b
commit 1c77d998c6
2 changed files with 9 additions and 13 deletions

View File

@@ -83,8 +83,10 @@ pub fn writeNode(root: *parser.Node, writer: anytype) !void {
} }
} }
// writeHTMLTestFn is run by run_tests.zig test "dump.writeHTML" {
pub fn writeHTMLTestFn(out: File) !void { const out = try std.fs.openFileAbsolute("/dev/null", .{ .mode = .write_only });
defer out.close();
const file = try std.fs.cwd().openFile("test.html", .{}); const file = try std.fs.cwd().openFile("test.html", .{});
defer file.close(); defer file.close();

View File

@@ -99,8 +99,11 @@ pub fn main() !void {
} }
test { test {
const TestAsync = @import("async/test.zig"); const AsyncTest = @import("async/test.zig");
std.testing.refAllDecls(TestAsync); std.testing.refAllDecls(AsyncTest);
const DumpTest = @import("browser/dump.zig");
std.testing.refAllDecls(DumpTest);
} }
test "jsruntime" { test "jsruntime" {
@@ -138,15 +141,6 @@ test "bug document html parsing #4" {
parser.documentHTMLClose(doc) catch {}; parser.documentHTMLClose(doc) catch {};
} }
const dump = @import("browser/dump.zig");
test "run browser tests" {
// const out = std.io.getStdOut();
const out = try std.fs.openFileAbsolute("/dev/null", .{ .mode = .write_only });
defer out.close();
try dump.HTMLFileTestFn(out);
}
test "Window is a libdom event target" { test "Window is a libdom event target" {
var window = Window.create(null); var window = Window.create(null);