diff options
Diffstat (limited to 'src/ninep')
| -rw-r--r-- | src/ninep/ctl.zig | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/ninep/ctl.zig b/src/ninep/ctl.zig index f8391672..e0c4b21b 100644 --- a/src/ninep/ctl.zig +++ b/src/ninep/ctl.zig @@ -1777,6 +1777,22 @@ test "exec Save writes the named file through the host" { try testing.expectEqualStrings(pane.file.?.content, p.fallback.get("/tmp/renamed.txt").?); } +test "a refusal's +Unsaved goes in the session's directory when the active pane's directory is not there" { + if (comptime !pardes.hosted) return; + const p = try withFile(testing.allocator, "x\n"); + defer p.deinit(); + const serial = serialOf(p); + try testing.expectEqual(Status.ok, wr(p, Node.of(serial, .name), "/tmp/pardes-no-such-dir-zz/x.txt\n").reply.status); + try testing.expectEqual(Status.ok, wr(p, Node.of(serial, .body), "edited\n").reply.status); + try testing.expectEqual(Status.err, wr(p, @intFromEnum(tree.TopFile.ctl), "Exit\n").reply.status); + const unsaved = for (p.panes) |slot| { + const pane = slot orelse continue; + const f = pane.file orelse continue; + if (f.output) |o| if (o.from == .unsaved) break f.path; + } else return error.NoUnsavedPane; + try testing.expectEqualStrings(p.sessionDir(), std.fs.path.dirname(unsaved).?); +} + test "a look at a file it may not read fails the write naming the file" { if (comptime !pardes.hosted) return; const p = try withFile(testing.allocator, "x\n"); |
