diff --git a/src/browser/dump.zig b/src/browser/dump.zig
index 961eea0f..23fff552 100644
--- a/src/browser/dump.zig
+++ b/src/browser/dump.zig
@@ -157,13 +157,25 @@ fn writeEscapedAttributeValue(writer: anytype, value: []const u8) !void {
const testing = std.testing;
test "dump.writeHTML" {
- try testWriteHTML("
Over 9000!
", "Over 9000!
");
+ try testWriteHTML(
+ "Over 9000!
",
+ "Over 9000!
",
+ );
- try testWriteHTML("", "");
+ try testWriteHTML(
+ "",
+ "",
+ );
- try testWriteHTML("< > &
", "< > &
");
+ try testWriteHTML(
+ "< > &
",
+ "< > &
",
+ );
- try testWriteHTML("wat?
", "wat?
");
+ try testWriteHTML(
+ "wat?
",
+ "wat?
",
+ );
try testWriteFullHTML(
\\
@@ -173,8 +185,12 @@ test "dump.writeHTML" {
, "It's over what?\n9000");
}
-fn testWriteHTML(comptime expected: []const u8, src: []const u8) !void {
- return testWriteFullHTML("\n" ++ expected ++ "\n", src);
+fn testWriteHTML(comptime expected_body: []const u8, src: []const u8) !void {
+ const expected =
+ "\n" ++
+ expected_body ++
+ "\n";
+ return testWriteFullHTML(expected, src);
}
fn testWriteFullHTML(comptime expected: []const u8, src: []const u8) !void {
diff --git a/src/generate.zig b/src/generate.zig
index 68e47607..ce4c4013 100644
--- a/src/generate.zig
+++ b/src/generate.zig
@@ -17,8 +17,14 @@
// along with this program. If not, see .
const std = @import("std");
+
+// ----
const Type = std.builtin.Type;
+// Union
+// -----
+
+// Generate a flatten tagged Union from a Tuple
pub fn Union(interfaces: anytype) type {
// @setEvalBranchQuota(10000);
const tuple = Tuple(interfaces){};
@@ -57,7 +63,7 @@ pub fn Union(interfaces: anytype) type {
.decls = &.{},
.is_exhaustive = true,
};
- const enum_T = @Type(std.builtin.Type{ .Enum = enum_info });
+ const enum_T = @Type(.{ .Enum = enum_info });
// third iteration to generate union type
var union_fields: [fields.len]Type.UnionField = undefined;
@@ -81,6 +87,12 @@ pub fn Union(interfaces: anytype) type {
} });
}
+// Tuple
+// -----
+
+// Flattens and depuplicates a list of nested tuples. For example
+// input: {A, B, {C, B, D}, {A, E}}
+// output {A, B, C, D, E}
pub fn Tuple(args: anytype) type {
@setEvalBranchQuota(100000);