summaryrefslogtreecommitdiff
path: root/test/fs_namespace.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-06 15:58:05 -0300
committerGabriel Schneider <[email protected]>2026-11-06 17:53:43 -0300
commit2ddd5bcbe8d470c00b045af5822418fe429357bc (patch)
tree47d837b2151a7393bdcf5ba362b8c2f6bf457f55 /test/fs_namespace.zig
parente9f9f65ace7650a02cee6bf2b2eb466522485834 (diff)
downloadpardes-2ddd5bcbe8d470c00b045af5822418fe429357bc.tar.gz
pardes-2ddd5bcbe8d470c00b045af5822418fe429357bc.zip
kinds #37, tests and docs for ABI 3: the image dump tests reopen from the path (through the same /n/os mount, and a file gone waits saying so until a watch or a Look opens it), the PDF view tests assert the art words in every view and each view told, /addons says 3.0 and a 2.2 fake is refused, reference.typ's Addons section and the changelog say ABI 3
Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
Diffstat (limited to 'test/fs_namespace.zig')
-rw-r--r--test/fs_namespace.zig16
1 files changed, 11 insertions, 5 deletions
diff --git a/test/fs_namespace.zig b/test/fs_namespace.zig
index 22ce27fe..fa6657eb 100644
--- a/test/fs_namespace.zig
+++ b/test/fs_namespace.zig
@@ -285,7 +285,7 @@ test "owned cwd failed file opens never publish a pane or retain a reservation"
try std.testing.expect(succeeded);
}
-test "images decode through explicit filesystem mounts, and a dump reads one on disk from there" {
+test "images decode through explicit filesystem mounts, and a dump's pane reads its file again through the same mount" {
if (!filesystem.platform_has_fs) return error.SkipZigTest;
const gpa = std.testing.allocator;
var tmp = std.testing.tmpDir(.{});
@@ -310,13 +310,19 @@ test "images decode through explicit filesystem mounts, and a dump reads one on
try std.testing.expectEqual(@as(usize, 1), shown.len);
try std.testing.expectEqual(@as(u32, 1), shown[0].raster.w);
try std.testing.expectEqual(@as(u32, 1), shown[0].raster.h);
- // The picture's bytes are in the dump: it comes back as it was shown
- // (a placeholder holding them, as a core without the addon keeps it).
+ // The dump keeps its path, not its bytes: restored, it reads the file
+ // again through the mount its path names, and shows the same pixel.
try pardes.dump.dumpState(p);
- const restored = try pardes.dump.initFromDump(gpa, .{ .tty_only = true }, p.dump_out.?);
+ var words: [64]pardes.Kind.LoadedWord = undefined;
+ const k = p.kinds.byName("image").?;
+ const brought = [_]pardes.Kind.Loaded{pardes.Kind.loadedOf(p.kinds.ops[k].?, p.kinds.kinds[k].path.slice(), p.kinds.kinds[k].hash, &words)};
+ const restored = try pardes.dump.initFromDump(gpa, .{ .tty_only = true, .addons = &brought }, p.dump_out.?);
defer restored.deinit();
const slot = for (restored.panes) |pane| {
if (pane) |each| if (each.addon) |s| break s;
} else return error.NoImagePane;
- try std.testing.expectEqualStrings(bytes, slot.record.?);
+ try std.testing.expect(slot.record == null and slot.live and std.mem.eql(u8, slot.path, path));
+ while (restored.nextEffect()) |e| if (e == .job) restored.perform(e);
+ _ = try restored.render(arena.allocator());
+ try std.testing.expectEqual(@as(u32, 1), restored.surface.placements.items[0].raster.w);
}