diff options
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; |
