summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/behaviour/keys.zig6
-rw-r--r--test/behaviour/panes.zig2
-rw-r--r--test/behaviour/tags.zig48
-rw-r--r--test/panes.zig4
-rw-r--r--test/process/tty_editing.zig20
-rw-r--r--test/process/tty_layout.zig2
-rw-r--r--test/process/tty_terminals.zig4
-rw-r--r--test/snapshots/ttytaken.golden2
8 files changed, 44 insertions, 44 deletions
diff --git a/test/behaviour/keys.zig b/test/behaviour/keys.zig
index e8731d2c..60c1c42d 100644
--- a/test/behaviour/keys.zig
+++ b/test/behaviour/keys.zig
@@ -38,7 +38,7 @@ test "keys: a prompt's entry and cancellation leave the tag, the body and its cu
// Save on a scratch asks for a path, starting from its directory.
const scratch = try s.newPane();
const scratch_tag = try s.read(s.at("/pane/{d}/tag", .{scratch}));
- try s.keys(":\tzq");
+ try s.keys("::\tzq");
_ = try s.where("/zq");
try s.expect(s.at("/pane/{d}/tag", .{scratch}), scratch_tag);
try s.keys("\x1b");
@@ -268,7 +268,7 @@ test "keys: Save's prompt on a scratch starts from the scratch's directory, one
// New from the file's pane: a scratch in its directory.
try s.write(s.at("/pane/{d}/exec", .{n}), "New\n");
try std.testing.expect(try s.focused() != n);
- try s.keys(":\tzq");
+ try s.keys("::\tzq");
_ = try s.where(c[1]);
try s.keys("\x1b");
}
@@ -370,7 +370,7 @@ test "keys: a PDF in normal mode keeps : (its tag and back), SPC (a leader, canc
try std.testing.expect(try s.cursor() == null);
_ = try s.pdfPage(n);
const tag = (try s.where("[1/"))[1];
- try s.keys(":");
+ try s.keys("::");
// On its tag, which runs to three rows (its path, the core's art words).
const on_tag = (try s.cursor()).?[1];
try std.testing.expect(on_tag >= tag and on_tag <= tag + 2);
diff --git a/test/behaviour/panes.zig b/test/behaviour/panes.zig
index 4d4c812c..ece65efe 100644
--- a/test/behaviour/panes.zig
+++ b/test/behaviour/panes.zig
@@ -250,7 +250,7 @@ test "panes: Collapse keeps the text and folds the pane to its tag, and again re
try s.expect(s.at("/pane/{d}/body", .{n}), "keep this text\n");
try s.expect(s.at("/pane/{d}/dirty", .{n}), "0\n");
// Its tag still takes the keyboard, the cursor on the tag's row.
- try s.keys(":");
+ try s.keys("::");
try std.testing.expectEqual((try s.where("/test.txt"))[1], (try s.cursor()).?[1]);
try s.write(ctl, "Collapse\n");
try std.testing.expect(std.mem.indexOf(u8, try s.read(ctl), " collapsed ") == null);
diff --git a/test/behaviour/tags.zig b/test/behaviour/tags.zig
index 395b63c8..35a5f882 100644
--- a/test/behaviour/tags.zig
+++ b/test/behaviour/tags.zig
@@ -25,7 +25,7 @@ test "tags: s and S in a tag answer for the tag's own text; / still searches the
const n = try s.focused();
try s.replace(s.at("/pane/{d}/tag", .{n}), " Save Del Snarf");
// The tag's line, its S's selected, then changed: both are the tag's.
- try s.keys(":xsS\ncZ\x1b");
+ try s.keys("::xsS\ncZ\x1b");
try std.testing.expectEqualStrings("/test.txt Zave Del Znarf", try tag(&s, n));
try s.expect(s.at("/pane/{d}/body", .{n}), "Some body\n");
// `/` from the tag is the body's search, as acme's Look from a tag is.
@@ -38,7 +38,7 @@ test "tags: ms and md edit a tag's own text, and the text the edit made is read
var s = try Session.initFile(std.testing.allocator, "body\n");
defer s.deinit();
const n = try s.focused();
- try s.keys(":miwms(");
+ try s.keys("::miwms(");
try std.testing.expectEqualStrings("/test.txt (Save) Term Collapse Follow Del", try tag(&s, n));
try s.keys("md(");
try std.testing.expectEqualStrings("/test.txt Save Term Collapse Follow Del", try tag(&s, n));
@@ -50,7 +50,7 @@ test "tags: the keyboard reaches a tag's path, which it can select and yank but
const n = try s.focused();
const before = try tag(&s, n);
// `0` is the line's start, as in acme, where the name is ordinary text.
- try s.keys(":0");
+ try s.keys("::0");
try std.testing.expectEqual(@as(usize, 0), try tagCol(&s, "/test.txt"));
// An edit that reaches into it is refused, the cursor with it.
try s.keys("Eyd");
@@ -63,7 +63,7 @@ test "tags: the keyboard reaches a tag's path, which it can select and yank but
try s.keys("\x1b\x1b");
try s.expect(s.at("/pane/{d}/name", .{n}), "/test.txt\n");
// After the path, the text is the tag's own to edit.
- try s.keys(":A!\x1b");
+ try s.keys("::A!\x1b");
try std.testing.expectEqualStrings("/test.txt Save Term Collapse Follow Del!", try tag(&s, n));
// What it yanked was the path.
try s.keys(":P");
@@ -81,7 +81,7 @@ test "tags: a tag remembers its cursor, starts on Save, and a click moves it" {
const other = s.at("{d}", .{second});
try s.write("/focus", focus);
// Nothing to remember yet: `:` lands on Save.
- try s.keys(":");
+ try s.keys("::");
try std.testing.expectEqual(@as(usize, "/test.txt ".len), try tagCol(&s, "/test.txt"));
// Home is the line's start, the path's: the keyboard reaches it.
try s.keys(home ++ right ++ right ++ right);
@@ -90,13 +90,13 @@ test "tags: a tag remembers its cursor, starts on Save, and a click moves it" {
try s.keys(":");
try std.testing.expect((try s.cursor()).?[1] != (try s.where("/test.txt"))[1]);
try s.write("/focus", other);
- try s.keys(":" ++ home ++ right ++ right ++ right ++ right ++ right ++ ":");
+ try s.keys("::" ++ home ++ right ++ right ++ right ++ right ++ right ++ ":");
try s.write("/focus", focus);
- try s.keys(":");
+ try s.keys("::");
try std.testing.expectEqual(@as(usize, 3), try tagCol(&s, "/test.txt"));
try s.keys(":");
try s.write("/focus", other);
- try s.keys(":");
+ try s.keys("::");
try std.testing.expectEqual(@as(usize, 5), try tagCol(&s, "/second.txt"));
try s.keys(":");
// A click in the tag puts its cursor there, the pane's keyboard with it.
@@ -105,7 +105,7 @@ test "tags: a tag remembers its cursor, starts on Save, and a click moves it" {
try std.testing.expectEqual(@as(usize, "/test.txt Save T".len), try tagCol(&s, "/test.txt"));
// A prompt opened and left from the body leaves it there (a clicked
// tag is in normal mode: `:` goes back to the body).
- try s.keys(":/\x1b:");
+ try s.keys(":/\x1b::");
try std.testing.expectEqual(@as(usize, "/test.txt Save T".len), try tagCol(&s, "/test.txt"));
try s.keys(":");
try s.expect(s.at("/pane/{d}/body", .{first}), "body\n");
@@ -119,13 +119,13 @@ test "tags: executing a word from the tag runs it and gives the keyboard back to
try s.keys("ix\x1b");
// `:` lands on Save; the execute key runs it, the look key looks
// it up. Either way the tag lets go of the keyboard first.
- try s.keys(":");
+ try s.keys("::");
try s.keys(chord);
try std.testing.expectEqual(@as(usize, if (chord[0] == '\t') 1 else 0), s.saved);
try s.keys("iQ\x1b");
try s.expect(s.at("/pane/{d}/body", .{n}), "xQbody\n");
// ...and the tag still knows where it was.
- try s.keys(":");
+ try s.keys("::");
try std.testing.expectEqual(@as(usize, "/test.txt ".len), try tagCol(&s, "/test.txt"));
}
}
@@ -134,13 +134,13 @@ test "tags: a renamed path moves the tag's cursor with the text after it and a s
var s = try Session.initFile(std.testing.allocator, "body\n");
defer s.deinit();
const n = try s.focused();
- try s.keys("::"); // on Save, and back
+ try s.keys(":::"); // `::` on Save, and `:` back
try s.write(s.at("/pane/{d}/name", .{n}), "/界.zig");
- try s.keys(":");
+ try s.keys("::");
try std.testing.expectEqual(@as(usize, "/界.zig ".len - 1), try tagCol(&s, "/界"));
try s.keys(":");
try s.replace(s.at("/pane/{d}/tag", .{n}), "é");
- try s.keys(":");
+ try s.keys("::");
// `/界.zig é`: the cursor is pulled back onto the last character.
try std.testing.expectEqual(@as(usize, "/界.zig ".len - 1), try tagCol(&s, "/界"));
try s.expect(s.at("/pane/{d}/body", .{n}), "body\n");
@@ -153,13 +153,13 @@ test "tags: window keys move between panes from a tag and each tag keeps its cur
const second = try s.newPane();
try s.write(s.at("/pane/{d}/name", .{second}), "/second.txt");
try s.write("/focus", s.at("{d}", .{first}));
- try s.keys(":" ++ home ++ "ll" ++ window ++ "j\n");
+ try s.keys("::" ++ home ++ "ll" ++ window ++ "j\n");
try std.testing.expectEqual(second, try s.focused());
- try s.keys(":" ++ home ++ "llll" ++ window ++ "k\n");
+ try s.keys("::" ++ home ++ "llll" ++ window ++ "k\n");
try std.testing.expectEqual(first, try s.focused());
- try s.keys(":");
+ try s.keys("::");
try std.testing.expectEqual(@as(usize, 2), try tagCol(&s, "/test.txt"));
- try s.keys(window ++ "j\n:");
+ try s.keys(window ++ "j\n::");
try std.testing.expectEqual(@as(usize, 4), try tagCol(&s, "/second.txt"));
}
@@ -170,7 +170,7 @@ test "tags: a tag's normal mode is the body's: motions stay in the tag and inser
try s.write("/ctl", "Newcol\n");
const right_pane = try s.newPane();
try s.write("/focus", s.at("{d}", .{first}));
- try s.keys(":" ++ home ++ "l");
+ try s.keys("::" ++ home ++ "l");
try std.testing.expectEqual(@as(usize, 1), try tagCol(&s, "/test.txt"));
try s.keys("hkj");
try std.testing.expectEqual(@as(usize, 0), try tagCol(&s, "/test.txt"));
@@ -179,7 +179,7 @@ test "tags: a tag's normal mode is the body's: motions stay in the tag and inser
try std.testing.expectEqual(right_pane, try s.focused());
try s.keys(window ++ "h\n");
try std.testing.expectEqual(first, try s.focused());
- try s.keys(":i\u{F018}hjklHJKL:");
+ try s.keys("::i\u{F018}hjklHJKL:");
try std.testing.expectEqualStrings("/test.txt Save Term Collapse Follow DelhjklHJKL:", try tag(&s, first));
try std.testing.expect(std.mem.endsWith(u8, try s.read(s.at("/pane/{d}/ctl", .{first})), " mode:normal "));
try s.expect(s.at("/pane/{d}/body", .{first}), "body\n");
@@ -191,7 +191,7 @@ test "tags: a tag with a newline in it is as tall as its lines, and each line is
defer s.deinit();
const n = try s.focused();
// Insert mode in a tag is a body's: Enter is a new line.
- try s.keys(":A\nSecond");
+ try s.keys("::A\nSecond");
try std.testing.expectEqualStrings("/test.txt Save Term Collapse Follow Del\nSecond", try tag(&s, n));
const x, const y = try s.where("/test.txt");
try std.testing.expectEqual(.{ x, y + 1 }, try s.where("Second"));
@@ -220,7 +220,7 @@ test "tags: a tag with more lines than rows scrolls to keep its caret in view" {
try s.write(s.at("/pane/{d}/tag", .{n}), many.items);
const x, const y = try s.where("/test.txt");
// To the last line: the tag scrolls so it is the bottom row, caret on it.
- try s.keys(":ge");
+ try s.keys("::ge");
const lx, const ly = try s.where("L20");
try std.testing.expectEqual(.{ lx, ly }, (try s.cursor()).?);
// What the pointer sees is what is shown: its first row is line 13.
@@ -250,7 +250,7 @@ test "tags: a long pane tag wraps onto rows, and a click on a wrapped row maps t
try s.write(s.at("/pane/{d}/name", .{n}), "/an/especially/deep/project/path/with/a/long/component/filename.zig");
try s.write(s.at("/pane/{d}/tag", .{n}), " JumpTrail");
const before = try tag(&s, n);
- try s.keys(":A");
+ try s.keys("::A");
try std.testing.expect((try s.cursor()).?[0] < 50);
// JumpTrail is on a row of its own, below the path's.
try std.testing.expect((try s.where("JumpTrail"))[1] > (try s.where("/an/"))[1]);
@@ -437,7 +437,7 @@ test "tags: truncating a tag clears its own text, u in the tag undoes it, and >
s.clunk(h);
try std.testing.expectEqualStrings("/test.txt", std.mem.trimEnd(u8, try tag(&s, n), " "));
// The tag keeps its undo: undoing in it brings back what was cleared.
- try s.keys(":u:");
+ try s.keys("::u:");
try std.testing.expect(std.mem.endsWith(u8, try tag(&s, n), " Mine"));
// Written back without a leading space, the text still stands apart
// from the path, and a click on its first letter lands on it.
diff --git a/test/panes.zig b/test/panes.zig
index ba3466fb..b68f1e2e 100644
--- a/test/panes.zig
+++ b/test/panes.zig
@@ -911,7 +911,7 @@ test "paste into pane commands and prompts never inserts into the body" {
const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true });
defer p.deinit();
const pane = try p.setTestFile("one two one\n");
- p.update(.{ .key = .{ .cp = ':' } });
+ for ("::") |c| p.update(.{ .key = .{ .cp = c } }); // the tag (`:` on the empty `:` field)
p.update(.{ .key = .{ .cp = 'A' } });
// A tag takes a paste as a body does, newline and all.
p.update(.{ .paste = " Custom\nCommand" });
@@ -940,7 +940,7 @@ test "a tag that exactly fills its row stays one row, its caret at the edge as a
path[0] = '/';
pane.file.?.path = path;
try std.testing.expectEqual(width, (try pardes.tagline.tagText(p, p.scratch.allocator(), pane)).len);
- p.update(.{ .key = .{ .cp = ':' } });
+ for ("::") |c| p.update(.{ .key = .{ .cp = c } }); // the tag (`:` on the empty `:` field)
p.update(.{ .key = .{ .cp = 'A' } });
var arena = std.heap.ArenaAllocator.init(p.gpa);
defer arena.deinit();
diff --git a/test/process/tty_editing.zig b/test/process/tty_editing.zig
index 53e1da1e..e6af5562 100644
--- a/test/process/tty_editing.zig
+++ b/test/process/tty_editing.zig
@@ -109,7 +109,7 @@ fn fileedit(gpa: std.mem.Allocator, exe: [:0]const u8) !void {
try t.snap("undone");
// Save through the file pane's own tag: `:` focuses that same tag and `w`
// selects Save before the ordinary execute key runs it.
- try t.key(":");
+ try t.key(": :");
try t.stable(400, 5000);
try t.key("w tab");
try t.stable(600, 8000);
@@ -1373,7 +1373,7 @@ fn cmdword(gpa: std.mem.Allocator, exe: [:0]const u8) !void {
// opens ITS tag; `A` appends at the end of it, Esc and `h` put the
// normal-mode cursor on the last character typed, and the execute key runs
// the word under it exactly as the body's does.
- try t.key(":");
+ try t.key(": :");
try t.key("A");
try t.key("space");
try t.send("Exec");
@@ -1389,7 +1389,7 @@ fn cmdword(gpa: std.mem.Allocator, exe: [:0]const u8) !void {
try t.snap("execword");
// a command word run from that tag runs as a command pane in the directory
// the pane lists, as a word run from any text pane's tag does
- try t.key(":");
+ try t.key(": :");
try t.key("A");
try t.key("space");
try t.send("@`echo ZZ''T`");
@@ -2376,7 +2376,7 @@ fn tagcmd(gpa: std.mem.Allocator, exe: [:0]const u8) !void {
try t.stable(400, 5000);
try t.snap("edited");
// `:` -> the tag, in normal mode, cursor on Save
- try t.key(":");
+ try t.key(": :");
try t.stable(400, 5000);
try t.snap("colon");
// w -> the "Save" span (selected, like the body's word motion)
@@ -2390,7 +2390,7 @@ fn tagcmd(gpa: std.mem.Allocator, exe: [:0]const u8) !void {
try t.snap("saved");
try t.snapFile("written", "/tmp/pardes-snap/tagcmd/cwd/c.txt");
// `:` then `:`: back to the body with the tag untouched, nothing run
- try t.key(":");
+ try t.key(": :");
try t.stable(400, 5000);
try t.key(":");
try t.stable(400, 5000);
@@ -2433,7 +2433,7 @@ fn tagnav(gpa: std.mem.Allocator, exe: [:0]const u8) !void {
try t.stable(400, 5000);
try t.snap("start");
// `:` -> the file's OWN tagline, normal mode, on Save
- try t.key(":");
+ try t.key(": :");
try t.stable(400, 5000);
try t.snap("colon");
// w selects in the tag the way it selects in a body
@@ -2450,13 +2450,13 @@ fn tagnav(gpa: std.mem.Allocator, exe: [:0]const u8) !void {
try t.stable(400, 5000);
try t.snap("right");
// `:` there -> that pane's own tag, on its Save the first time
- try t.key(":");
+ try t.key(": :");
try t.stable(400, 5000);
try t.snap("right-tag");
// back left, and `:` finds the file's tag cursor where l left it
try t.key("c-w h enter");
try t.stable(400, 5000);
- try t.key(":");
+ try t.key(": :");
try t.stable(400, 5000);
try t.snap("left-tag");
// `:` in the tag's normal mode: back to the body
@@ -2537,7 +2537,7 @@ fn tagpath(gpa: std.mem.Allocator, exe: [:0]const u8) !void {
try t.wait(8000, "c.txt");
try t.stable(700, 20000);
try t.snap("start");
- try t.key(":");
+ try t.key(": :");
try t.stable(400, 5000);
try t.snap("colon");
try t.key("0");
@@ -2576,7 +2576,7 @@ fn tagpath(gpa: std.mem.Allocator, exe: [:0]const u8) !void {
try t.key("esc");
try t.stable(400, 5000);
try t.snap("name-cancelled");
- try t.key(":");
+ try t.key(": :");
try t.key("0");
try t.key("i");
try t.send("/renamed");
diff --git a/test/process/tty_layout.zig b/test/process/tty_layout.zig
index 08a02488..d73f943f 100644
--- a/test/process/tty_layout.zig
+++ b/test/process/tty_layout.zig
@@ -436,7 +436,7 @@ fn tagalign(gpa: std.mem.Allocator, exe: [:0]const u8) !void {
try t.settle(100);
try t.key("esc");
try t.settle(100);
- try t.key(":");
+ try t.key(": :");
try t.key("A");
try t.stable(400, 5000);
try t.snap("revealed");
diff --git a/test/process/tty_terminals.zig b/test/process/tty_terminals.zig
index 9f7c9308..1679aaf1 100644
--- a/test/process/tty_terminals.zig
+++ b/test/process/tty_terminals.zig
@@ -426,7 +426,7 @@ fn ttytaken(gpa: std.mem.Allocator, exe: [:0]const u8) !void {
// at the prompt: a command word in the terminal's own tag, executed, is
// typed into its shell. `:` opens the tag, `A` appends, and the execute key
// runs the word under the cursor.
- try t.key(":");
+ try t.key(": :");
try t.key("A");
try t.key("space");
try t.send("@`echo TAKEN''ONE`");
@@ -450,7 +450,7 @@ fn ttytaken(gpa: std.mem.Allocator, exe: [:0]const u8) !void {
try t.stable(400, 5000);
try t.snap("paging");
// the same gesture from that terminal: a command pane, not `less` keystrokes
- try t.key(":");
+ try t.key(": :");
try t.key("A");
try t.key("space");
try t.send("@`echo TAKEN''TWO`");
diff --git a/test/snapshots/ttytaken.golden b/test/snapshots/ttytaken.golden
index ee72ccc2..0a9f94b6 100644
--- a/test/snapshots/ttytaken.golden
+++ b/test/snapshots/ttytaken.golden
@@ -7,7 +7,7 @@
== snap at-prompt grid=210x31 cursor=4,5
|2: /tmp/pardes-snap/ttytaken/cwd Term+bash Save Mode Filter Collapse Del @`echo TAKEN''ONE`
|3: ls Exec
-|5: echo TAKEN''ONE
+|5: echo TAKEN''ONE
|6: TAKENONE
== snap paging grid=210x31 cursor=9,30
|3: line 1