summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-06 18:22:04 -0300
committerGabriel Schneider <[email protected]>2026-11-06 20:00:43 -0300
commiteeb59b92295e74b956d32e66c3c318e105a391db (patch)
treed7178f0b87c5740a077119705331efa3d0319547 /test
parentb22fa2638bca470bbd8c5ea4768eb0eaaa3e8195 (diff)
downloadpardes-eeb59b92295e74b956d32e66c3c318e105a391db.tar.gz
pardes-eeb59b92295e74b956d32e66c3c318e105a391db.zip
kinds #38, a kind's ticks and views as units of the session's origin (§17.2 B 1): a step of the session's own (a tick, a job's answer, a 9P request, any input no client sends) tells each view whose facts moved and ticks a focus changed or a deadline come, a client's input ticks only the pane its key, click or word went to (which already waits), so a client never guesses a tick and never waits for one; the tick's prefix is in its taped outcome (a Shadow's tag is the authority's from the tape, `told` and the frame's prefix gone, the dump carrying the prefix), Kind.wake says a focus change, the tick wait and Kind.repaint are gone, the post-unit flush stays for the tick after a key; the stall test asserts the replay (0 mispredicted, 0 waited)
Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
Diffstat (limited to 'test')
-rw-r--r--test/panes.zig34
1 files changed, 22 insertions, 12 deletions
diff --git a/test/panes.zig b/test/panes.zig
index 28256495..249ce7eb 100644
--- a/test/panes.zig
+++ b/test/panes.zig
@@ -3902,7 +3902,7 @@ const PdfAddon = struct {
try std.testing.expect(r.diverged == null);
}
- test "a client's input whose session step ticks a PDF's pane waits for that step, never guessed and rolled back" {
+ test "a client's input that moves a PDF's view is guessed right, never waited for, and the session's tick of it is a unit of its own the client replays" {
if (!addons.has_pdf) return error.SkipZigTest;
const R = pardes.replica;
const gpa = std.testing.allocator;
@@ -3917,15 +3917,22 @@ const PdfAddon = struct {
l.r.confirm(try l.a.local(ev));
}
};
- _ = try opened(a, Land{ .a = a, .r = r });
+ const id = try opened(a, Land{ .a = a, .r = r });
const guessed = r.stats.mispredicted;
- // Its window resized: the pane's view moves, and the session's
- // step ticks its kind, which only the session runs.
+ const stopped = r.stats.stopped;
+ const told = a.core.panes[id].?.addon.?.views;
+ // Its window resized: the pane's view moves; the client's input
+ // calls no kind, so its guess is the session's step.
r.confirm(try a.take(try r.input(.{ .resize = .{ .cols = 100, .rows = 30 } })));
r.settle();
- try std.testing.expect(r.diverged == null);
try std.testing.expectEqual(guessed, r.stats.mispredicted);
- try std.testing.expect(r.stats.stopped >= 1);
+ try std.testing.expectEqual(stopped, r.stats.stopped);
+ // The session's own next step tells the kind, ticks it, and the
+ // client replays that unit.
+ r.confirm(try a.local(.tick));
+ try std.testing.expect(r.diverged == null);
+ try std.testing.expect(!std.mem.eql(u64, &told, &a.core.panes[id].?.addon.?.views));
+ try std.testing.expectEqualSlices(u64, &a.core.panes[id].?.addon.?.views, &r.core().panes[id].?.addon.?.views);
}
test "a PDF's tag has the core's art words from its first step, in a view without graphics and with them" {
@@ -3942,14 +3949,14 @@ const PdfAddon = struct {
};
const land: Land = .{ .a = a };
const id = try opened(a, land);
- const slot = a.core.panes[id].?.addon.?;
// A view without graphics: the page's text layer, its pictures'
// words glyph art's (PA_PICTURES: the kind's, not the frame's).
- try std.testing.expect(std.mem.indexOf(u8, slot.told.slice(), " petscii:on ") != null);
+ const pane = a.core.panes[id].?;
+ try std.testing.expect(std.mem.indexOf(u8, try pardes.tagline.tagPrefix(a.core, pane), " petscii:on ") != null);
// A window's: the pages as pictures, the same words, its own.
try land.step(.{ .frontend = .{ .windowed = true, .native_images = true } });
try jobs(a.core, land);
- try std.testing.expect(std.mem.indexOf(u8, slot.told.slice(), " petscii:off ") != null);
+ try std.testing.expect(std.mem.indexOf(u8, try pardes.tagline.tagPrefix(a.core, pane), " petscii:off ") != null);
}
test "a PDF's pane in a window's view and a terminal's in turn: each is told its view, its tag its page and art words in both" {
@@ -3980,8 +3987,11 @@ const PdfAddon = struct {
const win = try R.Replica.initDump(gpa, 2, k, bytes, .{ .cols = 80, .rows = 24 });
defer win.deinit();
_ = try a.take(try win.input(.{ .frontend = .{ .windowed = true, .native_images = true } }));
+ // Its view's facts are the session's own step's to tell (17.2).
+ try land.step(.tick);
try jobs(a.core, land);
- try std.testing.expect(std.mem.indexOf(u8, slot.told.slice(), " petscii:on ") != null);
+ const pane = a.core.panes[id].?;
+ try std.testing.expect(std.mem.indexOf(u8, try pardes.tagline.tagPrefix(a.core, pane), " petscii:on ") != null);
// Both views told (by id, the session's 1 and the window's), each
// with its own frontend's facts.
try std.testing.expect(slot.views[0] != 0 and slot.views[k] != 0 and slot.views[0] != slot.views[k]);
@@ -3991,9 +4001,9 @@ const PdfAddon = struct {
// session's first view's art words, a terminal's: glyph art).
_ = try a.take(try tty.input(.{ .key = .{ .cp = 'j', .text = "j" } }));
try jobs(a.core, land);
- try std.testing.expect(std.mem.indexOf(u8, slot.told.slice(), "/16] petscii:on ") != null);
+ try std.testing.expect(std.mem.indexOf(u8, try pardes.tagline.tagPrefix(a.core, pane), "/16] petscii:on ") != null);
_ = try a.take(try win.input(.{ .key = .{ .cp = 'j', .text = "j" } }));
- try std.testing.expect(std.mem.indexOf(u8, slot.told.slice(), "/16] petscii:on ") != null);
+ try std.testing.expect(std.mem.indexOf(u8, try pardes.tagline.tagPrefix(a.core, pane), "/16] petscii:on ") != null);
try jobs(a.core, land);
}
}