diff options
Diffstat (limited to 'core/panes.zig')
| -rw-r--r-- | core/panes.zig | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/core/panes.zig b/core/panes.zig index 67cee035..51179df0 100644 --- a/core/panes.zig +++ b/core/panes.zig @@ -2023,6 +2023,31 @@ test "a command whose run fails naming places is an error of its pane, those pla try std.testing.expect(p.messages.headline() == null or p.messages.headline().?.kind != .@"error"); } +test "the same command line run again in the same directory takes its earlier run's error, whatever pane ran it (the failed one still printing a job's output, so not reused); another line's run, ending well, leaves it" { + if (pardes.Term.ops == null) return error.SkipZigTest; // a command pane's terminal + const gpa = std.testing.allocator; + const p = try Pardes.init(gpa, .{}); + defer p.deinit(); + while (p.nextEffect()) |_| {} + p.setCwd(.at(0), "/tmp/pardes-cmd"); + _ = try pardes.Kind.open(p, 1, pardes.Kind.test_kind.of(p), "/tmp/pardes-cmd/pic.ppm", null); + const failed = exec.execute(p, 1, "make") orelse return error.NoCommandPane; + while (p.nextEffect()) |_| {} + p.update(.{ .output = .{ .pane = .at(failed), .bytes = "src/types.cc:7:11: error: did you mean to use '->'?\r\n" } }); + p.update(.{ .exited = .{ .pane = .at(failed), .status = 2 } }); + try std.testing.expectEqual(pardes.Messages.Kind.@"error", (p.messages.headline() orelse return error.NothingSaid).kind); + const other = exec.execute(p, 1, "make run") orelse return error.NoCommandPane; + while (p.nextEffect()) |_| {} + p.update(.{ .exited = .{ .pane = .at(other), .status = 0 } }); + try std.testing.expect(other != failed); + try std.testing.expectEqual(pardes.Messages.Kind.@"error", (p.messages.headline() orelse return error.NothingSaid).kind); + const again = exec.execute(p, 1, "make") orelse return error.NoCommandPane; + while (p.nextEffect()) |_| {} + try std.testing.expect(again != failed and again != other); + try std.testing.expect(p.messages.headline() == null or p.messages.headline().?.kind != .@"error"); + try std.testing.expect(p.messages.markOf(p.panes[failed].?) == null); +} + test "a failed run's places are read against the directory its tool says it is in: make's `Entering directory` (make -C, a make in a make) until its `Leaving directory`, as Emacs's compilation mode and Vim's %D and %X read them, those two lines no detail" { if (pardes.Term.ops == null) return error.SkipZigTest; // a command pane's terminal const gpa = std.testing.allocator; |
