From a9529fa5712298e9005b77b471400529a2ebbc32 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Tue, 10 Nov 2026 03:35:02 -0300 Subject: hxdiff: a case may name its file pane ("path", whose extension picks the grammar), and test/hxcases/indent.jsonl pins the new line's indent in a Zig, a Python, a Rust and a plain-text file against the reference helix with its grammars, typed into a real hx in a pty by hx_indent.py since the harness runs without any; zig build hxdiff runs it before the suite Co-Authored-By: Claude Fable 5.1 Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge --- test/hxdiff.zig | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'test/hxdiff.zig') diff --git a/test/hxdiff.zig b/test/hxdiff.zig index 5c1bc04e..010cc674 100644 --- a/test/hxdiff.zig +++ b/test/hxdiff.zig @@ -201,6 +201,8 @@ pub fn main(init: std.process.Init) !void { const Case = struct { name: []const u8, pane: []const u8 = "file", + /// the file pane's name, whose extension picks its grammar + path: ?[]const u8 = null, text: []const u8, keys: []const u8, }; @@ -303,7 +305,11 @@ fn runCase(arena: std.mem.Allocator, case: Case, pane_kind: []const u8) !Result pump(core); if (std.mem.eql(u8, pane_kind, "file")) { - _ = try core.setTestFile(case.text); + const pane = try core.setTestFile(case.text); + if (case.path) |path| { + core.gpa.free(pane.file.?.path); + pane.file.?.path = try core.gpa.dupe(u8, path); + } } else if (std.mem.eql(u8, pane_kind, "tty")) { // the harness is the pty here: cook \n to \r\n the way ONLCR would const cooked_len = std.math.add(usize, case.text.len, std.mem.count(u8, case.text, "\n")) catch return error.OutOfMemory; -- cgit v1.3