diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-04 11:09:10 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-04 11:17:24 -0300 |
| commit | a5504e6e808c5b147e114d43b5c165bbe714f3c3 (patch) | |
| tree | 81d61c2d451a8715ca076088414be226dd49cb9a /test/behaviour/builtins.zig | |
| parent | fa3031d6ded24d4ba7ab5bab21e17387e48306aa (diff) | |
| download | pardes-a5504e6e808c5b147e114d43b5c165bbe714f3c3.tar.gz pardes-a5504e6e808c5b147e114d43b5c165bbe714f3c3.zip | |
test: test/output.zig's Mini, setting and command-output LookNext tests through the 9P tree alone: in a new test/behaviour/builtins.zig (docs/typ/builtins.typ) Mini mapping a file of the pane's directory over pardes's own of that name, one pane for it, a snapshot refreshed only by the next Mini, and Save on it writing nothing (the old test trimmed to the watch it never asks for, an effect); in test/behaviour/settings.zig every on/off setting the root ctl reads flipping when its word is written bare, and Theme and Shell taking a value (the old test trimmed to a window's fonts, transitions and passes in DumpConfig's report); in test/behaviour/keys.zig SPC j n in a command output (+Themes) selecting its whole row, Tab running it, and from a pane a Look took the keyboard to walking on in it, and SPC j n and SPC j p walking on and back from the place a Look's +Search listing chose (the old test trimmed to its fillResults answers); each checked to fail against a break (Mini making a new pane each time, a setting's bare word not flipping it, a command output's grain a word, the walk's owner forgotten)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
Diffstat (limited to 'test/behaviour/builtins.zig')
| -rw-r--r-- | test/behaviour/builtins.zig | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/test/behaviour/builtins.zig b/test/behaviour/builtins.zig new file mode 100644 index 00000000..6f029072 --- /dev/null +++ b/test/behaviour/builtins.zig @@ -0,0 +1,35 @@ +//! docs/typ/builtins.typ, the builtins' glossary. +const std = @import("std"); +const Session = @import("session").Session; + +test "builtins: Mini maps a file of the pane's directory over pardes's own source of that name, in one pane, refreshed only when asked again" { + var tmp = std.testing.tmpDir(.{}); + defer tmp.cleanup(); + try tmp.dir.writeFile(std.testing.io, .{ .sub_path = "build.zig", .data = "x\n" }); + try tmp.dir.writeFile(std.testing.io, .{ .sub_path = "a.txt", .data = "a\n" }); + var dir: [4096]u8 = undefined; + const at = dir[0..try tmp.dir.realPath(std.testing.io, &dir)]; + var s = try Session.initFile(std.testing.allocator, "x\n"); + defer s.deinit(); + try s.write("/look", s.at("{s}/a.txt\n", .{at})); + const a = try s.focused(); + // The directory's one-line build.zig, one braille row, not pardes's. + try s.write(s.at("/pane/{d}/exec", .{a}), "Mini build.zig\n"); + const mini = try s.focused(); + try std.testing.expect(mini != a); + const body = s.at("/pane/{d}/body", .{mini}); + try s.expect(body, "⠁\n"); + const index = try s.read("/index"); + try s.write(s.at("/pane/{d}/exec", .{mini}), "Mini build.zig\n"); + try std.testing.expectEqual(mini, try s.focused()); + try s.expect("/index", index); + // A snapshot: the file grown on disk shows only at the next Mini. + try tmp.dir.writeFile(std.testing.io, .{ .sub_path = "build.zig", .data = "xx\n" }); + try s.expect(body, "⠁\n"); + try s.write(s.at("/pane/{d}/exec", .{mini}), "Mini build.zig\n"); + try s.expect(body, "⠉\n"); + try s.expect("/index", index); + // Save asks for a path; nothing is written for it. + try s.write(s.at("/pane/{d}/exec", .{mini}), "Save\n"); + try std.testing.expectEqual(@as(usize, 0), s.saved); +} |
