diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-04 11:03:55 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-04 11:03:55 -0300 |
| commit | 21e09998114a866ae76ecef68d660e84561daa44 (patch) | |
| tree | 12237b50e772df336e2c8fc7d59cfd69607d4afb /test/process_test.zig | |
| parent | 5752e5c94f27eced137f4ca061c68715d8b7131a (diff) | |
| download | pardes-21e09998114a866ae76ecef68d660e84561daa44.tar.gz pardes-21e09998114a866ae76ecef68d660e84561daa44.zip | |
test: the process runner, test/process.zig (docs/next-tests.md, the user's one runner): Files, a running pardes's file tree over its socket with Session's method names (read, write, expect, keys, click, where, screen, focused, newPane, at), dialled by pid or path, and Detached, a `pardes --detach` in a throwaway root that is its HOME, runtime and config directory, with no daemon (PARDES_DAEMON=off) so nothing outlives it, its stderr kept and said if it exits early; the pty mode is e2e_harness's Harness with process.of; the process-test step runs test/process_test.zig over test/process/*.zig, its first case fs.py's keys_and_mouse (gone from fs.py); snap9p reads /screen through Files; all 113 snap scripts pass
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
Diffstat (limited to 'test/process_test.zig')
| -rw-r--r-- | test/process_test.zig | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/test/process_test.zig b/test/process_test.zig new file mode 100644 index 00000000..9924b9dd --- /dev/null +++ b/test/process_test.zig @@ -0,0 +1,33 @@ +//! The process tests (T2 of docs/next-tests.md): each case starts a real +//! pardes through test/process.zig and drives it over its socket. A file +//! in test/process/ a section of the book, as test/behaviour/'s are. +//! +//! pardes-process-test <pardes> [filter] +const std = @import("std"); + +const files = .{ + @import("process/other_files.zig"), +}; + +pub fn main(init: std.process.Init) !void { + const args = try init.minimal.args.toSlice(init.arena.allocator()); + if (args.len < 2) return error.Usage; + const exe = args[1]; + const filter: []const u8 = if (args.len > 2) args[2] else ""; + const gpa = std.heap.page_allocator; + var failed: usize = 0; + var ran: usize = 0; + inline for (files) |file| inline for (file.cases) |case| { + if (std.mem.indexOf(u8, case[0], filter) != null) { + ran += 1; + if (case[1](gpa, exe)) { + std.debug.print("PASS {s}\n", .{case[0]}); + } else |err| { + failed += 1; + std.debug.print("FAIL {s}: {t}\n", .{ case[0], err }); + } + } + }; + std.debug.print("{d} of {d} process tests failed\n", .{ failed, ran }); + if (failed > 0 or ran == 0) std.process.exit(1); +} |
