summaryrefslogtreecommitdiff
path: root/test/process_test.zig
diff options
context:
space:
mode:
Diffstat (limited to 'test/process_test.zig')
-rw-r--r--test/process_test.zig10
1 files changed, 7 insertions, 3 deletions
diff --git a/test/process_test.zig b/test/process_test.zig
index bab80183..5876e005 100644
--- a/test/process_test.zig
+++ b/test/process_test.zig
@@ -5,7 +5,7 @@
//! its own instead (test/tty.zig), on the tty alone.
//!
//! pardes-process-test <pardes> [--backend=tui|gui] [--addon=<lib>]...
-//! [--lspmock=<exe>] [--update] [filter]
+//! [--lspmock=<exe>] [--update] [--replay [--replay-with=<pardes>]] [filter]
const std = @import("std");
const process = @import("process.zig");
const tty = @import("tty.zig");
@@ -53,6 +53,10 @@ pub fn main(init: std.process.Init) !void {
tty.lspmock = try std.Io.Dir.cwd().realPathFileAlloc(init.io, a["--lspmock=".len..], arena);
} else if (std.mem.eql(u8, a, "--update")) {
tty.update = true;
+ } else if (std.mem.eql(u8, a, "--replay")) {
+ tty.replay = true;
+ } else if (std.mem.startsWith(u8, a, "--replay-with=")) {
+ tty.replay_with = try std.Io.Dir.cwd().realPathFileAlloc(init.io, a["--replay-with=".len..], arena);
} else if (n < args.len) {
args[n] = a;
n += 1;
@@ -62,13 +66,13 @@ pub fn main(init: std.process.Init) !void {
// Absolute: a tty case runs in a directory of its own.
const exe = try std.Io.Dir.cwd().realPathFileAlloc(init.io, args[0], arena);
const filter: []const u8 = if (n > 1) args[1] else "";
- tty.goldens = try std.Io.Dir.cwd().realPathFileAlloc(init.io, "test/snapshots", arena);
+ tty.goldens = std.Io.Dir.cwd().realPathFileAlloc(init.io, "test/snapshots", arena) catch tty.goldens;
const gpa = std.heap.page_allocator;
const on = @tagName(process.backend);
var failed: usize = 0;
var skipped: usize = 0;
var ran: usize = 0;
- if (!tty.update) inline for (files) |file| inline for (file.cases) |case| {
+ if (!tty.update and !tty.replay) inline for (files) |file| inline for (file.cases) |case| {
if (std.mem.indexOf(u8, case[0], filter) != null) {
ran += 1;
const t0 = process.nowMs();