| author | |
| committer | |
| log | 704861215f786c2189335713b7d211ac2837e2ad |
| tree | 3b64b3f31d98805bdd0b87bbc654528903ddbdbd |
| parent | 122061ae22ce9980d90499277cf03f5d39b8894a |
4 files changed, 46 insertions(+), 19 deletions(-)
build.zig created+22| ... | ... | @@ -0,0 +1,22 @@ |
| 1 | const std = @import("std"); | |
| 2 | const deps = @import("./deps.zig"); | |
| 3 | ||
| 4 | pub 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 @@ |
| 1 | MIT: | |
| 2 | = https://spdx.org/licenses/MIT | |
| 3 | - This |
mod.zig-19| ... | ... | @@ -30,22 +30,3 @@ pub fn lookup(entity: []const u8) ?Entity { |
| 30 | 30 | } |
| 31 | 31 | return null; |
| 32 | 32 | } |
| 33 | ||
| 34 | test "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("𝔄").?; | |
| 43 | try testing.expectEqualStrings("𝔄", afr.entity); | |
| 44 | try testing.expectEqual(Codepoints{ .Single = 120068 }, afr.codepoints); | |
| 45 | try testing.expectEqualStrings("𝔄", afr.characters); | |
| 46 | ||
| 47 | const bnequiv = lookup("≡⃥").?; | |
| 48 | try testing.expectEqualStrings("≡⃥", 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 @@ |
| 1 | const std = @import("std"); | |
| 2 | const htmlentities = @import("htmlentities"); | |
| 3 | ||
| 4 | test { | |
| 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("𝔄").?; | |
| 13 | try std.testing.expectEqualStrings("𝔄", 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("≡⃥").?; | |
| 18 | try std.testing.expectEqualStrings("≡⃥", 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 | } |