summaryrefslogtreecommitdiff
path: root/test/process/tty_editing.zig
diff options
context:
space:
mode:
Diffstat (limited to 'test/process/tty_editing.zig')
-rw-r--r--test/process/tty_editing.zig24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/process/tty_editing.zig b/test/process/tty_editing.zig
index 72cbb573..b5f0495c 100644
--- a/test/process/tty_editing.zig
+++ b/test/process/tty_editing.zig
@@ -35,6 +35,7 @@ pub const cases = .{
.{ "tty editing: lsp-rename-files", lsp_rename_files },
.{ "tty editing: callstack", callstack },
.{ "tty editing: diffview", diffview },
+ .{ "tty editing: diffstack", diffstack },
.{ "tty editing: dirpane", dirpane },
.{ "tty editing: scrolloff", scrolloff },
.{ "tty editing: wrap", wrap },
@@ -2018,6 +2019,29 @@ fn diffview(gpa: std.mem.Allocator, exe: [:0]const u8) !void {
try t.done();
}
+// A diff paged (`pardes -`) is stacked in a +Diff: its hunk found where the
+// file has moved it since (two lines further down), under the declaration it
+// stands in (`a.zig:3`, `const S = struct {`) and its label one level deep
+// (`a.zig:5 *`); a changed line's changed word on a stronger ground in both
+// lines (`c` and `a`), and a line added whole (`log();`) on a faint one, each
+// marker in its tint's hue.
+fn diffstack(gpa: std.mem.Allocator, exe: [:0]const u8) !void {
+ var t = try Tty.init(gpa, exe, "diffstack");
+ defer t.deinit();
+ try t.file("a.zig", "// one\n// two\nconst S = struct {\n fn f() void {\n a();\n b();\n log();\n }\n};\n");
+ try t.file("change.patch", "--- a.zig\n+++ a.zig\n@@ -3,4 +3,5 @@ git's guess\n fn f() void {\n- c();\n+ a();\n b();\n+ log();\n }\n");
+ try t.start(31, 100, &.{});
+ try t.wait(8000, "$");
+ try t.stable(700, 20000);
+ try t.send("cat change.patch | $(readlink /proc/$PPID/exe) -");
+ try t.key("enter");
+ try t.wait(20000, "a.zig:5 *");
+ try t.stable(700, 20000);
+ try t.snap("diff-stack");
+ try t.style("diff-stack-colours");
+ try t.done();
+}
+
// a look at a directory opens a pane named for it with a trailing /, its
// entries in columns as acme's directory window lays them out: down each
// column first, a directory's marked /, dotfiles shown. A look at an entry