diff options
| author | Gabriel Schneider <[email protected]> | 2026-10-29 17:01:35 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-10-29 21:13:33 -0300 |
| commit | 70de5ec5ff3dad01afcc45244ad5e5a481486da6 (patch) | |
| tree | cd4b723dcc2cfd94c4ba2361c134927b0e2df60b /src/ninep/events.zig | |
| parent | 349790339897466f323ff28748916aa48aa344f7 (diff) | |
| download | pardes-70de5ec5ff3dad01afcc45244ad5e5a481486da6.tar.gz pardes-70de5ec5ff3dad01afcc45244ad5e5a481486da6.zip | |
dump: one walker dump of the whole session, by name across builds, for Restore, -l, Handover and the store; dump.zig's hand-written schema gone
A dump is walk.zig's walk of the core with a table of every type it reaches
(fields, enum and union names, number widths), read back by name; terminals
are ghostty's snapshot (screens, history, kitty images); a failed load frees
what it made.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/ninep/events.zig')
| -rw-r--r-- | src/ninep/events.zig | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/src/ninep/events.zig b/src/ninep/events.zig index 78788c3c..f24c6120 100644 --- a/src/ninep/events.zig +++ b/src/ninep/events.zig @@ -1305,27 +1305,23 @@ test "a Dump written and a Restore made are in the log, with their files" { var want: [64]u8 = undefined; try testing.expect(std.mem.indexOf(u8, log.bytes, try std.fmt.bufPrint(&want, "{s} /tmp/pardes.dump.zon\n", .{what})) != null); } - // The replacement's last says which serial each pane had. - const log = try freezeLog(restored); - defer restored.gpa.free(log.bytes); - var want: [64]u8 = undefined; - try testing.expect(std.mem.indexOf(u8, log.bytes, try std.fmt.bufPrint(&want, "restore /tmp/pardes.dump.zon\nrestored {d} {d}\n", .{ p.panes[0].?.serial, restored.panes[0].?.serial })) != null); - // ...and each column's: restoredcol <old> <new>. - try testing.expect(std.mem.endsWith(u8, log.bytes, try std.fmt.bufPrint(&want, "restoredcol {d} {d}\n", .{ pardes.layout.columnSerial(p, 0), pardes.layout.columnSerial(restored, 0) }))); + // Its panes and columns are the dump's, serials and all. + try testing.expectEqual(p.panes[0].?.serial, restored.panes[0].?.serial); + try testing.expectEqual(pardes.layout.columnSerial(p, 0), pardes.layout.columnSerial(restored, 0)); } -test "a Restore gives columns fresh serials, past every serial the old session handed out" { +test "after a Restore a new pane or column takes a serial past every one the old session handed out" { const p = try withFile(testing.allocator, "one\n"); defer p.deinit(); - const first = pardes.layout.columnSerial(p, 0); - // Serials spent on columns since deleted. - p.next_column_serial += 5; - const spent = p.next_column_serial; try dump.dumpState(p); + // Serials spent since the dump, on panes and columns since deleted. + p.next_serial += 5; + p.next_column_serial += 5; + const spent = p.next_serial; + const spent_col = p.next_column_serial; const restored = try dump.restore(p, p.dump_out.?, "/tmp/pardes.dump.zon"); defer restored.deinit(); - for (0..restored.ncol) |c| try testing.expect(pardes.layout.columnSerial(restored, c) >= spent); - try testing.expect(pardes.layout.columnSerial(restored, 0) != first); + try testing.expect(restored.next_serial >= spent and restored.next_column_serial >= spent_col); } test "a pane named before it is announced has its new under that name, and no rename before it" { |
