summaryrefslogtreecommitdiff
path: root/test/panes.zig
diff options
context:
space:
mode:
Diffstat (limited to 'test/panes.zig')
-rw-r--r--test/panes.zig61
1 files changed, 1 insertions, 60 deletions
diff --git a/test/panes.zig b/test/panes.zig
index 996accf1..fc3f7804 100644
--- a/test/panes.zig
+++ b/test/panes.zig
@@ -2297,7 +2297,7 @@ test "a prompt opens with one allocation" {
}
test "file history construction failures preserve existing panes" {
- const Case = enum { open, restore, output, tutor, replace };
+ const Case = enum { open, output, tutor, replace };
for (std.enums.values(Case)) |case| {
var succeeded = false;
for (0..32) |failure| {
@@ -2314,12 +2314,6 @@ test "file history construction failures preserve existing panes" {
failing.fail_index = failing.alloc_index + failure;
const result = switch (case) {
.open => panes.File.open(p, p.freeSlot().?, path, 0),
- .restore => panes.File.restore(p, 1, .{
- .kind = .file,
- .tag = "",
- .body = "",
- .file = .{ .path = "/restored.zig", .content = "restored\n" },
- }),
.output => panes.Output.open(p, p.freeSlot().?, "/", .{ .cmd = .Help }, "", incoming.?),
.tutor => p.openTutorView(1),
.replace => p.setTestFile("replacement\n"),
@@ -2405,39 +2399,6 @@ test "file history allocation precedes reading the served tree" {
}
}
-test "file history survives PDF fallback restoration and allocation failures" {
- const saved =
- \\.{
- \\ .screen = .{ .cols = 40, .rows = 12 },
- \\ .columns = .{.{ .panes = .{0} }},
- \\ .panes = .{.{
- \\ .kind = .image, .tag = "", .body = "",
- \\ .image = .{ .path = "/virtual/missing-history.pdf", .bytes_b64 = "cmF3" },
- \\ }},
- \\}
- ;
- var succeeded = false;
- for (0..256) |failure| {
- var failing = std.testing.FailingAllocator.init(std.testing.allocator, .{ .fail_index = failure });
- if (pardes.dump.initFromDump(failing.allocator(), .{ .tty_only = true }, saved)) |p| {
- defer p.deinit();
- const pane = p.panes[0].?;
- try std.testing.expect(pane.file != null);
- try std.testing.expectEqualStrings("raw", pane.file.?.content);
- try std.testing.expectEqual(@as(usize, 0), pane.file.?.history.undo_len);
- try std.testing.expectEqual(@as(usize, 0), pane.file.?.history.redo_len);
- if (!failing.has_induced_failure) {
- succeeded = true;
- break;
- }
- } else |err| {
- try std.testing.expect(failing.has_induced_failure);
- try std.testing.expect(err == error.OutOfMemory or err == error.WriteFailed);
- }
- }
- try std.testing.expect(succeeded);
-}
-
test "Save rearms renamed file watches only after a successful write" {
const Host = struct {
const Result = enum { success, failure, edited, replaced, closed };
@@ -2695,7 +2656,6 @@ const OutputTests = struct {
const max_arg = panes.Output.max_arg;
const State = panes.Output.State;
const setArg = panes.Output.setArg;
- const fromWord = panes.Output.fromWord;
const fillResults = panes.Output.fillResults;
test "Locations align Unicode paths by display width and preserve source indentation" {
@@ -3218,12 +3178,6 @@ const OutputTests = struct {
try std.testing.expect(!result.body.vsel.active and !result.body.msel.active);
}
- test "dump origins accept only builtins that actually own output panes" {
- try std.testing.expectEqual(Origin{ .cmd = .Help }, fromWord("Help").?);
- try std.testing.expect(fromWord("Kill") == null);
- try std.testing.expect(fromWord("Theme") == null);
- }
-
test "result refill identity retains the full bounded argument" {
const p = try Pardes.init(std.testing.allocator, .{
.tty_only = true,
@@ -3296,7 +3250,6 @@ const OutputTests = struct {
const ImageTests = struct {
const State = panes.Image.State;
- const restore = panes.Image.restore;
const toggleGlyphArt = panes.Image.toggleGlyphArt;
const togglePalette = panes.Image.togglePalette;
const toggleAscii = panes.Image.toggleAscii;
@@ -3315,18 +3268,6 @@ const ImageTests = struct {
);
}
- test "dump restore propagates malformed embedded image bytes" {
- const p = try pardes.Pardes.init(std.testing.allocator, .{ .tty_only = true });
- defer p.deinit();
- try std.testing.expect(p.panes[1] == null);
- try std.testing.expectError(error.InvalidCharacter, restore(p, 1, .{
- .kind = .image,
- .tag = "img /tmp/bad.ppm",
- .body = "",
- .image = .{ .path = "/tmp/bad.ppm", .bytes_b64 = "A..A" },
- }));
- try std.testing.expect(p.panes[1] == null);
- }
};
const PdfTests = struct {