summaryrefslogtreecommitdiff
path: root/test/session.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-06 00:02:06 -0300
committerGabriel Schneider <[email protected]>2026-11-06 01:21:34 -0300
commita6f294ef5b50aeb5b69e486838378654e318ed04 (patch)
tree3a223f1027389dd30d8347462cee4f9b6eb7ecf6 /test/session.zig
parente9b4f0e1c37c5c1f369d152d0a70b672433c94b5 (diff)
downloadpardes-a6f294ef5b50aeb5b69e486838378654e318ed04.tar.gz
pardes-a6f294ef5b50aeb5b69e486838378654e318ed04.zip
kinds #4, the fake addon and the addon test: addons/fake/fake.c is the template, every function of src/kinds/pardes_addon.h in a few lines (a counter its keys, clicks, words, ticks and jobs move, a 2x2 picture, a body, an address, a ctl read, a dump and a load), built by the build with -Wall -Wextra -Werror four more ways for the loader to refuse (another ABI, no pardes_addon, a word that is the core's) or reload (no record of its own); `pardes --addon-test <lib> <script>` loads a library into a session of its own (80x24 unless `size`, `seed N` for the panes' seeds, jobs at once, a clock moved only by `tick` and `settle`, which ticks until the kind asks for no frame) and prints the pane's tag, cells and placements after each line of keys, clicks and words; the addon-test step (and behaviour-test) runs it over the fake against addons/fake/fake.out; T1 (test/behaviour/addons.zig): Addon load, /addons with its path, BLAKE3 and panes open, the words in /commands and Help, a word refused away from its kind, unload refused while a pane is open, a compiled-in kind not unloadable; a library of another ABI, one with no export, one whose word is the core's and a file that is no library each refused and listed with why; a pane of the kind taking keys, a click, a word, a job, its body and ctl read, Esc leaving it; a dump restored with the addon, without it (the placeholder, a word refused there), and the addon loaded again reopening it in place with its count; a reload refused for a half-built library with the old one running on, one taking the state across by dump and load, one with no record coming back from its words' last values; a Look by an addon's extension; a test session lets go of its addons at its end (the registry is the process's); gates on the head: core-test 961/961 and unit-test 1494/1495 tui, 1538/1539 gui, behaviour-test 250/250, pane-test 171/172, snap all 108 ok, process-test 0 of 37 failed on both, addon-test ok, hxdiff 19 and hxparity 6 mismatches (the base's), hxgolf 0, replicas, gui-golden, monkey-gui, daemon.py main and window-clients, soak local pass
Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
Diffstat (limited to 'test/session.zig')
-rw-r--r--test/session.zig12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/session.zig b/test/session.zig
index c3e6c579..87bf784e 100644
--- a/test/session.zig
+++ b/test/session.zig
@@ -13,6 +13,16 @@ const Reply = pardes.ctlfs.Reply;
extern "c" fn setenv(name: [*:0]const u8, value: [*:0]const u8, overwrite: c_int) c_int;
pub const Session = struct {
+ /// The fake addon, and its copies built wrong (build.zig).
+ pub const fake_addons = struct {
+ const o = @import("session_options");
+ pub const ok = o.fake_addon;
+ pub const abi = o.fake_addon_abi;
+ pub const no_export = o.fake_addon_no_export;
+ pub const core_word = o.fake_addon_core_word;
+ pub const no_dump = o.fake_addon_no_dump;
+ };
+
core: *anyopaque,
/// What the calls answered, kept until deinit.
arena: std.heap.ArenaAllocator,
@@ -78,6 +88,7 @@ pub const Session = struct {
pub fn deinit(s: *Session) void {
pardesOf(s).deinit();
+ pardes.Addon.unloadAll();
s.arena.deinit();
}
@@ -218,6 +229,7 @@ pub const Session = struct {
.save_file, .save_text => s.saved += 1,
// Into the session's state (a database in memory, or its file).
.write_dump => pardes.host_io.writeDump(pardesOf(s), pardesOf(s).dump_out.?),
+ .addon => |a| pardes.Addon.perform(pardesOf(s), a.op, a.pane, a.arg.slice()),
.lsp => |q| if (s.languages) |io| s.askServer(io, .{ .id = q.id, .kind = q.kind, .pane = q.pane, .offset = q.offset, .arg = q.arg.slice() }),
else => {},
};