summaryrefslogtreecommitdiff
path: root/core/panes.zig
diff options
context:
space:
mode:
Diffstat (limited to 'core/panes.zig')
-rw-r--r--core/panes.zig27
1 files changed, 27 insertions, 0 deletions
diff --git a/core/panes.zig b/core/panes.zig
index f4f528b7..67cee035 100644
--- a/core/panes.zig
+++ b/core/panes.zig
@@ -2023,6 +2023,33 @@ 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 "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;
+ const p = try Pardes.init(gpa, .{});
+ defer p.deinit();
+ while (p.nextEffect()) |_| {}
+ p.setCwd(.at(0), "/tmp/pardes-cmd/src/torque");
+ _ = try pardes.Kind.open(p, 1, pardes.Kind.test_kind.of(p), "/tmp/pardes-cmd/src/torque/pic.ppm", null);
+ const dst = exec.execute(p, 1, "make -C ../..") orelse return error.NoCommandPane;
+ while (p.nextEffect()) |_| {}
+ p.update(.{ .output = .{ .pane = .at(dst), .bytes = "make: Entering directory '/tmp/pardes-cmd'\r\n" ++
+ "src/torque/types.cc:163:53: error: did you mean to use '->'?\r\n" ++
+ "make[1]: Entering directory '/tmp/pardes-cmd/tools'\r\n" ++
+ "check.cc:3:1: warning: unused variable 'b'\r\n" ++
+ "make[1]: Leaving directory '/tmp/pardes-cmd/tools'\r\n" ++
+ "utils.cc:7:2: note: declared here\r\n" ++
+ "make: Leaving directory '/tmp/pardes-cmd'\r\n" ++
+ "types.h:1:1: note: in the run's own directory again\r\n" } });
+ p.update(.{ .exited = .{ .pane = .at(dst), .status = 2 } });
+ const said = p.messages.headline() orelse return error.NothingSaid;
+ var names: [512]u8 = undefined;
+ var w: std.Io.Writer = .fixed(&names);
+ for (said.places[0..said.places_len]) |*place| try w.print("{s}:{d}:{d} ", .{ place.path.slice(), place.line, place.col });
+ try std.testing.expectEqualStrings("/tmp/pardes-cmd/src/torque/types.cc:163:53 /tmp/pardes-cmd/tools/check.cc:3:1 /tmp/pardes-cmd/utils.cc:7:2 /tmp/pardes-cmd/src/torque/types.h:1:1 ", w.buffered());
+ try std.testing.expectEqual(@as(u8, 0), said.detail_len);
+}
+
test "a failed run's error names that run's places, each once: a rerun in the same pane does not read the run before it again, and a note at an error's place is not a second place" {
if (pardes.Term.ops == null) return error.SkipZigTest; // a command pane's terminal
const gpa = std.testing.allocator;