From 35f18e584fae890f686eafcdc12a2fde6281206d Mon Sep 17 00:00:00 2001 From: Sam Atman Date: Tue, 29 Apr 2025 15:32:58 -0400 Subject: Add general tests step After a considerable slog, all tests are reachable from the test step, and pass. Almost every failure was related to the change away from the inclusion of an allocator on this or that. --- build.zig | 155 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 155 insertions(+) (limited to 'build.zig') diff --git a/build.zig b/build.zig index ce362ea..b555bd7 100644 --- a/build.zig +++ b/build.zig @@ -183,6 +183,14 @@ pub fn build(b: *std.Build) void { .optimize = optimize, }); + const code_point_t = b.addTest(.{ + .name = "code_point", + .root_module = code_point, + .target = target, + .optimize = optimize, + }); + const code_point_tr = b.addRunArtifact(code_point_t); + // Grapheme clusters const grapheme_data = b.createModule(.{ .root_source_file = b.path("src/GraphemeData.zig"), @@ -191,6 +199,14 @@ pub fn build(b: *std.Build) void { }); grapheme_data.addAnonymousImport("gbp", .{ .root_source_file = gbp_gen_out }); + const grapheme_data_t = b.addTest(.{ + .name = "grapheme_data", + .root_module = grapheme_data, + .target = target, + .optimize = optimize, + }); + const grapheme_data_tr = b.addRunArtifact(grapheme_data_t); + const grapheme = b.addModule("grapheme", .{ .root_source_file = b.path("src/grapheme.zig"), .target = target, @@ -199,6 +215,14 @@ pub fn build(b: *std.Build) void { grapheme.addImport("code_point", code_point); grapheme.addImport("GraphemeData", grapheme_data); + const grapheme_t = b.addTest(.{ + .name = "grapheme", + .root_module = grapheme, + .target = target, + .optimize = optimize, + }); + const grapheme_tr = b.addRunArtifact(grapheme_t); + // ASCII utilities const ascii = b.addModule("ascii", .{ .root_source_file = b.path("src/ascii.zig"), @@ -206,6 +230,14 @@ pub fn build(b: *std.Build) void { .optimize = optimize, }); + const ascii_t = b.addTest(.{ + .name = "ascii", + .root_module = ascii, + .target = target, + .optimize = optimize, + }); + const ascii_tr = b.addRunArtifact(ascii_t); + // Fixed pitch font display width const width_data = b.createModule(.{ .root_source_file = b.path("src/WidthData.zig"), @@ -215,6 +247,14 @@ pub fn build(b: *std.Build) void { width_data.addAnonymousImport("dwp", .{ .root_source_file = dwp_gen_out }); width_data.addImport("GraphemeData", grapheme_data); + const width_data_t = b.addTest(.{ + .name = "width_data", + .root_module = width_data, + .target = target, + .optimize = optimize, + }); + const width_data_tr = b.addRunArtifact(width_data_t); + const display_width = b.addModule("DisplayWidth", .{ .root_source_file = b.path("src/DisplayWidth.zig"), .target = target, @@ -226,6 +266,14 @@ pub fn build(b: *std.Build) void { display_width.addImport("DisplayWidthData", width_data); display_width.addOptions("options", options); // For testing + const display_width_t = b.addTest(.{ + .name = "display_width", + .root_module = display_width, + .target = target, + .optimize = optimize, + }); + const display_width_tr = b.addRunArtifact(display_width_t); + // Normalization const ccc_data = b.createModule(.{ .root_source_file = b.path("src/CombiningData.zig"), @@ -234,6 +282,14 @@ pub fn build(b: *std.Build) void { }); ccc_data.addAnonymousImport("ccc", .{ .root_source_file = ccc_gen_out }); + const ccc_data_t = b.addTest(.{ + .name = "ccc_data", + .root_module = ccc_data, + .target = target, + .optimize = optimize, + }); + const ccc_data_tr = b.addRunArtifact(ccc_data_t); + const canon_data = b.createModule(.{ .root_source_file = b.path("src/CanonData.zig"), .target = target, @@ -241,6 +297,14 @@ pub fn build(b: *std.Build) void { }); canon_data.addAnonymousImport("canon", .{ .root_source_file = canon_gen_out }); + const canon_data_t = b.addTest(.{ + .name = "canon_data", + .root_module = canon_data, + .target = target, + .optimize = optimize, + }); + const canon_data_tr = b.addRunArtifact(canon_data_t); + const compat_data = b.createModule(.{ .root_source_file = b.path("src/CompatData.zig"), .target = target, @@ -248,6 +312,14 @@ pub fn build(b: *std.Build) void { }); compat_data.addAnonymousImport("compat", .{ .root_source_file = compat_gen_out }); + const compat_data_t = b.addTest(.{ + .name = "compat_data", + .root_module = compat_data, + .target = target, + .optimize = optimize, + }); + const compat_data_tr = b.addRunArtifact(compat_data_t); + const hangul_data = b.createModule(.{ .root_source_file = b.path("src/HangulData.zig"), .target = target, @@ -255,6 +327,14 @@ pub fn build(b: *std.Build) void { }); hangul_data.addAnonymousImport("hangul", .{ .root_source_file = hangul_gen_out }); + const hangul_data_t = b.addTest(.{ + .name = "hangul_data", + .root_module = hangul_data, + .target = target, + .optimize = optimize, + }); + const hangul_data_tr = b.addRunArtifact(hangul_data_t); + const normp_data = b.createModule(.{ .root_source_file = b.path("src/NormPropsData.zig"), .target = target, @@ -262,6 +342,14 @@ pub fn build(b: *std.Build) void { }); normp_data.addAnonymousImport("normp", .{ .root_source_file = normp_gen_out }); + const normp_data_t = b.addTest(.{ + .name = "normp_data", + .root_module = normp_data, + .target = target, + .optimize = optimize, + }); + const normp_data_tr = b.addRunArtifact(normp_data_t); + const norm_data = b.createModule(.{ .root_source_file = b.path("src/NormData.zig"), .target = target, @@ -282,6 +370,14 @@ pub fn build(b: *std.Build) void { norm.addImport("code_point", code_point); norm.addImport("NormData", norm_data); + const norm_data_t = b.addTest(.{ + .name = "norm_data", + .root_module = norm_data, + .target = target, + .optimize = optimize, + }); + const norm_data_tr = b.addRunArtifact(norm_data_t); + // General Category const gencat_data = b.addModule("GenCatData", .{ .root_source_file = b.path("src/GenCatData.zig"), @@ -290,6 +386,14 @@ pub fn build(b: *std.Build) void { }); gencat_data.addAnonymousImport("gencat", .{ .root_source_file = gencat_gen_out }); + const gencat_data_t = b.addTest(.{ + .name = "gencat_data", + .root_module = gencat_data, + .target = target, + .optimize = optimize, + }); + const gencat_data_tr = b.addRunArtifact(gencat_data_t); + // Case folding const fold_data = b.createModule(.{ .root_source_file = b.path("src/FoldData.zig"), @@ -307,6 +411,14 @@ pub fn build(b: *std.Build) void { case_fold.addImport("FoldData", fold_data); case_fold.addImport("Normalize", norm); + const case_fold_t = b.addTest(.{ + .name = "case_fold", + .root_module = case_fold, + .target = target, + .optimize = optimize, + }); + const case_fold_tr = b.addRunArtifact(case_fold_t); + // Letter case const case_data = b.addModule("CaseData", .{ .root_source_file = b.path("src/CaseData.zig"), @@ -318,6 +430,14 @@ pub fn build(b: *std.Build) void { case_data.addAnonymousImport("upper", .{ .root_source_file = upper_gen_out }); case_data.addAnonymousImport("lower", .{ .root_source_file = lower_gen_out }); + const case_data_t = b.addTest(.{ + .name = "case_data", + .root_module = case_data, + .target = target, + .optimize = optimize, + }); + const case_data_tr = b.addRunArtifact(case_data_t); + // Scripts const scripts_data = b.addModule("ScriptsData", .{ .root_source_file = b.path("src/ScriptsData.zig"), @@ -326,6 +446,14 @@ pub fn build(b: *std.Build) void { }); scripts_data.addAnonymousImport("scripts", .{ .root_source_file = scripts_gen_out }); + const scripts_data_t = b.addTest(.{ + .name = "scripts_data", + .root_module = scripts_data, + .target = target, + .optimize = optimize, + }); + const scripts_data_tr = b.addRunArtifact(scripts_data_t); + // Properties const props_data = b.addModule("PropsData", .{ .root_source_file = b.path("src/PropsData.zig"), @@ -336,6 +464,14 @@ pub fn build(b: *std.Build) void { props_data.addAnonymousImport("props", .{ .root_source_file = props_gen_out }); props_data.addAnonymousImport("numeric", .{ .root_source_file = num_gen_out }); + const props_data_t = b.addTest(.{ + .name = "props_data", + .root_module = props_data, + .target = target, + .optimize = optimize, + }); + const props_data_tr = b.addRunArtifact(props_data_t); + // Unicode Tests const unicode_tests = b.addTest(.{ .root_source_file = b.path("src/unicode_tests.zig"), @@ -349,4 +485,23 @@ pub fn build(b: *std.Build) void { const unicode_test_step = b.step("unicode-test", "Run Unicode tests"); unicode_test_step.dependOn(&run_unicode_tests.step); + + const test_step = b.step("test", "Run general tests"); + test_step.dependOn(&code_point_tr.step); + test_step.dependOn(&grapheme_data_tr.step); + test_step.dependOn(&width_data_tr.step); + test_step.dependOn(&display_width_tr.step); + test_step.dependOn(&grapheme_tr.step); + test_step.dependOn(&ascii_tr.step); + test_step.dependOn(&ccc_data_tr.step); + test_step.dependOn(&canon_data_tr.step); + test_step.dependOn(&compat_data_tr.step); + test_step.dependOn(&hangul_data_tr.step); + test_step.dependOn(&normp_data_tr.step); + test_step.dependOn(&norm_data_tr.step); + test_step.dependOn(&gencat_data_tr.step); + test_step.dependOn(&case_fold_tr.step); + test_step.dependOn(&case_data_tr.step); + test_step.dependOn(&scripts_data_tr.step); + test_step.dependOn(&props_data_tr.step); } -- cgit v1.2.3