summaryrefslogtreecommitdiff
path: root/test/panes.zig
diff options
context:
space:
mode:
Diffstat (limited to 'test/panes.zig')
-rw-r--r--test/panes.zig22
1 files changed, 11 insertions, 11 deletions
diff --git a/test/panes.zig b/test/panes.zig
index f221499b..740f4897 100644
--- a/test/panes.zig
+++ b/test/panes.zig
@@ -615,7 +615,7 @@ const TtySelectionTests = struct {
try std.testing.expectEqual(panes.Text.Mode.tty, pane.body.mode);
if (bracketed) p.update(.{ .output = .{ .pane = 0, .bytes = "\x1b[?2004h" } });
try std.testing.expectEqual(bracketed, panes.terminal.bracketedPaste(pane));
- p.registers.put(p.gpa, '"', "one\ntwo", 0, 1, true); // what a `y` anywhere left behind
+ try p.registers.put(p.gpa, '"', "one\ntwo", 0, 1, true); // what a `y` anywhere left behind
var buf: [256]u8 = undefined;
_ = childInput(p, &buf);
@@ -1111,7 +1111,7 @@ test "terminal edits and undo survive partial history clearing and whole-screen
pane.body.cur_col = 4;
pane.body.cur_pinned = true;
pane.body.vsel = .{ .active = true, .row = row, .col = 1 };
- panes.terminal.pushUndo(p, pane);
+ try panes.terminal.pushUndo(p, pane);
const overlay = pane.ovl.?;
pane.body.ed_redo[0] = .{
.ovl = .{ .row = overlay.row, .rows = overlay.rows, .text = try gpa.dupe(u8, overlay.text) },
@@ -1153,7 +1153,7 @@ test "terminal edits and undo survive partial history clearing and whole-screen
try std.testing.expectEqualStrings("edit one\nedit two", snapshot.ovl.?.text);
}
try std.testing.expectEqual(@as(usize, 2), pane.terminal.?.vt.screens.active.pages.countTrackedPins());
- panes.terminal.undoStep(p, pane, true);
+ try panes.terminal.undoStep(p, pane, true);
try std.testing.expectEqualStrings("edit one\nedit two", pane.ovl.?.text);
try std.testing.expectEqual(expected, pane.ovl.?.row);
}
@@ -1170,7 +1170,7 @@ test "terminal lower scroll regions do not move edits above them" {
pane.ovl = .{ .row = 1, .rows = 1, .text = try gpa.dupe(u8, "unsent") };
pane.body.cur_row = 1;
pane.body.cur_pinned = true;
- panes.terminal.pushUndo(p, pane);
+ try panes.terminal.pushUndo(p, pane);
const total = panes.terminal.scrollbar(pane).total;
var setup: [64]u8 = undefined;
const bytes = try std.fmt.bufPrint(&setup, "\x1b[4;{d}r\x1b[{d};1H", .{ pane.rows, pane.rows });
@@ -1210,7 +1210,7 @@ test "terminal eviction and lower-region scrolling in one read preserve a surviv
pane.ovl = .{ .row = old_row, .rows = 1, .text = try gpa.dupe(u8, "kept edit") };
pane.body.cur_row = old_row;
pane.body.cur_pinned = true;
- panes.terminal.pushUndo(p, pane);
+ try panes.terminal.pushUndo(p, pane);
const old_total = pages.total_rows;
var buf: [128]u8 = undefined;
const bytes = try std.fmt.bufPrint(&buf, "new\r\n\x1b[4;{d}r\x1b[{d};1Hregion\r\n", .{ pane.rows, pane.rows });
@@ -1356,7 +1356,7 @@ test "file history keeps its last undo_max steps, and an undo or redo with no me
const history = file.history;
for (0..pardes.memory.limits.undo_max + 2) |index| {
const next = try std.fmt.allocPrint(p.gpa, "{d}", .{index});
- panes.File.pushUndo(p, pane);
+ try panes.File.pushUndo(p, pane);
panes.File.setContent(p, file, next);
try std.testing.expectEqual(history, file.history);
}
@@ -1366,23 +1366,23 @@ test "file history keeps its last undo_max steps, and an undo or redo with no me
try std.testing.expectEqualStrings("1", j.entries.items[j.steps.items[0].first].removed);
// No memory for the bytes an undo keeps: nothing changes.
failing.fail_index = failing.alloc_index;
- panes.File.undoStep(p, pane, true);
+ try std.testing.expectError(error.OutOfMemory, panes.File.undoStep(p, pane, true));
try std.testing.expectEqualStrings("257", file.content);
try std.testing.expectEqual(pardes.memory.limits.undo_max, j.done);
failing.fail_index = std.math.maxInt(usize);
- panes.File.undoStep(p, pane, true);
+ try panes.File.undoStep(p, pane, true);
try std.testing.expectEqualStrings("256", file.content);
try std.testing.expectEqual(@as(usize, 1), j.steps.items.len - j.done);
failing.fail_index = failing.alloc_index;
- panes.File.undoStep(p, pane, false);
+ try std.testing.expectError(error.OutOfMemory, panes.File.undoStep(p, pane, false));
try std.testing.expectEqualStrings("256", file.content);
try std.testing.expectEqual(@as(usize, 1), j.steps.items.len - j.done);
failing.fail_index = std.math.maxInt(usize);
- panes.File.undoStep(p, pane, false);
+ try panes.File.undoStep(p, pane, false);
try std.testing.expectEqualStrings("257", file.content);
try std.testing.expectEqual(pardes.memory.limits.undo_max, j.done);
// Back through every step kept, and no further.
- for (0..pardes.memory.limits.undo_max + 1) |_| panes.File.undoStep(p, pane, true);
+ for (0..pardes.memory.limits.undo_max + 1) |_| try panes.File.undoStep(p, pane, true);
try std.testing.expectEqualStrings("1", file.content);
try std.testing.expectEqual(@as(usize, 0), j.done);
}