diff options
Diffstat (limited to 'test/behaviour/look_and_exec.zig')
| -rw-r--r-- | test/behaviour/look_and_exec.zig | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/test/behaviour/look_and_exec.zig b/test/behaviour/look_and_exec.zig index f9b49ae0..f3b94a3f 100644 --- a/test/behaviour/look_and_exec.zig +++ b/test/behaviour/look_and_exec.zig @@ -125,3 +125,39 @@ test "look-and-exec: exec runs a builtin at the pane, and look and exec read bac try std.testing.expect(try listed(&s, n) and !try listed(&s, made)); try s.expect("/exec", s.at("{d}\n", .{made})); } + +test "look-and-exec: look and exec read back what the last command touched, a ctl write's too" { + var s = try Session.initFile(std.testing.allocator, "x\n"); + defer s.deinit(); + const n = try s.focused(); + try s.write("/exec", "Msg first\n"); + try s.expect("/exec", s.at("{d}\n", .{n})); + // A pane made through ctl is what both read next, not the Msg's pane. + try s.write(s.at("/pane/{d}/ctl", .{n}), "Tty\n"); + const made = try s.focused(); + try std.testing.expect(made != n); + try s.expect("/exec", s.at("{d}\n", .{made})); + try s.expect("/look", s.at("{d}\n", .{made})); + // A ctl write that makes nothing names the pane it ran at. + try s.write("/ctl", "Verbose off\n"); + try s.expect("/exec", s.at("{d}\n", .{made})); + // Closed, it is no pane to go to: a fresh read of look is empty. + try s.write(s.at("/pane/{d}/ctl", .{made}), "Del\n"); + try std.testing.expect(!try listed(&s, made)); + try s.expect("/look", ""); +} + +test "look-and-exec: a line starting with # runs as nothing at an exec or a ctl, silently" { + var s = try Session.initFile(std.testing.allocator, "x\n"); + defer s.deinit(); + const n = try s.focused(); + // The setup's own announcements are made by the first write. + try s.write("/ctl", "# settle\n"); + const index = try s.read("/index"); + const log = try s.read("/log"); + const col = std.mem.sliceTo(try s.read("/layout"), ' '); + for ([_][]const u8{ "/exec", s.at("/pane/{d}/exec", .{n}), "/ctl", s.at("/pane/{d}/ctl", .{n}), s.at("/col/{s}/ctl", .{col}) }) |path| + try s.write(path, "# Platform: tty\n # indented too\n"); + try s.expect("/index", index); + try s.expect("/log", log); +} |
