diff options
Diffstat (limited to 'src/ninep/ctl.zig')
| -rw-r--r-- | src/ninep/ctl.zig | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/ninep/ctl.zig b/src/ninep/ctl.zig index 9a95a10f..549aa265 100644 --- a/src/ninep/ctl.zig +++ b/src/ninep/ctl.zig @@ -2525,6 +2525,21 @@ test "Kill with a name and nothing running says so and does not fail, as bare Ki try testing.expect(th.logHas(p, "Kill: nothing running")); } +test "a restored pane whose file is gone from disk comes back dirty, and Del asks first" { + if (comptime !pardes.hosted) return error.SkipZigTest; + const p = try withFile(testing.allocator, "kept text\n"); + defer p.deinit(); + try pane_files.nameBuffer(p, 0, "/tmp/pardes-restore-gone-xyz/f.txt", false); + try pardes.dump.dumpState(p); + const restored = try pardes.dump.restore(p, p.dump_out.?, "/tmp/pardes.dump.zon"); + defer restored.deinit(); + const again = restored.panes[restored.paneBySerial(restored.panes[0].?.serial).?].?; + try testing.expect(again.file.?.disk_gone); + const r = wr(restored, Node.of(again.serial, .ctl), "Del\n"); + try testing.expectEqual(Status.err, r.reply.status); + try testing.expect(std.mem.indexOf(u8, r.reply.ename, "Modified") != null); +} + test "a line starting with # runs as nothing at an exec or a ctl, silently" { const p = try withFile(testing.allocator, "x\n"); defer p.deinit(); |
