summaryrefslogtreecommitdiff
path: root/src/ninep/ctl.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/ninep/ctl.zig')
-rw-r--r--src/ninep/ctl.zig10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/ninep/ctl.zig b/src/ninep/ctl.zig
index a14b1efb..63f89cdf 100644
--- a/src/ninep/ctl.zig
+++ b/src/ninep/ctl.zig
@@ -2691,8 +2691,16 @@ test "a restored pane whose file is gone from disk comes back dirty, and Del ask
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);
+ // On disk when dumped, gone by the Restore.
+ var tmp = testing.tmpDir(.{});
+ defer tmp.cleanup();
+ try tmp.dir.writeFile(testing.io, .{ .sub_path = "f.txt", .data = "kept text\n" });
+ var dir_buf: [4096]u8 = undefined;
+ const dir = dir_buf[0..try tmp.dir.realPath(testing.io, &dir_buf)];
+ var path_buf: [4200]u8 = undefined;
+ try pane_files.nameBuffer(p, 0, try std.fmt.bufPrint(&path_buf, "{s}/f.txt", .{dir}), false);
try pardes.dump.dumpState(p);
+ try tmp.dir.deleteFile(testing.io, "f.txt");
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).?].?;