diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-22 16:50:34 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-22 16:53:19 -0300 |
| commit | 9863a63b614d200852853825031189364dcacfdc (patch) | |
| tree | d235648a2ac14b3e311746ced3433ed6865e2061 /test/terminal.zig | |
| parent | 6544f73a6b50e5ba68564beea7784593bb54348e (diff) | |
| parent | bad506bd45846e012246a33b5d3097b3e92f02bc (diff) | |
| download | pardes-9863a63b614d200852853825031189364dcacfdc.tar.gz pardes-9863a63b614d200852853825031189364dcacfdc.zip | |
integration: the old road deleted and the emulator's boundary on the gathered line: pardes-merge56 (`qvwrwxtu`: the installed tree and the source view's changes to their last slice) and pardes-term-join-9 (`twssqzqw`, fourteen changes on pardes-merge55: every client's terminals by the pty's bytes and nothing else: the delta protocol, its flow control and core/term/screen_state.zig deleted (-3,605 +504 lines), the wire at 30, one soak; S1: abi/term.zig's Ops in replicated and local, the terminal's digest covering what a step reads, every call of the core's into a terminal listed with its rule as a test; a client's own join again judged after its goodbye; a pty's size one fact the core hands its host for every fork, adopt and resize; a closed view sizes no terminal); no textual conflict; one semantic one, resolved here: core/jj.zig's Churn test (the layers' last round) called Authority.init and Replica.init with the road's flag the deletion took away: the argument removed; core-test 916/1073 (157 skipped), shell-test 1115/1118; its gate: .scratch/sketch/reorg/merge57, the numbers in PARDES.md (2026-11-22)
Co-Authored-By: Claude Fable 5.2 <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
Diffstat (limited to 'test/terminal.zig')
| -rw-r--r-- | test/terminal.zig | 95 |
1 files changed, 2 insertions, 93 deletions
diff --git a/test/terminal.zig b/test/terminal.zig index ec050c7a..7e7106a1 100644 --- a/test/terminal.zig +++ b/test/terminal.zig @@ -1,6 +1,6 @@ //! The terminal through the core (docs/next-terminal.md, Phase 1): what -//! were core/term/terminal.zig's and screen_state.zig's tests of a terminal -//! pane, moved as they were. They boot a core and read the emulator behind +//! were core/term/terminal.zig's tests of a terminal pane, moved as they +//! were. They boot a core and read the emulator behind //! it, so they need both modules, which only a suite outside both has: //! pane-test's (test/panes.zig). The emulator's own tests stay in core/term/. const std = @import("std"); @@ -9,12 +9,6 @@ const plain = @import("plain"); const term = @import("term"); const ghostty_vt = @import("ghostty-vt"); const emu = term.terminal; -const screen_state = term.screen_state; -const Encoder = screen_state.Encoder; -const Track = screen_state.Track; -const Peer = screen_state.Peer; -const Replica = screen_state.Replica; -const encode = screen_state.encode; const Surface = pardes.Surface; const Pane = pardes.Pane; const FilterPalette = Term.FilterPalette; @@ -100,39 +94,6 @@ test "replay ownership is terminal-only and construction rolls back on allocatio try std.testing.checkAllAllocationFailures(std.testing.allocator, Case.run, .{true}); } -test "a terminal made fresh has no size waiting: one never resized keeps its grid when a unit is cut" { - // Fresh memory as a Debug build's allocator hands it out: 0xAA. A field - // `create` left unset read a size of 43690x43690 (fixer 2's, 2026-10-30). - const Filling = struct { - child: std.mem.Allocator, - fn alloc(ctx: *anyopaque, len: usize, a: std.mem.Alignment, ra: usize) ?[*]u8 { - const self: *@This() = @ptrCast(@alignCast(ctx)); - const ptr = self.child.rawAlloc(len, a, ra) orelse return null; - @memset(ptr[0..len], 0xAA); - return ptr; - } - fn grow(ctx: *anyopaque, buf: []u8, a: std.mem.Alignment, n: usize, ra: usize) bool { - const self: *@This() = @ptrCast(@alignCast(ctx)); - return self.child.rawResize(buf, a, n, ra); - } - fn remap(ctx: *anyopaque, buf: []u8, a: std.mem.Alignment, n: usize, ra: usize) ?[*]u8 { - const self: *@This() = @ptrCast(@alignCast(ctx)); - return self.child.rawRemap(buf, a, n, ra); - } - fn free(ctx: *anyopaque, buf: []u8, a: std.mem.Alignment, ra: usize) void { - const self: *@This() = @ptrCast(@alignCast(ctx)); - self.child.rawFree(buf, a, ra); - } - const vtable: std.mem.Allocator.VTable = .{ .alloc = alloc, .resize = grow, .remap = remap, .free = free }; - }; - var filling: Filling = .{ .child = std.testing.allocator }; - const gpa: std.mem.Allocator = .{ .ptr = &filling, .vtable = &Filling.vtable }; - const pane = try panes.createTerminal(gpa, 40, 12); - defer gpa.destroy(pane); - defer if (pane.terminal) |state| close(state, gpa); - try std.testing.expect(of(pane.terminal.?).resize_to == null); -} - test "document construction allocates only the pane and has inert terminal defaults" { var failing = std.testing.FailingAllocator.init(std.testing.allocator, .{ .fail_index = 1 }); const allocator = failing.allocator(); @@ -926,55 +887,3 @@ test "colors.xterm is the palette the emulator starts from, all 256" { for (pardes.colors.xterm, ghostty_vt.color.default) |ours, its| try std.testing.expectEqual(ours, [3]u8{ its.r, its.g, its.b }); } -test "a replica's terminal pane draws as its authority's does" { - const testing = std.testing; - const gpa = testing.allocator; - const a = try pardes.Pardes.init(gpa, .{ .tty_only = true, .cols = 60, .rows = 16 }); - defer a.deinit(); - const b = try pardes.Pardes.init(gpa, .{ .tty_only = true, .cols = 60, .rows = 16 }); - defer b.deinit(); - while (a.nextEffect()) |_| {} - while (b.nextEffect()) |_| {} - var fa = std.heap.ArenaAllocator.init(gpa); - defer fa.deinit(); - var fb = std.heap.ArenaAllocator.init(gpa); - defer fb.deinit(); - // Laid out once, so both panes have their size before the first delta. - _ = try a.render(fa.allocator()); - _ = try b.render(fb.allocator()); - const ta = &of(a.panes[0].?.terminal.?).vt; - const tb = &of(b.panes[0].?.terminal.?).vt; - var enc: Encoder = .init(gpa); - defer enc.deinit(); - var peer: Peer = .{}; - defer peer.deinit(gpa); - var tr: Track = .init(gpa); - defer tr.deinit(gpa, ta); - var rep: Replica = .{}; - defer rep.deinit(gpa); - var delta: std.Io.Writer.Allocating = .init(gpa); - defer delta.deinit(); - var line: [256]u8 = undefined; - for (0..60) |i| { - const bytes = try std.fmt.bufPrint(&line, "\x1b[1;3{d}m{d}\x1b[0m 漢字 e\u{301} \x1b[48;2;{d};40;60mbg\x1b[0m and then some text that wraps past the width of the pane\r\n", .{ i % 8, i, i * 4 % 256 }); - a.update(.{ .output = .{ .pane = .at(0), .bytes = bytes } }); - delta.clearRetainingCapacity(); - try testing.expect(try encode(&enc, &tr, &peer, ta, @intCast(i + 1), "", &delta.writer)); - peer.ack((try rep.apply(gpa, std.Io.Threaded.global_single_threaded.io(), tb, delta.written())).seq); - b.needs_frame = true; - _ = fa.reset(.retain_capacity); - _ = fb.reset(.retain_capacity); - const sa = try a.render(fa.allocator()); - const sb = try b.render(fb.allocator()); - const r = a.view().rects[0]; - // The body: below the pane's tag row. - for (r.y + 1..r.y + r.h) |y| for (r.x..r.x + r.w) |x| { - const ca = sa.at(@intCast(x), @intCast(y)); - const cb = sb.at(@intCast(x), @intCast(y)); - if (!ca.visuallyEqual(cb)) { - std.debug.print("step {d}: cell {d},{d}: '{s}' vs '{s}'\n", .{ i, x, y, ca.grapheme(), cb.grapheme() }); - return error.ReplicaDrawsDifferently; - } - }; - } -} |
