authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2026-04-26 16:51:26 -07:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2026-04-26 16:51:26 -07:00
log9b2cba2c75b31e504c4eb4f4b4d9d9387c70dae0
tree1005f964ea2fe2e6dbd0a6a5e4b35344e7895eca
parent47e2b130df4bedaab6b76ba380ccca1b0222b321
signaturebadge-check Signed by SSH key SHA256:4hHJbtBRU58AYXwjL7fkz2fnQHdiye8x1QpTCQ0sHNw

fix test

format and toString replaced with nprint in 20cd84586cb6f62f15411d47e7e17ef65ef336a3

1 files changed, 1 insertions(+), 35 deletions(-)

test.zig+1-35
...@@ -747,9 +747,7 @@ test {...@@ -747,9 +747,7 @@ test {
747 const S = struct {747 const S = struct {
748 name: []const u8,748 name: []const u8,
749749
750 pub fn format(s: @This(), comptime fmt: []const u8, options: std.fmt.FormatOptions, writer: anytype) !void {750 pub fn nprint(s: @This(), writer: anytype) !void {
751 _ = fmt;
752 _ = options;
753 try writer.writeAll(s.name);751 try writer.writeAll(s.name);
754 try writer.writeAll(".com");752 try writer.writeAll(".com");
755 }753 }
...@@ -776,38 +774,6 @@ test {...@@ -776,38 +774,6 @@ test {
776 \\774 \\
777 );775 );
778}776}
779test {
780 const S = struct {
781 name: []const u8,
782
783 pub fn toString(s: @This(), alloc: std.mem.Allocator) ![]const u8 {
784 return std.fmt.allocPrint(alloc, "{s}.com", .{s.name});
785 }
786 };
787 var arena = std.heap.ArenaAllocator.init(std.testing.allocator);
788 defer arena.deinit();
789 const alloc = arena.allocator();
790 var builder = std.ArrayList(u8).init(alloc);
791 defer builder.deinit();
792 const doc = comptime pek.parse(
793 \\body(
794 \\ p("This host for this link is "a[href=("https://"{host}"/nektro/zig-pek")]("dynamic")".")
795 \\)
796 );
797 try pek.compileInner(
798 alloc,
799 builder.writer(),
800 doc,
801 .{ .Ctx = @This(), .indent = 0, .doindent = true, .doindent2 = true },
802 .{ .host = S{ .name = "github" } },
803 );
804 try expect(builder.items).toEqualString(
805 \\<body>
806 \\ <p>This host for this link is <a href="https://github.com/nektro/zig-pek">dynamic</a>.</p>
807 \\</body>
808 \\
809 );
810}
811777
812// raw replacement778// raw replacement
813test {779test {