diff options
Diffstat (limited to 'test/behaviour')
| -rw-r--r-- | test/behaviour/keys.zig | 6 | ||||
| -rw-r--r-- | test/behaviour/panes.zig | 2 | ||||
| -rw-r--r-- | test/behaviour/tags.zig | 48 |
3 files changed, 28 insertions, 28 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. |
