summaryrefslogtreecommitdiff
path: root/src/replica.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/replica.zig')
-rw-r--r--src/replica.zig26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/replica.zig b/src/replica.zig
index ca8612a9..8cacb075 100644
--- a/src/replica.zig
+++ b/src/replica.zig
@@ -4152,6 +4152,32 @@ test "a client joined from a dump moves through another view's pane as the sessi
}
}
+test "a client joined from a dump makes a `/` query's rows as the session does, though only the session has drawn its owner" {
+ if (comptime !pardes.syntax.enabled) return error.SkipZigTest;
+ const gpa = std.testing.allocator;
+ const a = try Authority.init(gpa, .{ .cols = 80, .rows = 24, .file = "build.zig" }, TestHost.host(), false);
+ defer a.deinit();
+ // The session draws: its owner's colours painted for the view (File.refreshHighlights).
+ {
+ const was = Stepping.begin(&a.t, null);
+ defer was.end();
+ var arena: std.heap.ArenaAllocator = .init(gpa);
+ defer arena.deinit();
+ _ = try a.core.render(arena.allocator());
+ }
+ _ = try a.openView(2);
+ const joiner = try joinedNow(a, 3, 1);
+ defer joiner.deinit();
+ try std.testing.expectEqual(digestOf(a), joiner.digest());
+ var buf: [256]u8 = undefined;
+ for ("/co", 1..) |c, seq| {
+ const u = try gpa.dupe(u8, try a.take(try inputOf(&buf, 1, @intCast(seq), .{ .key = .{ .cp = c, .text = &.{c} } })));
+ defer gpa.free(u);
+ joiner.confirm(u);
+ try agrees(a, joiner);
+ }
+}
+
/// An input of a replica's in the session's order, as `Peers.input` takes
/// it: the terminals flushed to every peer, the step, the rows it read that
/// each peer holds as holes (`fill`), then its unit to every replica.