diff options
Diffstat (limited to 'test/fs_namespace.zig')
| -rw-r--r-- | test/fs_namespace.zig | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/test/fs_namespace.zig b/test/fs_namespace.zig index 6ee50f77..22ce27fe 100644 --- a/test/fs_namespace.zig +++ b/test/fs_namespace.zig @@ -1,6 +1,5 @@ const std = @import("std"); const pardes = @import("pardes"); -const image = pardes.image; const filesystem = pardes.filesystem; test "runtime Mount and Unmount copy command arguments and change Look resolution" { @@ -289,8 +288,6 @@ test "owned cwd failed file opens never publish a pane or retain a reservation" test "images decode through explicit filesystem mounts, and a dump reads one on disk from there" { if (!filesystem.platform_has_fs) return error.SkipZigTest; const gpa = std.testing.allocator; - pardes.image.start(std.testing.io, gpa); - defer pardes.image.stop(); var tmp = std.testing.tmpDir(.{}); defer tmp.cleanup(); const bytes = "P6\n1 1\n255\n\x0d\x4d\xe7"; @@ -299,22 +296,27 @@ test "images decode through explicit filesystem mounts, and a dump reads one on const directory_len = try tmp.dir.realPath(std.testing.io, &directory_buffer); const path = try std.fmt.allocPrint(gpa, "/n/os{s}/pixel.ppm", .{directory_buffer[0..directory_len]}); defer gpa.free(path); - const p = try pardes.Pardes.init(gpa, .{ .tty_only = true, .file = path }); + const p = try pardes.Pardes.init(gpa, .{ .tty_only = true }); defer p.deinit(); + // The image addon loaded, as `Addon load` loads it; the picture looked at. + pardes.Addon.perform(p, .load, 0, @import("test_addons").image); + pardes.look.lookAt(p, 0, path); var arena = std.heap.ArenaAllocator.init(gpa); defer arena.deinit(); // Its decode is a job its host runs: here, at once. - while (p.nextEffect()) |e| p.perform(e); + while (p.nextEffect()) |e| if (e == .job) p.perform(e); _ = try p.render(arena.allocator()); const shown = p.surface.placements.items; 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. + // 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). try pardes.dump.dumpState(p); const restored = try pardes.dump.initFromDump(gpa, .{ .tty_only = true }, p.dump_out.?); defer restored.deinit(); - const slot = restored.panes[0].?.addon.?; - var kept: [64]u8 = undefined; - try std.testing.expectEqualStrings(bytes, kept[0..image.kind.dump.?(slot.st, &kept, kept.len)]); + 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.?); } |
