diff options
Diffstat (limited to 'test/behaviour')
| -rw-r--r-- | test/behaviour/panes.zig | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/behaviour/panes.zig b/test/behaviour/panes.zig index b42cab76..67155776 100644 --- a/test/behaviour/panes.zig +++ b/test/behaviour/panes.zig @@ -903,3 +903,21 @@ test "panes: a rename colours a source its new name's language names, its text u try std.testing.expect(!std.mem.eql(u8, coloured[y * cols + x], plain[y * cols + x])); try s.expect(s.at("/pane/{d}/body", .{n}), "fn check() void {}\n"); } + +test "panes: the row after a file's last newline has ~ where a line number would be, as helix's has, and a last line with no newline has none after it" { + inline for (.{ .{ "one\ntwo\n", true }, .{ "one\ntwo", false } }) |case| { + var s = try Session.initFile(std.testing.allocator, case[0]); + defer s.deinit(); + const tag_row = (try s.where("/test.txt"))[1]; + var rows = std.mem.splitScalar(u8, try s.screen(), '\n'); + for (0..tag_row + 1) |_| _ = rows.next(); + var firsts: [3][]const u8 = undefined; + for (&firsts) |*first| { + var words = std.mem.tokenizeScalar(u8, rows.next() orelse "", ' '); + first.* = words.next() orelse ""; + } + try std.testing.expectEqualStrings("1", firsts[0]); + try std.testing.expectEqualStrings("2", firsts[1]); + try std.testing.expectEqual(case[1], std.mem.eql(u8, firsts[2], "~")); + } +} |
