authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2025-05-11 01:24:47 -07:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2025-05-11 01:24:47 -07:00
log704861215f786c2189335713b7d211ac2837e2ad
tree3b64b3f31d98805bdd0b87bbc654528903ddbdbd
parent122061ae22ce9980d90499277cf03f5d39b8894a

conform to ziginfra


4 files changed, 46 insertions(+), 19 deletions(-)

build.zig created+22
......@@ -0,0 +1,22 @@
1const std = @import("std");
2const deps = @import("./deps.zig");
3
4pub fn build(b: *std.Build) void {
5 const target = b.standardTargetOptions(.{});
6 const mode = b.option(std.builtin.Mode, "mode", "") orelse .Debug;
7 const disable_llvm = b.option(bool, "disable_llvm", "use the non-llvm zig codegen") orelse false;
8
9 const tests = b.addTest(.{
10 .root_source_file = b.path("test.zig"),
11 .target = target,
12 .optimize = mode,
13 });
14 deps.addAllTo(tests);
15 tests.use_llvm = !disable_llvm;
16 tests.use_lld = !disable_llvm;
17
18 const test_step = b.step("test", "Run all library tests");
19 const tests_run = b.addRunArtifact(tests);
20 tests_run.has_side_effects = true;
21 test_step.dependOn(&tests_run.step);
22}
licenses.txt created+3
......@@ -0,0 +1,3 @@
1MIT:
2= https://spdx.org/licenses/MIT
3- This
mod.zig-19
......@@ -30,22 +30,3 @@ pub fn lookup(entity: []const u8) ?Entity {
3030 }
3131 return null;
3232}
33
34test "entities" {
35 try testing.expectEqual(@as(usize, 2231), ENTITIES.len);
36
37 const aelig = lookup("&AElig").?;
38 try testing.expectEqualStrings("&AElig", aelig.entity);
39 try testing.expectEqual(Codepoints{ .Single = 198 }, aelig.codepoints);
40 try testing.expectEqualStrings("Æ", aelig.characters);
41
42 const afr = lookup("&Afr;").?;
43 try testing.expectEqualStrings("&Afr;", afr.entity);
44 try testing.expectEqual(Codepoints{ .Single = 120068 }, afr.codepoints);
45 try testing.expectEqualStrings("𝔄", afr.characters);
46
47 const bnequiv = lookup("&bnequiv;").?;
48 try testing.expectEqualStrings("&bnequiv;", bnequiv.entity);
49 try testing.expectEqual(Codepoints{ .Double = [2]u32{ 8801, 8421 } }, bnequiv.codepoints);
50 try testing.expectEqualStrings("\u{2261}\u{20E5}", bnequiv.characters);
51}
test.zig created+21
......@@ -0,0 +1,21 @@
1const std = @import("std");
2const htmlentities = @import("htmlentities");
3
4test {
5 try std.testing.expectEqual(@as(usize, 2231), htmlentities.ENTITIES.len);
6
7 const aelig = htmlentities.lookup("&AElig").?;
8 try std.testing.expectEqualStrings("&AElig", aelig.entity);
9 try std.testing.expectEqual(htmlentities.Codepoints{ .Single = 198 }, aelig.codepoints);
10 try std.testing.expectEqualStrings("Æ", aelig.characters);
11
12 const afr = htmlentities.lookup("&Afr;").?;
13 try std.testing.expectEqualStrings("&Afr;", afr.entity);
14 try std.testing.expectEqual(htmlentities.Codepoints{ .Single = 120068 }, afr.codepoints);
15 try std.testing.expectEqualStrings("𝔄", afr.characters);
16
17 const bnequiv = htmlentities.lookup("&bnequiv;").?;
18 try std.testing.expectEqualStrings("&bnequiv;", bnequiv.entity);
19 try std.testing.expectEqual(htmlentities.Codepoints{ .Double = [2]u32{ 8801, 8421 } }, bnequiv.codepoints);
20 try std.testing.expectEqualStrings("\u{2261}\u{20E5}", bnequiv.characters);
21}