diff options
| author | Gabriel Schneider <[email protected]> | 2026-10-21 14:35:15 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-10-22 10:03:15 -0300 |
| commit | bc3d18d27f9fc1155db7fac3946c4d38774f9e65 (patch) | |
| tree | 9178ce95952797f8a78b16c2b805e53368efb35a /test/panes.zig | |
| parent | 1ecb9b720840ea8e4753823fa8cddcf5d6a3a4d2 (diff) | |
| download | pardes-bc3d18d27f9fc1155db7fac3946c4d38774f9e65.tar.gz pardes-bc3d18d27f9fc1155db7fac3946c4d38774f9e65.zip | |
Build with Zig 0.17
ghostty, libvaxis and uucode move to ghostty's 0.17 pins, cloud9 to its 0.17
main, SDL to castholm's release-3.4.x (3.4.18), zstbi and tree-sitter to
forks with 0.17 build files (see build.zig.zon). A bare zig build copies the
binaries into ~/.local/bin (-Dhome-install=false leaves it out): 0.17 keeps
the prefix from build scripts. A terminal's edited copy goes when the program
clears the screen. tinywin.snap is gone; perf baselines are re-recorded.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'test/panes.zig')
| -rw-r--r-- | test/panes.zig | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/test/panes.zig b/test/panes.zig index 86e52838..54100f91 100644 --- a/test/panes.zig +++ b/test/panes.zig @@ -42,7 +42,7 @@ const TagLayerTests = struct { p.row_metrics = .{ .body_w = 10, .body_h = 20, .tagline_w = 5, .tagline_h = 10 }; p.gpa.free(pane.file.?.path); pane.file.?.path = try p.gpa.dupe(u8, "/x"); - try setTag(pane, " " ++ "a" ** 38 ++ "\t界 END"); + try setTag(pane, " " ++ &@as([38]u8, @splat('a')) ++ "\t界 END"); var frame = std.heap.ArenaAllocator.init(p.gpa); defer frame.deinit(); _ = try p.render(frame.allocator()); @@ -135,7 +135,7 @@ const TagLayerTests = struct { try std.testing.expectEqual(@as(i32, 0), p.panes[second].?.input.cur_col); p.update(.{ .key = .{ .cp = Key.escape } }); const left = p.panes[0].?; - try setTag(left, " " ++ "a" ** 110); + try setTag(left, " " ++ &@as([110]u8, @splat('a'))); _ = try p.render(frame.allocator()); const left_layer = try findLayer(p, .pane, 0); const left_text = try pardes.tagline.tagText(p, frame.allocator(), left); @@ -149,7 +149,7 @@ const TagLayerTests = struct { try std.testing.expectEqual(panes.File.rawAtDisplay(left_text, end_col), @as(usize, @intCast(left.tag.cur_col))); try std.testing.expect(left.sel[0].state == .done and left.sel[0].r0 == 0); p.update(.{ .key = .{ .cp = Key.escape } }); - const long = "a" ** 60 ++ "界END"; + const long = &@as([60]u8, @splat('a')) ++ "界END"; p.global_tag.own = try p.gpa.dupe(u8, long); for (p.col_tags[0..p.ncol]) |*tag| tag.own = try p.gpa.dupe(u8, long); _ = try p.render(frame.allocator()); @@ -581,7 +581,7 @@ const BodyHitTests = struct { const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 64, .rows = 18 }); defer p.deinit(); p.row_metrics = .{ .body_w = 10, .body_h = 20, .tagline_w = 8, .tagline_h = 10 }; - const pane = try TreeContextTests.setZigFile(p, "const Box = struct {\n pub fn work(\n value: usize,\n ) void {\n" ++ " // body\n" ** 60 ++ " }\n};\n"); + const pane = try TreeContextTests.setZigFile(p, "const Box = struct {\n pub fn work(\n value: usize,\n ) void {\n" ++ std.mem.asBytes(&@as([60][16]u8, @splat(" // body\n".*))) ++ " }\n};\n"); try std.testing.expect(p.executeBuiltinLine(0, "TreeContext")); pane.scrollBy(10); var frame = std.heap.ArenaAllocator.init(p.gpa); @@ -629,7 +629,7 @@ const LineNumberLookTests = struct { const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 64, .rows = 18 }); defer p.deinit(); p.row_metrics = .{ .body_w = 10, .body_h = 20, .tagline_w = 8, .tagline_h = 10 }; - const pane = try TreeContextTests.setZigFile(p, "const Box = struct {\n pub fn work(\n value: usize,\n ) void {\n" ++ " // body\n" ** 60 ++ " }\n};\n"); + const pane = try TreeContextTests.setZigFile(p, "const Box = struct {\n pub fn work(\n value: usize,\n ) void {\n" ++ std.mem.asBytes(&@as([60][16]u8, @splat(" // body\n".*))) ++ " }\n};\n"); try std.testing.expect(p.executeBuiltinLine(0, "TreeContext")); pane.scrollBy(30); var frame = std.heap.ArenaAllocator.init(p.gpa); @@ -686,7 +686,7 @@ const TreeContextTests = struct { if (!syntax.enabled) return error.SkipZigTest; const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 64, .rows = 18 }); defer p.deinit(); - const pane = try setZigFile(p, "const Box = struct {\n\n // omitted member comment\n\n pub fn work(\n value: usize,\n ) void {\n" ++ " // body\n" ** 30 ++ " }\n};\n"); + const pane = try setZigFile(p, "const Box = struct {\n\n // omitted member comment\n\n pub fn work(\n value: usize,\n ) void {\n" ++ std.mem.asBytes(&@as([30][16]u8, @splat(" // body\n".*))) ++ " }\n};\n"); p.row_metrics = .{ .body_w = 10, .body_h = 20, .tagline_w = 8, .tagline_h = 10 }; try std.testing.expect(p.executeBuiltinLine(0, "TreeContext")); pane.scrollBy(10); @@ -717,7 +717,7 @@ const TreeContextTests = struct { if (context and !syntax.enabled) continue; const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 64, .rows = 18 }); defer p.deinit(); - const pane = try setZigFile(p, "pub fn work() void {\n" ++ " // body\n" ** 100 ++ "}\n"); + const pane = try setZigFile(p, "pub fn work() void {\n" ++ std.mem.asBytes(&@as([100][12]u8, @splat(" // body\n".*))) ++ "}\n"); if (context) try std.testing.expect(p.executeBuiltinLine(0, "TreeContext")); var frame = std.heap.ArenaAllocator.init(p.gpa); defer frame.deinit(); @@ -792,7 +792,7 @@ const TreeContextTests = struct { if (!syntax.enabled) return error.SkipZigTest; const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 48, .rows = 14 }); defer p.deinit(); - const pane = try setZigFile(p, "pub fn @\"界name\"(\n\tvalue: usize,\n) void {\n" ++ " _ = value;\n" ** 12 ++ "}\n"); + const pane = try setZigFile(p, "pub fn @\"界name\"(\n\tvalue: usize,\n) void {\n" ++ std.mem.asBytes(&@as([12][15]u8, @splat(" _ = value;\n".*))) ++ "}\n"); pane.tag_expanded = false; // a one-row tag keeps this small screen's rows p.sync(); p.settings.wrap = false; @@ -820,7 +820,7 @@ const TreeContextTests = struct { // Read the body top again: the click cleared the announcement band the // builtin above put up, so the body moved with it. try std.testing.expectEqual(p.bodyTop(pane, p.rects[0]), cursor.y); - panes.File.setContent(p, &pane.file.?, try p.gpa.dupe(u8, "// no enclosing declaration\n" ** 18)); + panes.File.setContent(p, &pane.file.?, try p.gpa.dupe(u8, std.mem.asBytes(&@as([18][28]u8, @splat("// no enclosing declaration\n".*))))); _ = try p.render(frame.allocator()); try std.testing.expectEqual(@as(u16, 0), pane.context_rows); try std.testing.expectEqual(pane.scroll(), pane.wrapAt(0).line); @@ -942,7 +942,7 @@ const TtySelectionTests = struct { try noChildInput(p); _ = try p.render(frame.allocator()); try std.testing.expectEqualStrings(expected, pardes.test_api.heldSelection(p, 0).?); - p.update(.{ .output = .{ .pane = 0, .bytes = "\x1b]133;C\x07" ++ "\r\nnew output" ** 30 } }); + p.update(.{ .output = .{ .pane = 0, .bytes = "\x1b]133;C\x07" ++ std.mem.asBytes(&@as([30][12]u8, @splat("\r\nnew output".*))) } }); _ = try p.render(frame.allocator()); try std.testing.expectEqual(panes.Text.Mode.tty, pane.body.mode); try std.testing.expectEqualStrings(expected, pardes.test_api.heldSelection(p, 0).?); @@ -1266,7 +1266,7 @@ const ClickCursorTests = struct { test "click operands and hover follow the scrolled source selection" { const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 40, .rows = 14 }); defer p.deinit(); - const pane = try p.setTestFile("zero\none\ntwo\nthree\nalpha beta\nfive\ngamma delta\nseven\n" ++ "tail\n" ** 20); + const pane = try p.setTestFile("zero\none\ntwo\nthree\nalpha beta\nfive\ngamma delta\nseven\n" ++ std.mem.asBytes(&@as([20][5]u8, @splat("tail\n".*)))); p.presentation.enabled = false; p.settings.wrap = false; var frame = std.heap.ArenaAllocator.init(p.gpa); @@ -1323,7 +1323,7 @@ const JumpSelectionTests = struct { const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 34, .rows = 10 }); defer p.deinit(); p.settings.wrap = wrap; - const text = try std.fmt.allocPrint(p.gpa, "{s}{s}", .{ prefix, "unrelated destination text\n" ** 80 }); + const text = try std.fmt.allocPrint(p.gpa, "{s}{s}", .{ prefix, std.mem.asBytes(&@as([80][27]u8, @splat("unrelated destination text\n".*))) }); defer p.gpa.free(text); const pane = try p.setTestFile(text); var frame = std.heap.ArenaAllocator.init(p.gpa); @@ -1813,7 +1813,7 @@ test "a word the tag's wrapping breaks across rows is still one word to a click" var pad: usize = 1; const shown = while (pad < 80) : (pad += 1) { p.gpa.free(pane.file.?.path); - const path = try std.fmt.allocPrint(arena.allocator(), "/{s}/f.zig", .{("a" ** 80)[0..pad]}); + const path = try std.fmt.allocPrint(arena.allocator(), "/{s}/f.zig", .{(&@as([80]u8, @splat('a')))[0..pad]}); pane.file.?.path = try p.gpa.dupe(u8, path); p.sync(); const s = try pardes.tagline.shownTag(p, arena.allocator(), pane); @@ -1866,7 +1866,7 @@ test "terminal output keeps following new rows after scrollback eviction" { pane.body.mode = .tty; pane.tty_filter = false; const pages = &pane.terminal.?.vt.screens.active.pages; - pages.explicit_max_size = 64 * 1024; + pages.limits.set(.bytes, 64 * 1024); var frame = std.heap.ArenaAllocator.init(gpa); defer frame.deinit(); var evictions: usize = 0; @@ -1885,7 +1885,7 @@ test "terminal output keeps following new rows after scrollback eviction" { if (pages.scrollbar().total < previous) evictions += 1; } try std.testing.expect(evictions > phase); - try std.testing.expect(pages.page_size <= pages.maxSize()); + try std.testing.expect(pages.page_size <= pages.limits.max(.bytes)); const sb = pages.scrollbar(); try std.testing.expectEqual(sb.total - pane.rows, sb.offset); const full = try panes.terminal.screenTextAlloc(pane, gpa); @@ -1926,7 +1926,7 @@ test "terminal edit stays on its surviving row when old scrollback is evicted" { const pane = p.panes[0].?; pane.body.mode = .tty; const pages = &pane.terminal.?.vt.screens.active.pages; - pages.explicit_max_size = 64 * 1024; + pages.limits.set(.bytes, 64 * 1024); var next: usize = 0; while (next < 3000) { var buf: [32]u8 = undefined; @@ -1977,9 +1977,9 @@ test "terminal edits and undo survive partial history clearing and whole-screen pane.body.mode = .tty; if (action == .reset_alternate) p.update(.{ .output = .{ .pane = 0, .bytes = "\x1b[?1049h" } }); - p.update(.{ .output = .{ .pane = 0, .bytes = "old row\r\n" ** 40 } }); + p.update(.{ .output = .{ .pane = 0, .bytes = std.mem.asBytes(&@as([40][9]u8, @splat("old row\r\n".*))) } }); const pages = &pane.terminal.?.vt.screens.active.pages; - pages.explicit_max_size = 64 * 1024; + pages.limits.set(.bytes, 64 * 1024); const row: i32 = @as(i32, @intCast(pages.total_rows - pane.rows)) + @as(i32, if (action == .partial_clear_history) -1 else 2); pane.body.mode = .normal; @@ -2005,7 +2005,7 @@ test "terminal edits and undo survive partial history clearing and whole-screen const bytes = switch (action) { .clear_history, .partial_clear_history => "\x1b[3J", .reset_primary, .reset_alternate => "\x1bc", - .evict_all, .hidden_undo => "new row\r\n" ** 4000, + .evict_all, .hidden_undo => std.mem.asBytes(&@as([4000][9]u8, @splat("new row\r\n".*))), }; p.update(.{ .output = .{ .pane = 0, .bytes = bytes } }); const expected: i32 = if (action == .clear_history) 2 else 0; @@ -2045,7 +2045,7 @@ test "terminal lower scroll regions do not move edits above them" { var setup: [64]u8 = undefined; const bytes = try std.fmt.bufPrint(&setup, "\x1b[4;{d}r\x1b[{d};1H", .{ pane.rows, pane.rows }); p.update(.{ .output = .{ .pane = 0, .bytes = bytes } }); - p.update(.{ .output = .{ .pane = 0, .bytes = "tail\r\n" ** 50 } }); + p.update(.{ .output = .{ .pane = 0, .bytes = std.mem.asBytes(&@as([50][6]u8, @splat("tail\r\n".*))) } }); try std.testing.expectEqual(total, panes.terminal.scrollbar(pane).total); try std.testing.expectEqual(@as(i32, 1), pane.ovl.?.row); try std.testing.expectEqual(@as(i32, 1), pane.body.cur_row); @@ -2064,7 +2064,7 @@ test "terminal eviction and lower-region scrolling in one read preserve a surviv const pane = p.panes[0].?; pane.body.mode = .tty; const pages = &pane.terminal.?.vt.screens.active.pages; - pages.explicit_max_size = 64 * 1024; + pages.limits.set(.bytes, 64 * 1024); var next: usize = 0; while (next < 3000) { var buf: [32]u8 = undefined; @@ -2229,7 +2229,7 @@ test "prompt cancellation restores the selection before regex previews" { } test "a prompt that cannot be opened leaves the open one as it was" { - const Request = @typeInfo(@TypeOf(Pardes.startPrompt)).@"fn".params[3].type.?; + const Request = @typeInfo(@TypeOf(Pardes.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 }); @@ -2268,7 +2268,7 @@ test "Save's prompt starts from the pane's directory" { } test "a prompt opens with one allocation" { - const Request = @typeInfo(@TypeOf(Pardes.startPrompt)).@"fn".params[3].type.?; + const Request = @typeInfo(@TypeOf(Pardes.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 }); @@ -3441,7 +3441,7 @@ const PdfTests = struct { defer probe.deinit(std.testing.allocator); try std.testing.expectEqual(@as(usize, 0), probe.page); try std.testing.expect(probe.quads.len > 0); - try std.testing.expect(std.ascii.indexOfIgnoreCase(probe.text, "Pardes") != null); + try std.testing.expect(std.ascii.findIgnoreCase(probe.text, "Pardes") != null); } test "PDF point mapping restores band origin and fractional placement" { @@ -4812,7 +4812,7 @@ test "growing a file pane colors every newly visible Zig keyword" { const gpa = std.testing.allocator; const p = try Pardes.init(gpa, .{ .tty_only = true, .cols = 80, .rows = 8 }); defer p.deinit(); - const pane = try p.setTestFile("pub fn f() void { if (true) {} }\n" ** 100); + const pane = try p.setTestFile(std.mem.asBytes(&@as([100][33]u8, @splat("pub fn f() void { if (true) {} }\n".*)))); const file = &pane.file.?; gpa.free(file.path); file.path = try gpa.dupe(u8, "/resize.zig"); |
