summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-05 20:41:32 -0300
committerGabriel Schneider <[email protected]>2026-11-05 22:07:55 -0300
commit4c3dbce20f11204f6d4bfb715239beae74259e7f (patch)
tree7cc261bdf39843b347b1b1c27829795b2e216774 /test
parent50914b0e04ac0129b11bff0f0007d5cedbfc7f8d (diff)
downloadpardes-4c3dbce20f11204f6d4bfb715239beae74259e7f.tar.gz
pardes-4c3dbce20f11204f6d4bfb715239beae74259e7f.zip
fields #38, the jump list, the language servers' question and the core's clock are fields of their nouns: Jump.zig is the jump list's type (list, n, cur, force, its own len annotation) and the session's jumps a Jump where it was jumps, njumps, jcur and jump_force; lsp/Ask.zig is the question's (seq, last, wait) and the session's lsp_ask an Ask where it was lsp_seq, lsp_last and lsp_wait; the clock is the session's clock, a Clock (now_ns, stepped_ns, started) where it was now_ns, stepped_ns and clock_started; a view opened still starts with no query's mark on its jumps and one closed leaves the staying view's (views.zig), as when the mark was a field of its own; callers in 26 files read p.jumps.n, p.lsp_ask.wait, p.clock.now_ns (macos.zig's lsp_wait tests by text, built nowhere here; dump.zig, the persistence agent's, only where it names lsp_seq); a dump written before this change loads these as their defaults once: an Upgrade or Restore from it comes back with no jumps, no language question awaited and its clock unstarted (jumps' kind changed, so the decoder says so), and the wire's semantics change; gates on tui: core-test 960/960, behaviour-test 238/238, pane-test 171/172 (1 skipped), snap all 108 scripts ok; 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/fs_namespace.zig6
-rw-r--r--test/output.zig4
-rw-r--r--test/panes.zig12
-rw-r--r--test/pdf.zig26
4 files changed, 24 insertions, 24 deletions
diff --git a/test/fs_namespace.zig b/test/fs_namespace.zig
index 3a918a28..00b2461a 100644
--- a/test/fs_namespace.zig
+++ b/test/fs_namespace.zig
@@ -86,7 +86,7 @@ test "transactional restore preserves host capabilities and advances pane identi
const p = try pardes.Pardes.init(gpa, .{ .tty_only = true, .cols = 91, .rows = 37 });
defer p.deinit();
const pane = try p.setTestFile("before\n");
- p.lsp_seq = 41;
+ p.lsp_ask.seq = 41;
p.pipe.seq = 73;
if (@hasField(pardes.CellPixels, "w")) p.cell_pixels = .{ .w = 9, .h = 18 };
p.native_images = true;
@@ -95,7 +95,7 @@ test "transactional restore preserves host capabilities and advances pane identi
try pardes.dump.dumpState(p);
const restored = try pardes.dump.restore(p, p.dump_out.?, "test");
defer restored.deinit();
- try std.testing.expectEqual(@as(u32, 41), restored.lsp_seq);
+ try std.testing.expectEqual(@as(u32, 41), restored.lsp_ask.seq);
try std.testing.expectEqual(@as(u32, 73), restored.pipe.seq);
try std.testing.expectEqual(p.cell_pixels, restored.cell_pixels);
try std.testing.expect(restored.native_images);
@@ -113,7 +113,7 @@ test "transactional restore preserves host capabilities and advances pane identi
));
try std.testing.expect(p.panes[0] == pane);
try std.testing.expectEqualStrings("before\n", pane.file.?.content);
- try std.testing.expectEqual(@as(u32, 41), p.lsp_seq);
+ try std.testing.expectEqual(@as(u32, 41), p.lsp_ask.seq);
try std.testing.expectEqualStrings("/tmp/session.sock", p.fs.socket_path);
}
diff --git a/test/output.zig b/test/output.zig
index 0711442c..31027cfc 100644
--- a/test/output.zig
+++ b/test/output.zig
@@ -199,7 +199,7 @@ test "references fill the asking text's query pane: sorted under their files, th
source.body.cur_row = 2;
source.body.cur_col = 4;
p.lspRequest(0, .references, "");
- const request = p.lsp_wait.?.id;
+ const request = p.lsp_ask.wait.?.id;
// the cursor moves before the answer: it is placed by where it was asked
source.body.cur_row = 4;
pardes.lsp.Ask.lspResponse(p, request, response);
@@ -272,7 +272,7 @@ test "a single language location opens the full spaced filename" {
const p = try Pardes.init(std.testing.allocator, .{ .file = path });
defer p.deinit();
p.lspRequest(0, .references, "");
- pardes.lsp.Ask.lspResponse(p, p.lsp_wait.?.id, "with space.zig:2:1 second\n");
+ pardes.lsp.Ask.lspResponse(p, p.lsp_ask.wait.?.id, "with space.zig:2:1 second\n");
try std.testing.expect(std.mem.endsWith(u8, p.panes[p.active].?.file.?.path, "/with space.zig"));
try std.testing.expectEqual(@as(i32, 1), p.panes[p.active].?.body.cur_row);
for (p.panes) |slot| {
diff --git a/test/panes.zig b/test/panes.zig
index a0354ba4..4188eecd 100644
--- a/test/panes.zig
+++ b/test/panes.zig
@@ -762,13 +762,13 @@ const JumpSelectionTests = struct {
try LookResetTests.seed(source, "source held text");
try LookResetTests.seed(destination, "destination held text");
p.active = 0;
- p.njumps = 2;
- p.jcur = 1;
- p.jumps[0] = .{ .pane = @intCast(id), .serial = destination.serial, .line = 3, .col = 2 };
- p.jumps[1] = .{ .pane = 0, .serial = source.serial, .line = 2, .col = 1 };
+ p.jumps.n = 2;
+ p.jumps.cur = 1;
+ p.jumps.list[0] = .{ .pane = @intCast(id), .serial = destination.serial, .line = 3, .col = 2 };
+ p.jumps.list[1] = .{ .pane = 0, .serial = source.serial, .line = 2, .col = 1 };
p.update(.{ .key = .{ .cp = 'o', .ctrl = true } });
try std.testing.expectEqual(id, p.active);
- try std.testing.expectEqual(@as(usize, 0), p.jcur);
+ try std.testing.expectEqual(@as(usize, 0), p.jumps.cur);
try LookResetTests.cleared(source);
try LookResetTests.cleared(destination);
try std.testing.expect(!source.body.vsel.active and !destination.body.vsel.active);
@@ -779,7 +779,7 @@ const JumpSelectionTests = struct {
try LookResetTests.seed(destination, "new destination held text");
p.update(.{ .key = .{ .cp = 'i', .ctrl = true } });
try std.testing.expectEqual(@as(usize, 0), p.active);
- try std.testing.expectEqual(@as(usize, 1), p.jcur);
+ try std.testing.expectEqual(@as(usize, 1), p.jumps.cur);
try LookResetTests.cleared(source);
try LookResetTests.cleared(destination);
try std.testing.expect(!source.body.vsel.active and !destination.body.vsel.active);
diff --git a/test/pdf.zig b/test/pdf.zig
index bf0bfae7..2f14fb2f 100644
--- a/test/pdf.zig
+++ b/test/pdf.zig
@@ -1760,7 +1760,7 @@ test "PDF native mouse selection, Look, and highlights share page geometry" {
const query_before = try gpa.dupe(u8, pv.search_query);
defer gpa.free(query_before);
const search_hit_before = pv.search_hit;
- const jumps_before = .{ p.njumps, p.jcur, p.n_look_src };
+ const jumps_before = .{ p.jumps.n, p.jumps.cur, p.n_look_src };
const effects_before = p.effects_len;
try std.testing.expect(p.drag == .none);
@@ -1812,7 +1812,7 @@ test "PDF native mouse selection, Look, and highlights share page geometry" {
try std.testing.expect(std.meta.eql(selection_head_before, pv.selection_head));
try std.testing.expectEqualStrings(query_before, pv.search_query);
try std.testing.expectEqual(search_hit_before, pv.search_hit);
- try std.testing.expectEqual(jumps_before, .{ p.njumps, p.jcur, p.n_look_src });
+ try std.testing.expectEqual(jumps_before, .{ p.jumps.n, p.jumps.cur, p.n_look_src });
try std.testing.expectEqual(effects_before, p.effects_len);
try std.testing.expect(p.drag == .none);
}
@@ -2032,15 +2032,15 @@ test "PDF Back and Forward clear selections and land on recorded pages" {
const state = pane.pdf.?;
try std.testing.expect(state.page_count > 1);
try std.testing.expect(state.focusLocation(p.pdf_gpa, 2, 0));
- p.njumps = 2;
- p.jcur = 1;
- p.jumps[0] = .{ .pane = 0, .serial = pane.serial, .line = 1, .col = 0 };
- p.jumps[1] = .{ .pane = 0, .serial = pane.serial, .line = 2, .col = 0 };
+ p.jumps.n = 2;
+ p.jumps.cur = 1;
+ p.jumps.list[0] = .{ .pane = 0, .serial = pane.serial, .line = 1, .col = 0 };
+ p.jumps.list[1] = .{ .pane = 0, .serial = pane.serial, .line = 2, .col = 0 };
for ([_]u21{ 'o', 'i' }, 0..) |key, destination| {
try std.testing.expectEqual(panes.Pdf.SelectionUpdate.changed, state.setSelection(p.pdf_gpa, .{ .x = 0, .y = 0 }, .{ .x = 1, .y = 1 }, true));
try std.testing.expect(state.selection != null and state.selection_text.len > 0);
p.update(.{ .key = .{ .cp = key, .ctrl = true } });
- try std.testing.expectEqual(destination, p.jcur);
+ try std.testing.expectEqual(destination, p.jumps.cur);
try std.testing.expectEqual(destination, state.page);
try std.testing.expect(state.selection == null);
try std.testing.expect(state.selection_page == null);
@@ -2111,11 +2111,11 @@ test "a PDF's jumps: Back after a far jump returns to the exact offset, two plac
try jumpFrame(p);
try std.testing.expect(pv.page_count > 3);
// Two places on page 1, more than a body apart: two entries.
- const before = p.njumps;
+ const before = p.jumps.n;
_ = try stripAtPlace(p, pane, 1, 0.05);
const near = try stripAtPlace(p, pane, 1, 0.8);
- try std.testing.expectEqual(before + 2, p.njumps);
- try std.testing.expect(p.jumps[p.njumps - 1].pdf);
+ try std.testing.expectEqual(before + 2, p.jumps.n);
+ try std.testing.expect(p.jumps.list[p.jumps.n - 1].pdf);
// A far jump (a Look at a page), then Back: the exact offset, not the
// page's top, and its page.
look.lookAt(p, id, if (pv.page_count > 3000) ":3000" else ":4");
@@ -2126,12 +2126,12 @@ test "a PDF's jumps: Back after a far jump returns to the exact offset, two plac
try std.testing.expectEqual(@as(usize, 1), pv.page);
try std.testing.expectApproxEqAbs(near, pv.document_scroll_y, 0.5);
// A wheel's small steps are the same visit: the entry follows them.
- const n = p.njumps;
+ const n = p.jumps.n;
for (0..4) |_| {
_ = panes.Pdf.scrollPane(p, pane, 30, true);
try jumpFrame(p);
}
- try std.testing.expectEqual(n, p.njumps);
+ try std.testing.expectEqual(n, p.jumps.n);
}
test "a PDF's jumps: JumpScope file keeps to the PDF, and a closed PDF reopens at its place" {
@@ -2167,7 +2167,7 @@ test "a PDF's jumps: JumpScope file keeps to the PDF, and a closed PDF reopens a
try p.removePane(doc, null);
try jumpFrame(p);
var closed = false;
- for (p.jumps[0..p.njumps]) |j| closed = closed or (j.serial == 0 and j.pdf);
+ for (p.jumps.list[0..p.jumps.n]) |j| closed = closed or (j.serial == 0 and j.pdf);
try std.testing.expect(closed);
var tries: usize = 0;
while (tries < 4) : (tries += 1) {