summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/behaviour/builtins.zig16
-rw-r--r--test/snapshots/builtins.golden113
-rw-r--r--test/snapshots/builtins.snap4
-rw-r--r--test/snapshots/leader.golden85
4 files changed, 118 insertions, 100 deletions
diff --git a/test/behaviour/builtins.zig b/test/behaviour/builtins.zig
index 3c16a4a2..86ee6ca9 100644
--- a/test/behaviour/builtins.zig
+++ b/test/behaviour/builtins.zig
@@ -34,3 +34,19 @@ test "builtins: Mini maps a file of the pane's directory over pardes's own sourc
try std.testing.expect(std.mem.indexOf(u8, try s.read("/log"), s.at("ask {d} save path\n", .{mini})) != null);
try std.testing.expectEqual(@as(usize, 0), s.saved);
}
+
+test "builtins: Build prints this build into a +Build pane" {
+ var s = try Session.initFile(std.testing.allocator, "x\n");
+ defer s.deinit();
+ try s.write(s.at("/pane/{d}/exec", .{try s.focused()}), "Build\n");
+ const index = try s.read("/index");
+ var serial: ?u32 = null;
+ var lines = std.mem.splitScalar(u8, index, '\n');
+ while (lines.next()) |line| if (std.mem.indexOf(u8, line, "+Build") != null) {
+ serial = try std.fmt.parseInt(u32, line[0..std.mem.indexOfScalar(u8, line, ' ').?], 10);
+ };
+ const body = try s.read(s.at("/pane/{d}/body", .{serial orelse return error.NoBuildPane}));
+ try std.testing.expect(std.mem.startsWith(u8, body, "pardes "));
+ for ([_][]const u8{ "\ncommit ", "\nchange ", "\nbuilt ", "\nzig 0.17", "\nmode ", "\nplatform ", "\ndependencies\n" }) |want|
+ try std.testing.expect(std.mem.indexOf(u8, body, want) != null);
+}
diff --git a/test/snapshots/builtins.golden b/test/snapshots/builtins.golden
index 95fa5f33..fd60bc74 100644
--- a/test/snapshots/builtins.golden
+++ b/test/snapshots/builtins.golden
@@ -19,60 +19,61 @@
|15: 6
== snap docs-group grid=120x67 cursor=7,10
|10: 1 pardes builtins under SPC h
-|12: 3 SPC h c Changelog topbar
-|13: 4 SPC h m Messages
-|14: 5 SPC h t Tutor topbar
-== snap tutor-from-index grid=120x67 cursor=7,16
+|12: 3 SPC h b Build
+|13: 4 SPC h c Changelog topbar
+|14: 5 SPC h m Messages
+|15: 6 SPC h t Tutor topbar
+|16: 7
+== snap tutor-from-index grid=120x67 cursor=7,17
|10: 1 pardes builtins under SPC h Tutor
-|15: /tmp/pardes-snap/builtins/cwd/+Tutor Save Term Collapse Del
-|16: 1
-|17: 2 PARDES TUTOR
-|18: 3
-|19: 4 This pane is +Tutor, a copy: edit it freely; there is no need to
-|20: 5 Save it (a bare Save asks for a path to write a copy to).
-|21: 6 `Del` in its tag closes it; once you have edited it, `Del` refuses
-|22: 7 once and the second `Del` discards. `Tutor` or SPC h t opens a
-|23: 8 fresh copy.
-|24: 9
-|25: 10 The guide (docs/typ/guide.typ) explains; this is the hands-on part.
-|26: 11 Each lesson is a few things to do, then names its guide section.
-|27: 12 Words in backticks, like `Save`, are builtins.
-|28: 13 `Exec` (B2) runs the builtin a word names, or else runs it as a
-|29: 14 shell line; `Look` (B3) opens what the text names, or else finds
-|30: 15 it. Type a builtin in any tag and `Exec` it. Lines starting with
-|31: 16 "| " are tags.
-|32: 17
-|33: 18 Press j until you reach part 1.
-|34: 19
-|35: 20
-|36: 21 =================================================================
-|37: 22 = PART 1 — MODES =
-|38: 23 =================================================================
-|39: 24
-|40: 25 1. The box left of this pane's tag is blank, so you are in
-|41: 26 NORMAL mode. Press i: it shows ^ (INSERT). Type a word, then
-|42: 27 Esc: blank again.
-|43: 28 2. Press Esc once more, in NORMAL: the keyboard goes back to the
-|44: 29 pane you were in before (not what helix does). Come back with
-|45: 30 Esc again.
-|46: 31 3. Press Alt-n: a terminal opens, in NORMAL mode, and pardes types
-|47: 32 ls at its first prompt. Press Ctrl-b: its box shows $ (RAW), and
-|48: 33 keys go to the shell. Esc brings you back here; the terminal stays
-|49: 34 $. Shift-Esc sends the shell an Esc.
-|50: 35
-|51: 36 -> Guide: Modes
-|52: 37
-|53: 38
-|54: 39 =================================================================
-|55: 40 = PART 2 — THE MOUSE =
-|56: 41 =================================================================
-|57: 42
-|58: 43 1. `Look` (B3) the word mouse in this sentence: the next mouse is
-|59: 44 selected.
-|60: 45 2. `Exec` (B2) the word `Help` here: the list of keys opens.
-|61: 46 Close it with `Del` in its tag.
-|62: 47 3. Select a word with B1, keep B1 down, click B2: it is cut. Still
-|63: 48 holding B1, click B3: it comes back. That pair is a copy.
-|64: 49 4. Put the cursor on `Help` and press Tab: `Exec`, as B2. Enter
-|65: 50 is `Look`, as B3.
-|66: 51
+|16: /tmp/pardes-snap/builtins/cwd/+Tutor Save Term Collapse Del
+|17: 1
+|18: 2 PARDES TUTOR
+|19: 3
+|20: 4 This pane is +Tutor, a copy: edit it freely; there is no need to
+|21: 5 Save it (a bare Save asks for a path to write a copy to).
+|22: 6 `Del` in its tag closes it; once you have edited it, `Del` refuses
+|23: 7 once and the second `Del` discards. `Tutor` or SPC h t opens a
+|24: 8 fresh copy.
+|25: 9
+|26: 10 The guide (docs/typ/guide.typ) explains; this is the hands-on part.
+|27: 11 Each lesson is a few things to do, then names its guide section.
+|28: 12 Words in backticks, like `Save`, are builtins.
+|29: 13 `Exec` (B2) runs the builtin a word names, or else runs it as a
+|30: 14 shell line; `Look` (B3) opens what the text names, or else finds
+|31: 15 it. Type a builtin in any tag and `Exec` it. Lines starting with
+|32: 16 "| " are tags.
+|33: 17
+|34: 18 Press j until you reach part 1.
+|35: 19
+|36: 20
+|37: 21 =================================================================
+|38: 22 = PART 1 — MODES =
+|39: 23 =================================================================
+|40: 24
+|41: 25 1. The box left of this pane's tag is blank, so you are in
+|42: 26 NORMAL mode. Press i: it shows ^ (INSERT). Type a word, then
+|43: 27 Esc: blank again.
+|44: 28 2. Press Esc once more, in NORMAL: the keyboard goes back to the
+|45: 29 pane you were in before (not what helix does). Come back with
+|46: 30 Esc again.
+|47: 31 3. Press Alt-n: a terminal opens, in NORMAL mode, and pardes types
+|48: 32 ls at its first prompt. Press Ctrl-b: its box shows $ (RAW), and
+|49: 33 keys go to the shell. Esc brings you back here; the terminal stays
+|50: 34 $. Shift-Esc sends the shell an Esc.
+|51: 35
+|52: 36 -> Guide: Modes
+|53: 37
+|54: 38
+|55: 39 =================================================================
+|56: 40 = PART 2 — THE MOUSE =
+|57: 41 =================================================================
+|58: 42
+|59: 43 1. `Look` (B3) the word mouse in this sentence: the next mouse is
+|60: 44 selected.
+|61: 45 2. `Exec` (B2) the word `Help` here: the list of keys opens.
+|62: 46 Close it with `Del` in its tag.
+|63: 47 3. Select a word with B1, keep B1 down, click B2: it is cut. Still
+|64: 48 holding B1, click B3: it comes back. That pair is a copy.
+|65: 49 4. Put the cursor on `Help` and press Tab: `Exec`, as B2. Enter
+|66: 50 is `Look`, as B3.
diff --git a/test/snapshots/builtins.snap b/test/snapshots/builtins.snap
index 320d4360..14dd2bcf 100644
--- a/test/snapshots/builtins.snap
+++ b/test/snapshots/builtins.snap
@@ -80,8 +80,8 @@ key space h ?
wait 10000 Tutor
stable 700 15000
snap docs-group
-press middle @Tutor 15
-release middle @Tutor 15
+press middle @Tutor 16
+release middle @Tutor 16
wait 10000 PARDES TUTOR
stable 700 15000
snap tutor-from-index
diff --git a/test/snapshots/leader.golden b/test/snapshots/leader.golden
index 884a28b1..932e8a95 100644
--- a/test/snapshots/leader.golden
+++ b/test/snapshots/leader.golden
@@ -12,42 +12,42 @@
|5: /tmp/pardes-snap/leader/cwd/+Help Save Term Collapse Del
|6: 1 pardes builtins under SPC h
|7: 2
-|8: 3 SPC h c Changelog topbar
-|9: 4 SPC h m Messages
-|10: 5 SPC h t Tutor topbar
-|11: 6
-== snap tutor grid=100x41 cursor=7,12
+|8: 3 SPC h b Build
+|9: 4 SPC h c Changelog topbar
+|10: 5 SPC h m Messages
+|11: 6 SPC h t Tutor topbar
+|12: 7
+== snap tutor grid=100x41 cursor=7,13
|6: 1 pardes builtins under SPC h Tutor
-|11: /tmp/pardes-snap/leader/cwd/+Tutor Save Term Collapse Del
-|12: 1
-|13: 2 PARDES TUTOR
-|14: 3
-|15: 4 This pane is +Tutor, a copy: edit it freely; there is no need to
-|16: 5 Save it (a bare Save asks for a path to write a copy to).
-|17: 6 `Del` in its tag closes it; once you have edited it, `Del` refuses
-|18: 7 once and the second `Del` discards. `Tutor` or SPC h t opens a
-|19: 8 fresh copy.
-|20: 9
-|21: 10 The guide (docs/typ/guide.typ) explains; this is the hands-on part.
-|22: 11 Each lesson is a few things to do, then names its guide section.
-|23: 12 Words in backticks, like `Save`, are builtins.
-|24: 13 `Exec` (B2) runs the builtin a word names, or else runs it as a
-|25: 14 shell line; `Look` (B3) opens what the text names, or else finds
-|26: 15 it. Type a builtin in any tag and `Exec` it. Lines starting with
-|27: 16 "| " are tags.
-|28: 17
-|29: 18 Press j until you reach part 1.
-|30: 19
-|31: 20
-|32: 21 =================================================================
-|33: 22 = PART 1 — MODES =
-|34: 23 =================================================================
-|35: 24
-|36: 25 1. The box left of this pane's tag is blank, so you are in
-|37: 26 NORMAL mode. Press i: it shows ^ (INSERT). Type a word, then
-|38: 27 Esc: blank again.
-|39: 28 2. Press Esc once more, in NORMAL: the keyboard goes back to the
-|40: 29 pane you were in before (not what helix does). Come back with
+|12: /tmp/pardes-snap/leader/cwd/+Tutor Save Term Collapse Del
+|13: 1
+|14: 2 PARDES TUTOR
+|15: 3
+|16: 4 This pane is +Tutor, a copy: edit it freely; there is no need to
+|17: 5 Save it (a bare Save asks for a path to write a copy to).
+|18: 6 `Del` in its tag closes it; once you have edited it, `Del` refuses
+|19: 7 once and the second `Del` discards. `Tutor` or SPC h t opens a
+|20: 8 fresh copy.
+|21: 9
+|22: 10 The guide (docs/typ/guide.typ) explains; this is the hands-on part.
+|23: 11 Each lesson is a few things to do, then names its guide section.
+|24: 12 Words in backticks, like `Save`, are builtins.
+|25: 13 `Exec` (B2) runs the builtin a word names, or else runs it as a
+|26: 14 shell line; `Look` (B3) opens what the text names, or else finds
+|27: 15 it. Type a builtin in any tag and `Exec` it. Lines starting with
+|28: 16 "| " are tags.
+|29: 17
+|30: 18 Press j until you reach part 1.
+|31: 19
+|32: 20
+|33: 21 =================================================================
+|34: 22 = PART 1 — MODES =
+|35: 23 =================================================================
+|36: 24
+|37: 25 1. The box left of this pane's tag is blank, so you are in
+|38: 26 NORMAL mode. Press i: it shows ^ (INSERT). Type a word, then
+|39: 27 Esc: blank again.
+|40: 28 2. Press Esc once more, in NORMAL: the keyboard goes back to the
== snap deleted grid=100x41 cursor=7,3
|5:
|6:
@@ -78,13 +78,13 @@
|31:
|32:
|33:
-|34:
-|35: /tmp/pardes-snap/leader/cwd/+Help Save Term Collapse Del
-|36: 1 pardes builtins under SPC h
-|37: 2
-|38: 3 SPC h c Changelog topbar
-|39: 4 SPC h m Messages
-|40: 5 SPC h t Tutor topbar
+|34: /tmp/pardes-snap/leader/cwd/+Help Save Term Collapse Del
+|35: 1 pardes builtins under SPC h
+|36: 2
+|37: 3 SPC h b Build
+|38: 4 SPC h c Changelog topbar
+|39: 5 SPC h m Messages
+|40: 6 SPC h t Tutor topbar
== snap help-column grid=100x41 cursor=7,6
|5: /tmp/pardes-snap/leader/cwd/+Help Save Term Collapse Del
|6: 1 pardes builtins under SPC c
@@ -93,6 +93,7 @@
|9: 4 SPC c j Joincol topbar
|10: 5 SPC c n Newcol topbar
|11: 6
+|34:
|35:
|36:
|37: