terminal: TBC tests

This commit is contained in:
Mitchell Hashimoto
2023-10-09 10:01:23 -07:00
parent ed23f2f1d0
commit fc08f9ab17
2 changed files with 70 additions and 1 deletions

View File

@@ -1452,7 +1452,6 @@ pub fn horizontalTabBack(self: *Terminal) !void {
}
/// Clear tab stops.
/// TODO: test
pub fn tabClear(self: *Terminal, cmd: csi.TabClear) void {
switch (cmd) {
.current => self.tabstops.unset(self.screen.cursor.x),
@@ -5441,3 +5440,26 @@ test "Terminal: scrollDown left/right scroll region" {
try testing.expectEqualStrings("A 23\nDBC156\nGEF489\n HI7", str);
}
}
test "Terminal: tabClear single" {
const alloc = testing.allocator;
var t = try init(alloc, 30, 5);
defer t.deinit(alloc);
try t.horizontalTab();
t.tabClear(.current);
t.setCursorPos(1, 1);
try t.horizontalTab();
try testing.expectEqual(@as(usize, 16), t.screen.cursor.x);
}
test "Terminal: tabClear all" {
const alloc = testing.allocator;
var t = try init(alloc, 30, 5);
defer t.deinit(alloc);
t.tabClear(.all);
t.setCursorPos(1, 1);
try t.horizontalTab();
try testing.expectEqual(@as(usize, 29), t.screen.cursor.x);
}