Add ability use script as cwd.

This commit is contained in:
Greyson Parrelli
2026-08-13 08:51:03 -04:00
parent e16b147e16
commit 0836cbc772
6 changed files with 526 additions and 8 deletions
+21
View File
@@ -63,4 +63,25 @@ pub fn build(b: *std.Build) void {
run_cmd.step.dependOn(b.getInstallStep());
if (b.args) |args| run_cmd.addArgs(args);
b.step("run", "Run the app").dependOn(&run_cmd.step);
// Tests are rooted at Layouts.zig rather than main.zig: the parts of this
// app worth testing in isolation are the ones that are pure data — layout
// parsing, parameter substitution, the `$(...)` expansion and the script
// runner underneath it. Everything else is a widget tree, which wants a
// display and a person looking at it.
//
// Rooting there also keeps the test binary off GTK entirely; Layouts.zig
// and script.zig reach for GLib and nothing above it.
const tests = b.addTest(.{
.root_module = b.createModule(.{
.root_source_file = b.path("src/Layouts.zig"),
.target = target,
.optimize = optimize,
.link_libc = true,
}),
});
tests.root_module.addImport("glib", gobject.module("glib2"));
const run_tests = b.addRunArtifact(tests);
b.step("test", "Run the tests").dependOn(&run_tests.step);
}