authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2026-06-01 16:04:10 -07:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2026-06-01 16:04:10 -07:00
log0355ad1e9add0f411ccb92749ab809fb4277ca2b
treee4895e5e6b8a5897d67023734e15000283973af1
parentd6a5f02589e46e5adab2b7b530b4c9e2c6ce4edb
signaturebadge-check Signed by SSH key SHA256:4hHJbtBRU58AYXwjL7fkz2fnQHdiye8x1QpTCQ0sHNw

update to zig 0.15.2


4 files changed, 78 insertions(+), 74 deletions(-)

build.zig+6-4
...@@ -3,13 +3,15 @@ const deps = @import("./deps.zig");...@@ -3,13 +3,15 @@ const deps = @import("./deps.zig");
33
4pub fn build(b: *std.Build) void {4pub fn build(b: *std.Build) void {
5 const target = b.standardTargetOptions(.{});5 const target = b.standardTargetOptions(.{});
6 const mode = b.option(std.builtin.Mode, "mode", "") orelse .Debug;6 const mode = b.option(std.builtin.OptimizeMode, "mode", "") orelse .Debug;
7 const disable_llvm = b.option(bool, "disable_llvm", "use the non-llvm zig codegen") orelse false;7 const disable_llvm = b.option(bool, "disable_llvm", "use the non-llvm zig codegen") orelse false;
88
9 const tests = b.addTest(.{9 const tests = b.addTest(.{
10 .root_source_file = b.path("test.zig"),10 .root_module = b.createModule(.{
11 .target = target,11 .root_source_file = b.path("test.zig"),
12 .optimize = mode,12 .target = target,
13 .optimize = mode,
14 }),
13 });15 });
14 deps.addAllTo(tests);16 deps.addAllTo(tests);
15 tests.use_llvm = !disable_llvm;17 tests.use_llvm = !disable_llvm;
licenses.txt+1-1
...@@ -8,11 +8,11 @@ MIT:...@@ -8,11 +8,11 @@ MIT:
8= https://spdx.org/licenses/MIT8= https://spdx.org/licenses/MIT
9- git https://github.com/nektro/zig-expect9- git https://github.com/nektro/zig-expect
10- git https://github.com/nektro/zig-extras10- git https://github.com/nektro/zig-extras
11- git https://github.com/nektro/zig-htmlentities
11- git https://github.com/nektro/zig-sys-darwin12- git https://github.com/nektro/zig-sys-darwin
12- git https://github.com/nektro/zig-sys-linux13- git https://github.com/nektro/zig-sys-linux
13- git https://github.com/nektro/zig-time14- git https://github.com/nektro/zig-time
14- git https://github.com/nektro/zig-tracer15- git https://github.com/nektro/zig-tracer
15- git https://github.com/kivikakk/htmlentities.zig
1616
17Unspecified:17Unspecified:
18- system_lib c18- system_lib c
test.zig+69-68
...@@ -2,6 +2,7 @@ const std = @import("std");...@@ -2,6 +2,7 @@ const std = @import("std");
2const pek = @import("pek");2const pek = @import("pek");
3const expect = @import("expect").expect;3const expect = @import("expect").expect;
4const extras = @import("extras");4const extras = @import("extras");
5const nio = @import("nio");
56
6test {7test {
7 std.testing.refAllDeclsRecursive(pek);8 std.testing.refAllDeclsRecursive(pek);
...@@ -9,7 +10,7 @@ test {...@@ -9,7 +10,7 @@ test {
910
10test "document" {11test "document" {
11 const alloc = std.testing.allocator;12 const alloc = std.testing.allocator;
12 var builder = std.ArrayList(u8).init(alloc);13 var builder = nio.AllocatingWriter.init(alloc);
13 defer builder.deinit();14 defer builder.deinit();
14 const doc = comptime pek.parse(15 const doc = comptime pek.parse(
15 \\html[lang="en"](16 \\html[lang="en"](
...@@ -28,7 +29,7 @@ test "document" {...@@ -28,7 +29,7 @@ test "document" {
28 try pek.compile(29 try pek.compile(
29 @This(),30 @This(),
30 alloc,31 alloc,
31 builder.writer(),32 &builder,
32 doc,33 doc,
33 .{},34 .{},
34 );35 );
...@@ -52,7 +53,7 @@ test "document" {...@@ -52,7 +53,7 @@ test "document" {
5253
53test "apostrophe attribute string" {54test "apostrophe attribute string" {
54 const alloc = std.testing.allocator;55 const alloc = std.testing.allocator;
55 var builder = std.ArrayList(u8).init(alloc);56 var builder = nio.AllocatingWriter.init(alloc);
56 defer builder.deinit();57 defer builder.deinit();
57 const doc = comptime pek.parse(58 const doc = comptime pek.parse(
58 \\html[lang="en"](59 \\html[lang="en"](
...@@ -67,7 +68,7 @@ test "apostrophe attribute string" {...@@ -67,7 +68,7 @@ test "apostrophe attribute string" {
67 try pek.compile(68 try pek.compile(
68 @This(),69 @This(),
69 alloc,70 alloc,
70 builder.writer(),71 &builder,
71 doc,72 doc,
72 .{},73 .{},
73 );74 );
...@@ -87,7 +88,7 @@ test "apostrophe attribute string" {...@@ -87,7 +88,7 @@ test "apostrophe attribute string" {
8788
88test "fragment" {89test "fragment" {
89 const alloc = std.testing.allocator;90 const alloc = std.testing.allocator;
90 var builder = std.ArrayList(u8).init(alloc);91 var builder = nio.AllocatingWriter.init(alloc);
91 defer builder.deinit();92 defer builder.deinit();
92 const doc = comptime pek.parse(93 const doc = comptime pek.parse(
93 \\body(94 \\body(
...@@ -98,7 +99,7 @@ test "fragment" {...@@ -98,7 +99,7 @@ test "fragment" {
98 );99 );
99 try pek.compileInner(100 try pek.compileInner(
100 alloc,101 alloc,
101 builder.writer(),102 &builder,
102 doc,103 doc,
103 .{ .Ctx = @This(), .indent = 0, .doindent = true, .doindent2 = true },104 .{ .Ctx = @This(), .indent = 0, .doindent = true, .doindent2 = true },
104 .{},105 .{},
...@@ -115,7 +116,7 @@ test "fragment" {...@@ -115,7 +116,7 @@ test "fragment" {
115116
116test "if: basic" {117test "if: basic" {
117 const alloc = std.testing.allocator;118 const alloc = std.testing.allocator;
118 var builder = std.ArrayList(u8).init(alloc);119 var builder = nio.AllocatingWriter.init(alloc);
119 defer builder.deinit();120 defer builder.deinit();
120 const doc = comptime pek.parse(121 const doc = comptime pek.parse(
121 \\body(122 \\body(
...@@ -131,7 +132,7 @@ test "if: basic" {...@@ -131,7 +132,7 @@ test "if: basic" {
131 );132 );
132 try pek.compileInner(133 try pek.compileInner(
133 alloc,134 alloc,
134 builder.writer(),135 &builder,
135 doc,136 doc,
136 .{ .Ctx = @This(), .indent = 0, .doindent = true, .doindent2 = true },137 .{ .Ctx = @This(), .indent = 0, .doindent = true, .doindent2 = true },
137 .{ .foo = false, .bar = true },138 .{ .foo = false, .bar = true },
...@@ -148,7 +149,7 @@ test "if: basic" {...@@ -148,7 +149,7 @@ test "if: basic" {
148149
149test "if: optional" {150test "if: optional" {
150 const alloc = std.testing.allocator;151 const alloc = std.testing.allocator;
151 var builder = std.ArrayList(u8).init(alloc);152 var builder = nio.AllocatingWriter.init(alloc);
152 defer builder.deinit();153 defer builder.deinit();
153 const foo: ?u8 = null;154 const foo: ?u8 = null;
154 const bar: ?u8 = 24;155 const bar: ?u8 = 24;
...@@ -166,7 +167,7 @@ test "if: optional" {...@@ -166,7 +167,7 @@ test "if: optional" {
166 );167 );
167 try pek.compileInner(168 try pek.compileInner(
168 alloc,169 alloc,
169 builder.writer(),170 &builder,
170 doc,171 doc,
171 .{ .Ctx = @This(), .indent = 0, .doindent = true, .doindent2 = true },172 .{ .Ctx = @This(), .indent = 0, .doindent = true, .doindent2 = true },
172 .{ .foo = foo, .bar = bar },173 .{ .foo = foo, .bar = bar },
...@@ -184,7 +185,7 @@ test "if: optional" {...@@ -184,7 +185,7 @@ test "if: optional" {
184// if else185// if else
185test "if else + field access" {186test "if else + field access" {
186 const alloc = std.testing.allocator;187 const alloc = std.testing.allocator;
187 var builder = std.ArrayList(u8).init(alloc);188 var builder = nio.AllocatingWriter.init(alloc);
188 defer builder.deinit();189 defer builder.deinit();
189 const doc = comptime pek.parse(190 const doc = comptime pek.parse(
190 \\body(191 \\body(
...@@ -197,7 +198,7 @@ test "if else + field access" {...@@ -197,7 +198,7 @@ test "if else + field access" {
197 );198 );
198 try pek.compileInner(199 try pek.compileInner(
199 alloc,200 alloc,
200 builder.writer(),201 &builder,
201 doc,202 doc,
202 .{ .Ctx = @This(), .indent = 0, .doindent = true, .doindent2 = true },203 .{ .Ctx = @This(), .indent = 0, .doindent = true, .doindent2 = true },
203 .{ .bar = .{ .qux = false } },204 .{ .bar = .{ .qux = false } },
...@@ -213,7 +214,7 @@ test "if else + field access" {...@@ -213,7 +214,7 @@ test "if else + field access" {
213// ifnot214// ifnot
214test {215test {
215 const alloc = std.testing.allocator;216 const alloc = std.testing.allocator;
216 var builder = std.ArrayList(u8).init(alloc);217 var builder = nio.AllocatingWriter.init(alloc);
217 defer builder.deinit();218 defer builder.deinit();
218 const doc = comptime pek.parse(219 const doc = comptime pek.parse(
219 \\body(220 \\body(
...@@ -226,7 +227,7 @@ test {...@@ -226,7 +227,7 @@ test {
226 );227 );
227 try pek.compileInner(228 try pek.compileInner(
228 alloc,229 alloc,
229 builder.writer(),230 &builder,
230 doc,231 doc,
231 .{ .Ctx = @This(), .indent = 0, .doindent = true, .doindent2 = true },232 .{ .Ctx = @This(), .indent = 0, .doindent = true, .doindent2 = true },
232 .{ .bar = true },233 .{ .bar = true },
...@@ -240,7 +241,7 @@ test {...@@ -240,7 +241,7 @@ test {
240}241}
241test {242test {
242 const alloc = std.testing.allocator;243 const alloc = std.testing.allocator;
243 var builder = std.ArrayList(u8).init(alloc);244 var builder = nio.AllocatingWriter.init(alloc);
244 defer builder.deinit();245 defer builder.deinit();
245 const doc = comptime pek.parse(246 const doc = comptime pek.parse(
246 \\body(247 \\body(
...@@ -253,7 +254,7 @@ test {...@@ -253,7 +254,7 @@ test {
253 );254 );
254 try pek.compileInner(255 try pek.compileInner(
255 alloc,256 alloc,
256 builder.writer(),257 &builder,
257 doc,258 doc,
258 .{ .Ctx = @This(), .indent = 0, .doindent = true, .doindent2 = true },259 .{ .Ctx = @This(), .indent = 0, .doindent = true, .doindent2 = true },
259 .{ .bar = false },260 .{ .bar = false },
...@@ -268,7 +269,7 @@ test {...@@ -268,7 +269,7 @@ test {
268// ifnot optional269// ifnot optional
269test {270test {
270 const alloc = std.testing.allocator;271 const alloc = std.testing.allocator;
271 var builder = std.ArrayList(u8).init(alloc);272 var builder = nio.AllocatingWriter.init(alloc);
272 defer builder.deinit();273 defer builder.deinit();
273 const foo: ?u8 = null;274 const foo: ?u8 = null;
274 const doc = comptime pek.parse(275 const doc = comptime pek.parse(
...@@ -282,7 +283,7 @@ test {...@@ -282,7 +283,7 @@ test {
282 );283 );
283 try pek.compileInner(284 try pek.compileInner(
284 alloc,285 alloc,
285 builder.writer(),286 &builder,
286 doc,287 doc,
287 .{ .Ctx = @This(), .indent = 0, .doindent = true, .doindent2 = true },288 .{ .Ctx = @This(), .indent = 0, .doindent = true, .doindent2 = true },
288 .{ .foo = foo },289 .{ .foo = foo },
...@@ -298,7 +299,7 @@ test {...@@ -298,7 +299,7 @@ test {
298// ifequal299// ifequal
299test { // bool300test { // bool
300 const alloc = std.testing.allocator;301 const alloc = std.testing.allocator;
301 var builder = std.ArrayList(u8).init(alloc);302 var builder = nio.AllocatingWriter.init(alloc);
302 defer builder.deinit();303 defer builder.deinit();
303 const doc = comptime pek.parse(304 const doc = comptime pek.parse(
304 \\body(305 \\body(
...@@ -311,7 +312,7 @@ test { // bool...@@ -311,7 +312,7 @@ test { // bool
311 );312 );
312 try pek.compileInner(313 try pek.compileInner(
313 alloc,314 alloc,
314 builder.writer(),315 &builder,
315 doc,316 doc,
316 .{ .Ctx = @This(), .indent = 0, .doindent = true, .doindent2 = true },317 .{ .Ctx = @This(), .indent = 0, .doindent = true, .doindent2 = true },
317 .{ .bar = true },318 .{ .bar = true },
...@@ -325,7 +326,7 @@ test { // bool...@@ -325,7 +326,7 @@ test { // bool
325}326}
326test { // bool false327test { // bool false
327 const alloc = std.testing.allocator;328 const alloc = std.testing.allocator;
328 var builder = std.ArrayList(u8).init(alloc);329 var builder = nio.AllocatingWriter.init(alloc);
329 defer builder.deinit();330 defer builder.deinit();
330 const doc = comptime pek.parse(331 const doc = comptime pek.parse(
331 \\body(332 \\body(
...@@ -338,7 +339,7 @@ test { // bool false...@@ -338,7 +339,7 @@ test { // bool false
338 );339 );
339 try pek.compileInner(340 try pek.compileInner(
340 alloc,341 alloc,
341 builder.writer(),342 &builder,
342 doc,343 doc,
343 .{ .Ctx = @This(), .indent = 0, .doindent = true, .doindent2 = true },344 .{ .Ctx = @This(), .indent = 0, .doindent = true, .doindent2 = true },
344 .{ .bar = false },345 .{ .bar = false },
...@@ -352,7 +353,7 @@ test { // bool false...@@ -352,7 +353,7 @@ test { // bool false
352}353}
353test { // string354test { // string
354 const alloc = std.testing.allocator;355 const alloc = std.testing.allocator;
355 var builder = std.ArrayList(u8).init(alloc);356 var builder = nio.AllocatingWriter.init(alloc);
356 defer builder.deinit();357 defer builder.deinit();
357 const doc = comptime pek.parse(358 const doc = comptime pek.parse(
358 \\body(359 \\body(
...@@ -365,7 +366,7 @@ test { // string...@@ -365,7 +366,7 @@ test { // string
365 );366 );
366 try pek.compileInner(367 try pek.compileInner(
367 alloc,368 alloc,
368 builder.writer(),369 &builder,
369 doc,370 doc,
370 .{ .Ctx = @This(), .indent = 0, .doindent = true, .doindent2 = true },371 .{ .Ctx = @This(), .indent = 0, .doindent = true, .doindent2 = true },
371 .{ .bar = @as([]const u8, "foo") },372 .{ .bar = @as([]const u8, "foo") },
...@@ -379,7 +380,7 @@ test { // string...@@ -379,7 +380,7 @@ test { // string
379}380}
380test { // string false381test { // string false
381 const alloc = std.testing.allocator;382 const alloc = std.testing.allocator;
382 var builder = std.ArrayList(u8).init(alloc);383 var builder = nio.AllocatingWriter.init(alloc);
383 defer builder.deinit();384 defer builder.deinit();
384 const doc = comptime pek.parse(385 const doc = comptime pek.parse(
385 \\body(386 \\body(
...@@ -392,7 +393,7 @@ test { // string false...@@ -392,7 +393,7 @@ test { // string false
392 );393 );
393 try pek.compileInner(394 try pek.compileInner(
394 alloc,395 alloc,
395 builder.writer(),396 &builder,
396 doc,397 doc,
397 .{ .Ctx = @This(), .indent = 0, .doindent = true, .doindent2 = true },398 .{ .Ctx = @This(), .indent = 0, .doindent = true, .doindent2 = true },
398 .{ .bar = @as([]const u8, "qux") },399 .{ .bar = @as([]const u8, "qux") },
...@@ -406,7 +407,7 @@ test { // string false...@@ -406,7 +407,7 @@ test { // string false
406}407}
407test { // enum408test { // enum
408 const alloc = std.testing.allocator;409 const alloc = std.testing.allocator;
409 var builder = std.ArrayList(u8).init(alloc);410 var builder = nio.AllocatingWriter.init(alloc);
410 defer builder.deinit();411 defer builder.deinit();
411 const doc = comptime pek.parse(412 const doc = comptime pek.parse(
412 \\body(413 \\body(
...@@ -419,7 +420,7 @@ test { // enum...@@ -419,7 +420,7 @@ test { // enum
419 );420 );
420 try pek.compileInner(421 try pek.compileInner(
421 alloc,422 alloc,
422 builder.writer(),423 &builder,
423 doc,424 doc,
424 .{ .Ctx = @This(), .indent = 0, .doindent = true, .doindent2 = true },425 .{ .Ctx = @This(), .indent = 0, .doindent = true, .doindent2 = true },
425 .{ .bar = @as(enum { foo, bar, qux }, .foo) },426 .{ .bar = @as(enum { foo, bar, qux }, .foo) },
...@@ -433,7 +434,7 @@ test { // enum...@@ -433,7 +434,7 @@ test { // enum
433}434}
434test { // enum false435test { // enum false
435 const alloc = std.testing.allocator;436 const alloc = std.testing.allocator;
436 var builder = std.ArrayList(u8).init(alloc);437 var builder = nio.AllocatingWriter.init(alloc);
437 defer builder.deinit();438 defer builder.deinit();
438 const doc = comptime pek.parse(439 const doc = comptime pek.parse(
439 \\body(440 \\body(
...@@ -446,7 +447,7 @@ test { // enum false...@@ -446,7 +447,7 @@ test { // enum false
446 );447 );
447 try pek.compileInner(448 try pek.compileInner(
448 alloc,449 alloc,
449 builder.writer(),450 &builder,
450 doc,451 doc,
451 .{ .Ctx = @This(), .indent = 0, .doindent = true, .doindent2 = true },452 .{ .Ctx = @This(), .indent = 0, .doindent = true, .doindent2 = true },
452 .{ .bar = @as(enum { foo, bar, qux }, .qux) },453 .{ .bar = @as(enum { foo, bar, qux }, .qux) },
...@@ -462,7 +463,7 @@ test { // enum false...@@ -462,7 +463,7 @@ test { // enum false
462// ifnotequal463// ifnotequal
463test { // bool464test { // bool
464 const alloc = std.testing.allocator;465 const alloc = std.testing.allocator;
465 var builder = std.ArrayList(u8).init(alloc);466 var builder = nio.AllocatingWriter.init(alloc);
466 defer builder.deinit();467 defer builder.deinit();
467 const doc = comptime pek.parse(468 const doc = comptime pek.parse(
468 \\body(469 \\body(
...@@ -475,7 +476,7 @@ test { // bool...@@ -475,7 +476,7 @@ test { // bool
475 );476 );
476 try pek.compileInner(477 try pek.compileInner(
477 alloc,478 alloc,
478 builder.writer(),479 &builder,
479 doc,480 doc,
480 .{ .Ctx = @This(), .indent = 0, .doindent = true, .doindent2 = true },481 .{ .Ctx = @This(), .indent = 0, .doindent = true, .doindent2 = true },
481 .{ .bar = false },482 .{ .bar = false },
...@@ -489,7 +490,7 @@ test { // bool...@@ -489,7 +490,7 @@ test { // bool
489}490}
490test { // bool false491test { // bool false
491 const alloc = std.testing.allocator;492 const alloc = std.testing.allocator;
492 var builder = std.ArrayList(u8).init(alloc);493 var builder = nio.AllocatingWriter.init(alloc);
493 defer builder.deinit();494 defer builder.deinit();
494 const doc = comptime pek.parse(495 const doc = comptime pek.parse(
495 \\body(496 \\body(
...@@ -502,7 +503,7 @@ test { // bool false...@@ -502,7 +503,7 @@ test { // bool false
502 );503 );
503 try pek.compileInner(504 try pek.compileInner(
504 alloc,505 alloc,
505 builder.writer(),506 &builder,
506 doc,507 doc,
507 .{ .Ctx = @This(), .indent = 0, .doindent = true, .doindent2 = true },508 .{ .Ctx = @This(), .indent = 0, .doindent = true, .doindent2 = true },
508 .{ .bar = true },509 .{ .bar = true },
...@@ -516,7 +517,7 @@ test { // bool false...@@ -516,7 +517,7 @@ test { // bool false
516}517}
517test { // string518test { // string
518 const alloc = std.testing.allocator;519 const alloc = std.testing.allocator;
519 var builder = std.ArrayList(u8).init(alloc);520 var builder = nio.AllocatingWriter.init(alloc);
520 defer builder.deinit();521 defer builder.deinit();
521 const doc = comptime pek.parse(522 const doc = comptime pek.parse(
522 \\body(523 \\body(
...@@ -529,7 +530,7 @@ test { // string...@@ -529,7 +530,7 @@ test { // string
529 );530 );
530 try pek.compileInner(531 try pek.compileInner(
531 alloc,532 alloc,
532 builder.writer(),533 &builder,
533 doc,534 doc,
534 .{ .Ctx = @This(), .indent = 0, .doindent = true, .doindent2 = true },535 .{ .Ctx = @This(), .indent = 0, .doindent = true, .doindent2 = true },
535 .{ .bar = @as([]const u8, "qux") },536 .{ .bar = @as([]const u8, "qux") },
...@@ -543,7 +544,7 @@ test { // string...@@ -543,7 +544,7 @@ test { // string
543}544}
544test { // string false545test { // string false
545 const alloc = std.testing.allocator;546 const alloc = std.testing.allocator;
546 var builder = std.ArrayList(u8).init(alloc);547 var builder = nio.AllocatingWriter.init(alloc);
547 defer builder.deinit();548 defer builder.deinit();
548 const doc = comptime pek.parse(549 const doc = comptime pek.parse(
549 \\body(550 \\body(
...@@ -556,7 +557,7 @@ test { // string false...@@ -556,7 +557,7 @@ test { // string false
556 );557 );
557 try pek.compileInner(558 try pek.compileInner(
558 alloc,559 alloc,
559 builder.writer(),560 &builder,
560 doc,561 doc,
561 .{ .Ctx = @This(), .indent = 0, .doindent = true, .doindent2 = true },562 .{ .Ctx = @This(), .indent = 0, .doindent = true, .doindent2 = true },
562 .{ .bar = @as([]const u8, "foo") },563 .{ .bar = @as([]const u8, "foo") },
...@@ -570,7 +571,7 @@ test { // string false...@@ -570,7 +571,7 @@ test { // string false
570}571}
571test { // enum572test { // enum
572 const alloc = std.testing.allocator;573 const alloc = std.testing.allocator;
573 var builder = std.ArrayList(u8).init(alloc);574 var builder = nio.AllocatingWriter.init(alloc);
574 defer builder.deinit();575 defer builder.deinit();
575 const doc = comptime pek.parse(576 const doc = comptime pek.parse(
576 \\body(577 \\body(
...@@ -583,7 +584,7 @@ test { // enum...@@ -583,7 +584,7 @@ test { // enum
583 );584 );
584 try pek.compileInner(585 try pek.compileInner(
585 alloc,586 alloc,
586 builder.writer(),587 &builder,
587 doc,588 doc,
588 .{ .Ctx = @This(), .indent = 0, .doindent = true, .doindent2 = true },589 .{ .Ctx = @This(), .indent = 0, .doindent = true, .doindent2 = true },
589 .{ .bar = @as(enum { foo, bar, qux }, .qux) },590 .{ .bar = @as(enum { foo, bar, qux }, .qux) },
...@@ -597,7 +598,7 @@ test { // enum...@@ -597,7 +598,7 @@ test { // enum
597}598}
598test { // enum false599test { // enum false
599 const alloc = std.testing.allocator;600 const alloc = std.testing.allocator;
600 var builder = std.ArrayList(u8).init(alloc);601 var builder = nio.AllocatingWriter.init(alloc);
601 defer builder.deinit();602 defer builder.deinit();
602 const doc = comptime pek.parse(603 const doc = comptime pek.parse(
603 \\body(604 \\body(
...@@ -610,7 +611,7 @@ test { // enum false...@@ -610,7 +611,7 @@ test { // enum false
610 );611 );
611 try pek.compileInner(612 try pek.compileInner(
612 alloc,613 alloc,
613 builder.writer(),614 &builder,
614 doc,615 doc,
615 .{ .Ctx = @This(), .indent = 0, .doindent = true, .doindent2 = true },616 .{ .Ctx = @This(), .indent = 0, .doindent = true, .doindent2 = true },
616 .{ .bar = @as(enum { foo, bar, qux }, .foo) },617 .{ .bar = @as(enum { foo, bar, qux }, .foo) },
...@@ -626,7 +627,7 @@ test { // enum false...@@ -626,7 +627,7 @@ test { // enum false
626// replacement627// replacement
627test {628test {
628 const alloc = std.testing.allocator;629 const alloc = std.testing.allocator;
629 var builder = std.ArrayList(u8).init(alloc);630 var builder = nio.AllocatingWriter.init(alloc);
630 defer builder.deinit();631 defer builder.deinit();
631 const doc = comptime pek.parse(632 const doc = comptime pek.parse(
632 \\body(633 \\body(
...@@ -635,7 +636,7 @@ test {...@@ -635,7 +636,7 @@ test {
635 );636 );
636 try pek.compileInner(637 try pek.compileInner(
637 alloc,638 alloc,
638 builder.writer(),639 &builder,
639 doc,640 doc,
640 .{ .Ctx = @This(), .indent = 0, .doindent = true, .doindent2 = true },641 .{ .Ctx = @This(), .indent = 0, .doindent = true, .doindent2 = true },
641 .{ .text = @as([]const u8, "dynamic") },642 .{ .text = @as([]const u8, "dynamic") },
...@@ -649,7 +650,7 @@ test {...@@ -649,7 +650,7 @@ test {
649}650}
650test {651test {
651 const alloc = std.testing.allocator;652 const alloc = std.testing.allocator;
652 var builder = std.ArrayList(u8).init(alloc);653 var builder = nio.AllocatingWriter.init(alloc);
653 defer builder.deinit();654 defer builder.deinit();
654 const doc = comptime pek.parse(655 const doc = comptime pek.parse(
655 \\body(656 \\body(
...@@ -658,7 +659,7 @@ test {...@@ -658,7 +659,7 @@ test {
658 );659 );
659 try pek.compileInner(660 try pek.compileInner(
660 alloc,661 alloc,
661 builder.writer(),662 &builder,
662 doc,663 doc,
663 .{ .Ctx = @This(), .indent = 0, .doindent = true, .doindent2 = true },664 .{ .Ctx = @This(), .indent = 0, .doindent = true, .doindent2 = true },
664 .{ .url = @as([]const u8, "https://github.com/nektro/zig-pek") },665 .{ .url = @as([]const u8, "https://github.com/nektro/zig-pek") },
...@@ -672,7 +673,7 @@ test {...@@ -672,7 +673,7 @@ test {
672}673}
673test {674test {
674 const alloc = std.testing.allocator;675 const alloc = std.testing.allocator;
675 var builder = std.ArrayList(u8).init(alloc);676 var builder = nio.AllocatingWriter.init(alloc);
676 defer builder.deinit();677 defer builder.deinit();
677 const doc = comptime pek.parse(678 const doc = comptime pek.parse(
678 \\body(679 \\body(
...@@ -681,7 +682,7 @@ test {...@@ -681,7 +682,7 @@ test {
681 );682 );
682 try pek.compileInner(683 try pek.compileInner(
683 alloc,684 alloc,
684 builder.writer(),685 &builder,
685 doc,686 doc,
686 .{ .Ctx = @This(), .indent = 0, .doindent = true, .doindent2 = true },687 .{ .Ctx = @This(), .indent = 0, .doindent = true, .doindent2 = true },
687 .{ .host = @as([]const u8, "github.com") },688 .{ .host = @as([]const u8, "github.com") },
...@@ -695,7 +696,7 @@ test {...@@ -695,7 +696,7 @@ test {
695}696}
696test {697test {
697 const alloc = std.testing.allocator;698 const alloc = std.testing.allocator;
698 var builder = std.ArrayList(u8).init(alloc);699 var builder = nio.AllocatingWriter.init(alloc);
699 defer builder.deinit();700 defer builder.deinit();
700 const doc = comptime pek.parse(701 const doc = comptime pek.parse(
701 \\body(702 \\body(
...@@ -704,7 +705,7 @@ test {...@@ -704,7 +705,7 @@ test {
704 );705 );
705 try pek.compileInner(706 try pek.compileInner(
706 alloc,707 alloc,
707 builder.writer(),708 &builder,
708 doc,709 doc,
709 .{ .Ctx = @This(), .indent = 0, .doindent = true, .doindent2 = true },710 .{ .Ctx = @This(), .indent = 0, .doindent = true, .doindent2 = true },
710 .{ .host = "github.com".* },711 .{ .host = "github.com".* },
...@@ -718,7 +719,7 @@ test {...@@ -718,7 +719,7 @@ test {
718}719}
719test {720test {
720 const alloc = std.testing.allocator;721 const alloc = std.testing.allocator;
721 var builder = std.ArrayList(u8).init(alloc);722 var builder = nio.AllocatingWriter.init(alloc);
722 defer builder.deinit();723 defer builder.deinit();
723 const S = struct { x: []const u8, y: u32 };724 const S = struct { x: []const u8, y: u32 };
724 const text: S = .{ .x = "dynamic", .y = 47 };725 const text: S = .{ .x = "dynamic", .y = 47 };
...@@ -729,7 +730,7 @@ test {...@@ -729,7 +730,7 @@ test {
729 );730 );
730 try pek.compileInner(731 try pek.compileInner(
731 alloc,732 alloc,
732 builder.writer(),733 &builder,
733 doc,734 doc,
734 .{ .Ctx = @This(), .indent = 0, .doindent = true, .doindent2 = true },735 .{ .Ctx = @This(), .indent = 0, .doindent = true, .doindent2 = true },
735 .{ .text = &text },736 .{ .text = &text },
...@@ -753,7 +754,7 @@ test {...@@ -753,7 +754,7 @@ test {
753 }754 }
754 };755 };
755 const alloc = std.testing.allocator;756 const alloc = std.testing.allocator;
756 var builder = std.ArrayList(u8).init(alloc);757 var builder = nio.AllocatingWriter.init(alloc);
757 defer builder.deinit();758 defer builder.deinit();
758 const doc = comptime pek.parse(759 const doc = comptime pek.parse(
759 \\body(760 \\body(
...@@ -762,7 +763,7 @@ test {...@@ -762,7 +763,7 @@ test {
762 );763 );
763 try pek.compileInner(764 try pek.compileInner(
764 alloc,765 alloc,
765 builder.writer(),766 &builder,
766 doc,767 doc,
767 .{ .Ctx = @This(), .indent = 0, .doindent = true, .doindent2 = true },768 .{ .Ctx = @This(), .indent = 0, .doindent = true, .doindent2 = true },
768 .{ .host = S{ .name = "github" } },769 .{ .host = S{ .name = "github" } },
...@@ -778,7 +779,7 @@ test {...@@ -778,7 +779,7 @@ test {
778// raw replacement779// raw replacement
779test {780test {
780 const alloc = std.testing.allocator;781 const alloc = std.testing.allocator;
781 var builder = std.ArrayList(u8).init(alloc);782 var builder = nio.AllocatingWriter.init(alloc);
782 defer builder.deinit();783 defer builder.deinit();
783 const doc = comptime pek.parse(784 const doc = comptime pek.parse(
784 \\body(785 \\body(
...@@ -787,7 +788,7 @@ test {...@@ -787,7 +788,7 @@ test {
787 );788 );
788 try pek.compileInner(789 try pek.compileInner(
789 alloc,790 alloc,
790 builder.writer(),791 &builder,
791 doc,792 doc,
792 .{ .Ctx = @This(), .indent = 0, .doindent = true, .doindent2 = true },793 .{ .Ctx = @This(), .indent = 0, .doindent = true, .doindent2 = true },
793 .{ .url = "https://github.com/nektro/zig-pek".* },794 .{ .url = "https://github.com/nektro/zig-pek".* },
...@@ -801,7 +802,7 @@ test {...@@ -801,7 +802,7 @@ test {
801}802}
802test {803test {
803 const alloc = std.testing.allocator;804 const alloc = std.testing.allocator;
804 var builder = std.ArrayList(u8).init(alloc);805 var builder = nio.AllocatingWriter.init(alloc);
805 defer builder.deinit();806 defer builder.deinit();
806 const doc = comptime pek.parse(807 const doc = comptime pek.parse(
807 \\body(808 \\body(
...@@ -810,7 +811,7 @@ test {...@@ -810,7 +811,7 @@ test {
810 );811 );
811 try pek.compileInner(812 try pek.compileInner(
812 alloc,813 alloc,
813 builder.writer(),814 &builder,
814 doc,815 doc,
815 .{ .Ctx = @This(), .indent = 0, .doindent = true, .doindent2 = true },816 .{ .Ctx = @This(), .indent = 0, .doindent = true, .doindent2 = true },
816 .{ .foo = "contain HTML such as <button>this</button> as an escape hatch when you know content is safe".* },817 .{ .foo = "contain HTML such as <button>this</button> as an escape hatch when you know content is safe".* },
...@@ -844,7 +845,7 @@ test {...@@ -844,7 +845,7 @@ test {
844 var arena = std.heap.ArenaAllocator.init(std.testing.allocator);845 var arena = std.heap.ArenaAllocator.init(std.testing.allocator);
845 defer arena.deinit();846 defer arena.deinit();
846 const alloc = arena.allocator();847 const alloc = arena.allocator();
847 var builder = std.ArrayList(u8).init(alloc);848 var builder = nio.AllocatingWriter.init(alloc);
848 defer builder.deinit();849 defer builder.deinit();
849 var person: struct { name: []const u8 } = .{ .name = "meghan" };850 var person: struct { name: []const u8 } = .{ .name = "meghan" };
850 _ = &person;851 _ = &person;
...@@ -858,7 +859,7 @@ test {...@@ -858,7 +859,7 @@ test {
858 );859 );
859 try pek.compileInner(860 try pek.compileInner(
860 alloc,861 alloc,
861 builder.writer(),862 &builder,
862 doc,863 doc,
863 .{ .Ctx = C, .indent = 0, .doindent = true, .doindent2 = true },864 .{ .Ctx = C, .indent = 0, .doindent = true, .doindent2 = true },
864 .{ .prev = person },865 .{ .prev = person },
...@@ -891,7 +892,7 @@ test {...@@ -891,7 +892,7 @@ test {
891 var arena = std.heap.ArenaAllocator.init(std.testing.allocator);892 var arena = std.heap.ArenaAllocator.init(std.testing.allocator);
892 defer arena.deinit();893 defer arena.deinit();
893 const alloc = arena.allocator();894 const alloc = arena.allocator();
894 var builder = std.ArrayList(u8).init(alloc);895 var builder = nio.AllocatingWriter.init(alloc);
895 defer builder.deinit();896 defer builder.deinit();
896 var person: S = .{ .id = 0 };897 var person: S = .{ .id = 0 };
897 _ = &person;898 _ = &person;
...@@ -906,7 +907,7 @@ test {...@@ -906,7 +907,7 @@ test {
906 );907 );
907 try pek.compileInner(908 try pek.compileInner(
908 alloc,909 alloc,
909 builder.writer(),910 &builder,
910 doc,911 doc,
911 .{ .Ctx = C, .indent = 0, .doindent = true, .doindent2 = true },912 .{ .Ctx = C, .indent = 0, .doindent = true, .doindent2 = true },
912 .{ .user = person },913 .{ .user = person },
...@@ -931,7 +932,7 @@ test {...@@ -931,7 +932,7 @@ test {
931 var arena = std.heap.ArenaAllocator.init(std.testing.allocator);932 var arena = std.heap.ArenaAllocator.init(std.testing.allocator);
932 defer arena.deinit();933 defer arena.deinit();
933 const alloc = arena.allocator();934 const alloc = arena.allocator();
934 var builder = std.ArrayList(u8).init(alloc);935 var builder = nio.AllocatingWriter.init(alloc);
935 defer builder.deinit();936 defer builder.deinit();
936 var person: S = .{ .id = 25 };937 var person: S = .{ .id = 25 };
937 _ = &person;938 _ = &person;
...@@ -946,7 +947,7 @@ test {...@@ -946,7 +947,7 @@ test {
946 );947 );
947 try pek.compileInner(948 try pek.compileInner(
948 alloc,949 alloc,
949 builder.writer(),950 &builder,
950 doc,951 doc,
951 .{ .Ctx = C, .indent = 0, .doindent = true, .doindent2 = true },952 .{ .Ctx = C, .indent = 0, .doindent = true, .doindent2 = true },
952 .{ .user = person },953 .{ .user = person },
...@@ -962,7 +963,7 @@ test {...@@ -962,7 +963,7 @@ test {
962// each963// each
963test {964test {
964 const alloc = std.testing.allocator;965 const alloc = std.testing.allocator;
965 var builder = std.ArrayList(u8).init(alloc);966 var builder = nio.AllocatingWriter.init(alloc);
966 defer builder.deinit();967 defer builder.deinit();
967 const S = struct {968 const S = struct {
968 abbr: []const u8,969 abbr: []const u8,
...@@ -983,7 +984,7 @@ test {...@@ -983,7 +984,7 @@ test {
983 );984 );
984 try pek.compileInner(985 try pek.compileInner(
985 alloc,986 alloc,
986 builder.writer(),987 &builder,
987 doc,988 doc,
988 .{ .Ctx = @This(), .indent = 0, .doindent = true, .doindent2 = true },989 .{ .Ctx = @This(), .indent = 0, .doindent = true, .doindent2 = true },
989 .{ .states = &states },990 .{ .states = &states },
...@@ -1001,7 +1002,7 @@ test {...@@ -1001,7 +1002,7 @@ test {
1001// multi-each1002// multi-each
1002test {1003test {
1003 const alloc = std.testing.allocator;1004 const alloc = std.testing.allocator;
1004 var builder = std.ArrayList(u8).init(alloc);1005 var builder = nio.AllocatingWriter.init(alloc);
1005 defer builder.deinit();1006 defer builder.deinit();
1006 const S = struct {1007 const S = struct {
1007 abbr: []const u8,1008 abbr: []const u8,
...@@ -1022,7 +1023,7 @@ test {...@@ -1022,7 +1023,7 @@ test {
1022 );1023 );
1023 try pek.compileInner(1024 try pek.compileInner(
1024 alloc,1025 alloc,
1025 builder.writer(),1026 &builder,
1026 doc,1027 doc,
1027 .{ .Ctx = @This(), .indent = 0, .doindent = true, .doindent2 = true },1028 .{ .Ctx = @This(), .indent = 0, .doindent = true, .doindent2 = true },
1028 .{ .abbrs = states.items.abbr, .names = states.items.name },1029 .{ .abbrs = states.items.abbr, .names = states.items.name },
zig.mod+2-1
...@@ -4,7 +4,7 @@ main: src/lib.zig...@@ -4,7 +4,7 @@ main: src/lib.zig
4license: MPL-2.04license: MPL-2.0
5description: An HTML preprocessor with a builtin template engine.5description: An HTML preprocessor with a builtin template engine.
6dependencies:6dependencies:
7 - src: git https://github.com/kivikakk/htmlentities.zig commit-bd5d569a245c7c8e83812eadcb5761b7ba76ef047 - src: git https://github.com/nektro/zig-htmlentities
8 - src: git https://github.com/nektro/zig-extras8 - src: git https://github.com/nektro/zig-extras
9 - src: git https://github.com/nektro/zig-tracer9 - src: git https://github.com/nektro/zig-tracer
10 - src: git https://github.com/nektro/zig-nio10 - src: git https://github.com/nektro/zig-nio
...@@ -12,3 +12,4 @@ dependencies:...@@ -12,3 +12,4 @@ dependencies:
12root_dependencies:12root_dependencies:
13 - src: git https://github.com/nektro/zig-expect13 - src: git https://github.com/nektro/zig-expect
14 - src: git https://github.com/nektro/zig-extras14 - src: git https://github.com/nektro/zig-extras
15 - src: git https://github.com/nektro/zig-nio