summaryrefslogtreecommitdiff
path: root/test/hxlib.zig
diff options
context:
space:
mode:
Diffstat (limited to 'test/hxlib.zig')
-rw-r--r--test/hxlib.zig11
1 files changed, 8 insertions, 3 deletions
diff --git a/test/hxlib.zig b/test/hxlib.zig
index 423851d7..b6c1bfd3 100644
--- a/test/hxlib.zig
+++ b/test/hxlib.zig
@@ -4,8 +4,10 @@
//! against helix's goldens or the file pane (`zig build hxlib`). The
//! library does what an app would with the actions it hands back that a
//! case needs: s, S, K and Alt-K take the keys up to <ret> as their
-//! pattern. A case that reaches any other action (a view, `:`, `/`, LSP, a
-//! macro) is the app's from there: printed as skipped, with the role.
+//! pattern, and the tree-sitter walks run on the app's parse (a case's text
+//! has no grammar). A case that reaches any other action (a view, `:`,
+//! `/`, LSP, a macro) is the app's from there: printed as skipped, with the
+//! role.
const std = @import("std");
const pe = @import("pardes-editor");
const hxkeys = @import("hxkeys.zig");
@@ -60,6 +62,9 @@ pub fn main(init: std.process.Init) !void {
fn runCase(a: std.mem.Allocator, ed: *Ed, case: Case) ![]u8 {
ed.* = .{};
try ed.load(case.text);
+ // the app's parse: a case's text has no grammar (no path), so the
+ // tree-sitter walks run and leave the ranges, as a file pane's do
+ var syn: pe.Syntax = .{};
var i: usize = 0;
while (try hxkeys.next(pe.Key, case.keys, &i)) |k| {
// a page key in insert mode moves a view, which the library has not
@@ -67,7 +72,7 @@ fn runCase(a: std.mem.Allocator, ed: *Ed, case: Case) ![]u8 {
return std.json.Stringify.valueAlloc(a, Skip{ .name = case.name, .skip = "insert page key" }, .{});
var call = std.heap.ArenaAllocator.init(std.heap.page_allocator);
defer call.deinit();
- switch (ed.key(call.allocator(), k)) {
+ switch (ed.key(call.allocator(), &syn, k)) {
.done, .pending, .unbound => {},
.refused => |why| return std.json.Stringify.valueAlloc(a, Skip{ .name = case.name, .skip = @tagName(why) }, .{}),
.action => |act| switch (act.role) {