diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-10 03:35:02 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-10 04:08:29 -0300 |
| commit | a9529fa5712298e9005b77b471400529a2ebbc32 (patch) | |
| tree | 50633449f495e32f0a263277c260c7bef1a0db4d /test/hxdiff.zig | |
| parent | c40b95b8f938e01b7e8846bae53f16b0c1cd5654 (diff) | |
| download | pardes-a9529fa5712298e9005b77b471400529a2ebbc32.tar.gz pardes-a9529fa5712298e9005b77b471400529a2ebbc32.zip | |
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 <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
Diffstat (limited to 'test/hxdiff.zig')
| -rw-r--r-- | test/hxdiff.zig | 8 |
1 files changed, 7 insertions, 1 deletions
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; |
