diff options
Diffstat (limited to 'test/snapshot.zig')
| -rw-r--r-- | test/snapshot.zig | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/test/snapshot.zig b/test/snapshot.zig index aeb01187..4344654c 100644 --- a/test/snapshot.zig +++ b/test/snapshot.zig @@ -26,7 +26,7 @@ // // Script commands (line-oriented, # comments): // file <name> <content> create file in the script's cwd (before start) -// lines <name> <n> create file with n numbered lines +// lines <name> <n> [tail] create file with n numbered lines, tail on each // dirmk <name> create a subdirectory // start <rows> <cols> [arg] fork the app in a pty (optional extra CLI arg) // wait <ms> <needle...> pump until needle appears on the grid (fails hard) @@ -346,8 +346,13 @@ fn runScript(arena: std.mem.Allocator, exe_z: [:0]const u8, script_path: []const } else if (std.mem.eql(u8, cmd, "lines")) { const name = tok.next() orelse return error.BadScript; const n = try std.fmt.parseInt(usize, tok.next() orelse return error.BadScript, 10); + // anything after the count is glued onto every line (no separator: + // `rest` eats the delimiter, so spell one in the tail if you want + // one) — a file that is long AND wide, which is what a horizontal + // scroll test needs and `file` can only give as one huge script line + const tail = tok.rest(); var buf: std.ArrayList(u8) = .empty; - for (1..n + 1) |i| try buf.appendSlice(arena, try std.fmt.allocPrint(arena, "line {d}\n", .{i})); + for (1..n + 1) |i| try buf.appendSlice(arena, try std.fmt.allocPrint(arena, "line {d}{s}\n", .{ i, tail })); try eh.writeFile(try arena.dupeZ(u8, name), buf.items); } else if (std.mem.eql(u8, cmd, "ppmdiag")) { // The diagonal-split test PPM from the old e2e (white over blue), |
