diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-05 19:44:08 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-05 22:03:21 -0300 |
| commit | 1a1ce29051ea6aa3be4754074f6a00b905d6b208 (patch) | |
| tree | 7f432c87aba2a4c21c5bf8eeeee1d873c2247adb /test | |
| parent | 69e809f64a30b09d9bd5ab56a3a80e94fc3f99c3 (diff) | |
| download | pardes-1a1ce29051ea6aa3be4754074f6a00b905d6b208.tar.gz pardes-1a1ce29051ea6aa3be4754074f6a00b905d6b208.zip | |
split pardes.zig by noun, panes: the session's pane slots move into src/panes.zig, beside the Pane they hold: making a pane (installPane, newShell, emitSpawn, newCommand, newDocPane, the scratches, openTutorView and its tutor text, setTestFile), finding one (freeSlot, paneBySerial, paneIdOf, anyPane, neighbourPane, standIn, paneDir), closing one (removePane, retirePane, teardownPane, reapPanes, deinitPane, detachCwds) and a pane's prompt (startPrompt, promptTarget); the session keeps ten as declaration aliases, the eight called from everywhere (freeSlot, paneBySerial, setTestFile, newShell, newDocPane, newScratchBelow, removePane, paneDir) and the two dump.zig calls (emitSpawn, installPane), so the persistence agent's file is untouched; the rest are panes.x(p, ...) in their callers (21 files, test/panes.zig and test/pdf.zig through pardes.panes); helpers they reach in the session are pub (noteClosed, besideColumn, parkPendingWrite, dropPendingWrite, RetiredPanes.retire); tests moved with them, by name: owned cwd preserves long paths aliases and failed updates; owned cwd close copies are transactional across inherited chains; owned cwd column close allocates every copy before removing any pane; owned cwd EOF failure retains the pane and Del retries its close; owned cwd restore either copies the directory or preserves the old core; owned cwd Save promotion releases the former directory; the Tutor pane is named +Tutor in the session's directory, never a bare path at the root; New opens an empty scratch below the caller, inheriting its directory; a prompt chip is a band with its caret, still on the grid, and only the chip swallows a click; a prompt is typed on its own line in the notice band and leaves the tag row alone; a pure move, no field touched, a dump and the wire as they were; gates: tui core-test 960/960, behaviour-test 238/238, pane-test 171/172 (1 skipped), gui unit-test 1518/1519 (1 skipped)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
Diffstat (limited to 'test')
| -rw-r--r-- | test/panes.zig | 24 | ||||
| -rw-r--r-- | test/pdf.zig | 2 |
2 files changed, 13 insertions, 13 deletions
diff --git a/test/panes.zig b/test/panes.zig index 90625e81..27598334 100644 --- a/test/panes.zig +++ b/test/panes.zig @@ -932,7 +932,7 @@ test "paste into pane commands and prompts never inserts into the body" { p.update(.{ .paste = " Custom\nCommand" }); try std.testing.expect(std.mem.indexOf(u8, pardes.tagline.curTail(pane), " Custom\nCommand") != null); p.update(.{ .key = .{ .cp = Key.escape } }); - p.startPrompt(pane, &pane.body, .{ .search = config.search_marker }); + pardes.panes.startPrompt(p, pane, &pane.body, .{ .search = config.search_marker }); p.update(.{ .paste = "t\r\nwo" }); try std.testing.expectEqualStrings(config.search_marker ++ "two", pane.promptText().?); try std.testing.expect(std.mem.indexOf(u8, pardes.tagline.curTail(pane), " Custom\nCommand") != null); @@ -1240,9 +1240,9 @@ test "a prompt owns the pipe behavior through cancellation and submission" { pane.body.cur_col = 2; pane.body.vsel = .{ .active = true, .row = 0, .col = 0, .explicit = true }; for (std.enums.values(modal.Normal.PipeBehavior)) |how| { - p.startPrompt(pane, &pane.body, .{ .pipe = .append }); + pardes.panes.startPrompt(p, pane, &pane.body, .{ .pipe = .append }); p.update(.{ .key = .{ .cp = Key.escape } }); - p.startPrompt(pane, &pane.body, .{ .pipe = how }); + pardes.panes.startPrompt(p, pane, &pane.body, .{ .pipe = how }); try std.testing.expectEqual(how, pane.prompt.pipe); p.update(.{ .key = .{ .cp = 'c', .text = "cat" } }); p.update(.{ .key = .{ .cp = Key.enter } }); @@ -1260,19 +1260,19 @@ test "a prompt owns the pipe behavior through cancellation and submission" { } test "a prompt that cannot be opened leaves the open one as it was" { - const Request = @typeInfo(@TypeOf(Pardes.startPrompt)).@"fn".param_types[3].?; + const Request = @typeInfo(@TypeOf(pardes.panes.startPrompt)).@"fn".param_types[3].?; for ([_]Request{ .{ .search = config.search_marker }, .save, .{ .pipe = .replace }, .{ .pipe = .ignore }, .{ .pipe = .insert }, .{ .pipe = .append } }) |request| { var failing = std.testing.FailingAllocator.init(std.testing.allocator, .{}); const p = try Pardes.init(failing.allocator(), .{ .tty_only = true }); defer p.deinit(); const pane = try p.setTestFile("one\n"); - p.startPrompt(pane, &pane.body, .{ .search = config.search_marker }); + pardes.panes.startPrompt(p, pane, &pane.body, .{ .search = config.search_marker }); p.update(.{ .key = .{ .cp = 'p', .text = "prior" } }); pane.body.normal = .{ .count = 9, .prefix = .goto_prefix }; const previous_normal = pane.body.normal; _ = p.scratch.reset(.free_all); failing.fail_index = failing.alloc_index; - p.startPrompt(pane, &pane.body, request); + pardes.panes.startPrompt(p, pane, &pane.body, request); try std.testing.expect(failing.has_induced_failure); try std.testing.expect(pane.prompt == .search); try std.testing.expectEqualStrings(config.search_marker ++ "prior", pane.promptText().?); @@ -1290,7 +1290,7 @@ test "Save's prompt starts from an owned directory ending in a slash, or none" { for ([_][]const u8{ "/dír space/", "" }) |dir| { try pane.setOwnedCwd(dir); const slash = if (dir.len == 0 or dir[dir.len - 1] != '/') "/" else ""; - p.startPrompt(pane, &pane.body, .save); + pardes.panes.startPrompt(p, pane, &pane.body, .save); try std.testing.expect(pane.prompt == .save); const answer = pane.promptText().?; try std.testing.expect(std.mem.startsWith(u8, answer, config.save_marker)); @@ -1301,7 +1301,7 @@ test "Save's prompt starts from an owned directory ending in a slash, or none" { } test "a prompt opens with one allocation" { - const Request = @typeInfo(@TypeOf(Pardes.startPrompt)).@"fn".param_types[3].?; + const Request = @typeInfo(@TypeOf(pardes.panes.startPrompt)).@"fn".param_types[3].?; for ([_]Request{ .{ .search = config.search_marker }, .save, .{ .pipe = .replace }, .{ .pipe = .ignore }, .{ .pipe = .insert }, .{ .pipe = .append } }) |request| { var failing = std.testing.FailingAllocator.init(std.testing.allocator, .{}); const p = try Pardes.init(failing.allocator(), .{ .tty_only = true }); @@ -1309,7 +1309,7 @@ test "a prompt opens with one allocation" { const pane = try p.setTestFile("one\n"); _ = p.scratch.reset(.free_all); const before = failing.alloc_index; - p.startPrompt(pane, &pane.body, request); + pardes.panes.startPrompt(p, pane, &pane.body, request); try std.testing.expectEqual(before + 1, failing.alloc_index); try std.testing.expect(pane.focus == .body and pane.input.mode == .insert); } @@ -1334,7 +1334,7 @@ test "file history construction failures preserve existing panes" { const result = switch (case) { .open => panes.File.open(p, p.freeSlot().?, path, 0), .output => panes.Output.open(p, p.freeSlot().?, "/", .{ .cmd = .Help }, "", incoming.?), - .tutor => p.openTutorView(1), + .tutor => pardes.panes.openTutorView(p, 1), .replace => p.setTestFile("replacement\n"), }; if (result) |pane| { @@ -1437,7 +1437,7 @@ test "Save rearms renamed file watches only after a successful write" { replacement.file.?.saved_revision -%= 1; }, .closed => { - h.core.deinitPane(h.core.panes[id].?) catch |err| { + pardes.panes.deinitPane(h.core, h.core.panes[id].?) catch |err| { h.err = err; return; }; @@ -1603,7 +1603,7 @@ test "removed and recycled pane slots have no stale geometry" { layout.compute(p); try std.testing.expectEqual(pardes.Rect{}, p.rects[id]); - try p.deinitPane(original); + try pardes.panes.deinitPane(p, original); p.panes[id] = null; p.rects[id] = .{ .x = 10, .y = 5, .w = 20, .h = 10 }; const replacement = try p.newDocPane(id); diff --git a/test/pdf.zig b/test/pdf.zig index 722e28b4..730bf2ce 100644 --- a/test/pdf.zig +++ b/test/pdf.zig @@ -468,7 +468,7 @@ test "watched PDF reload replaces MuPDF state and preserves the reading view" { // The watch follows the PDF payload's lifetime just like a text file's; // emit the stop while the slot still identifies the disappearing pane. - try p.deinitPane(pane); + try pardes.panes.deinitPane(p, pane); p.panes[0] = null; var unwatched = false; while (p.nextEffect()) |effect| switch (effect) { |
