summaryrefslogtreecommitdiff
path: root/test/lib/build.zig
diff options
context:
space:
mode:
Diffstat (limited to 'test/lib/build.zig')
-rw-r--r--test/lib/build.zig24
1 files changed, 15 insertions, 9 deletions
diff --git a/test/lib/build.zig b/test/lib/build.zig
index 6cd8d6e5..6f590eda 100644
--- a/test/lib/build.zig
+++ b/test/lib/build.zig
@@ -1,18 +1,24 @@
//! A package that depends on pardes for its library, as a program that draws
//! source text itself would: pardes's `lib-test` step runs `zig build test`
//! here, so the `pardes-syntax` module is built the way such a package
-//! builds it (build.zig's `library`), with the minimal grammars.
+//! builds it (build.zig's `library`), with the minimal grammars, and
+//! `pardes-editor`, the text pane as a library, which it asks for.
const std = @import("std");
pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
- const pardes = b.dependency("pardes", .{ .target = target, .optimize = optimize, .@"tree-sitter" = .minimal });
- const tests = b.addTest(.{ .root_module = b.createModule(.{
- .target = target,
- .optimize = optimize,
- .root_source_file = b.path("lib.zig"),
- .imports = &.{.{ .name = "pardes-syntax", .module = pardes.module("pardes-syntax") }},
- }) });
- b.step("test", "colour, outline and walk a C and a Zig source through pardes's library").dependOn(&b.addRunArtifact(tests).step);
+ const pardes = b.dependency("pardes", .{ .target = target, .optimize = optimize, .@"tree-sitter" = .minimal, .editor = true });
+ const step = b.step("test", "colour, outline and walk a C and a Zig source through pardes's library, and edit a text with its editor");
+ // A file belongs to one module: the syntax alone, and the editor (which
+ // has it as `.syntax`), each a test of its own.
+ for ([_][2][]const u8{ .{ "lib.zig", "pardes-syntax" }, .{ "editor.zig", "pardes-editor" } }) |t| {
+ const tests = b.addTest(.{ .root_module = b.createModule(.{
+ .target = target,
+ .optimize = optimize,
+ .root_source_file = b.path(t[0]),
+ .imports = &.{.{ .name = t[1], .module = pardes.module(t[1]) }},
+ }) });
+ step.dependOn(&b.addRunArtifact(tests).step);
+ }
}