summaryrefslogtreecommitdiff
path: root/build.zig
diff options
context:
space:
mode:
Diffstat (limited to 'build.zig')
-rw-r--r--build.zig33
1 files changed, 33 insertions, 0 deletions
diff --git a/build.zig b/build.zig
index 6a9d4d9f..063e364e 100644
--- a/build.zig
+++ b/build.zig
@@ -1269,6 +1269,39 @@ pub fn build(b: *std.Build) void {
const hxdiff_step = b.step("hxdiff", "compare Helix results (-- --strict cases reference [waivers]; cases alone emits; --parity: a pty pane against a file pane)");
hxdiff_step.dependOn(&run_hxdiff.step);
+ // The same cases on the library (src/lib_editor.zig): test/hxlib.zig
+ // types them into an editor value and prints its results, which
+ // hxdiff holds against helix's goldens, or with `-- --parity`
+ // against the file pane, so the library cannot drift from either.
+ const hxlib = b.addExecutable(.{
+ .name = "pardes-hxlib",
+ .root_module = b.createModule(.{
+ .target = target,
+ .optimize = optimize,
+ .root_source_file = b.path("test/hxlib.zig"),
+ .link_libc = true,
+ }),
+ });
+ hxlib.root_module.addImport("pardes-editor", editorModule(b, null, target, optimize, shell_cfg, .{
+ .themes = themes_mod,
+ .tree_sitter = ts_mod,
+ .ts_libs = ts_libs.items,
+ .ts_queries = ts_queries_opts,
+ .uucode = uucode_mod,
+ .mvzr = mvzr_mod,
+ .vaxis = vaxis_mod,
+ }));
+ const run_hxlib = b.addRunArtifact(hxlib);
+ run_hxlib.addArgs(&.{ "test/hxcases/cases.jsonl", "test/hxcases/parity.jsonl" });
+ run_hxlib.setCwd(b.path("."));
+ run_hxlib.has_side_effects = true;
+ const run_hxdiff_lib = b.addRunArtifact(hxdiff);
+ run_hxdiff_lib.has_side_effects = true;
+ run_hxdiff_lib.addPrefixedFileArg("--actual=", run_hxlib.captureStdOut(.{}));
+ run_hxdiff_lib.addPassthruArgs();
+ run_hxdiff_lib.setCwd(b.path("."));
+ b.step("hxlib", "hxdiff's cases on the library, against helix's goldens (-- --parity: against the file pane)").dependOn(&run_hxdiff_lib.step);
+
const helix_harness = b.option([]const u8, "helix-harness", "path to the reference hx-harness executable") orelse
b.graph.environ_map.get("HX_HARNESS") orelse "hx-harness";
const reference = b.addSystemCommand(&.{helix_harness});