Skip to content

Commit 4f36d53

Browse files
committed
chore: add tests for bash
1 parent 81f7e01 commit 4f36d53

File tree

3 files changed

+69
-2
lines changed

3 files changed

+69
-2
lines changed

tests/kitty-scrollback/helpers.lua

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,24 @@ M.open_tmux_kitty_scrollback_nvim = function()
311311
}
312312
end
313313

314+
M.ctrl_x = function()
315+
return {
316+
[[\x18]],
317+
opts = {
318+
send_by = 'string',
319+
},
320+
}
321+
end
322+
323+
M.ctrl_e = function()
324+
return {
325+
[[\x05]],
326+
opts = {
327+
send_by = 'string',
328+
},
329+
}
330+
end
331+
314332
M.alt_e = function()
315333
return {
316334
[[\x1be]],

tests/kitty-scrollback/kitty_scrollback_fish_spec.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ Press ENTER or type command to continue.*]],
117117
)
118118
end)
119119

120-
it('should open command in command-line editing mode', function()
120+
it('should open command in command-line editing mode for fish', function()
121121
h.assert_screen_equals(
122122
h.feed_kitty({
123123
h.with_pause_seconds_before(h.send_without_newline([[nacho cheese]])),
@@ -137,7 +137,7 @@ fish $
137137
)
138138
end)
139139

140-
it('should clear command if no-op in command-line editing mode', function()
140+
it('should clear command if no-op in command-line editing mode for fish', function()
141141
h.assert_screen_equals(
142142
h.feed_kitty({
143143
h.with_pause_seconds_before(h.send_without_newline([[nacho cheese]])),

tests/kitty-scrollback/kitty_scrollback_spec.lua

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -501,4 +501,53 @@ $
501501
}
502502
)
503503
end)
504+
505+
it('should open command in command-line editing mode for bash', function()
506+
h.assert_screen_equals(
507+
h.feed_kitty({
508+
h.with_pause_seconds_before(
509+
h.send_as_string([[export VISUAL=']] .. ksb_dir .. [[scripts/edit_command_line.bash']])
510+
),
511+
h.send_without_newline(h.clear()),
512+
h.with_pause_seconds_before(h.send_without_newline([[pepperjack cheese]])),
513+
h.send_without_newline(h.ctrl_x()),
514+
h.ctrl_e(),
515+
h.with_pause_seconds_before(h.send_without_newline([[ciwecho]]), 2),
516+
h.send_without_newline(h.control_enter()),
517+
}),
518+
{
519+
stdout = [[
520+
$ pepperjack cheese
521+
$ echo cheese
522+
cheese
523+
$
524+
]],
525+
cursor_y = 4,
526+
cursor_x = 3,
527+
}
528+
)
529+
end)
530+
531+
it('should clear command if no-op in command-line editing mode for bash', function()
532+
h.assert_screen_equals(
533+
h.feed_kitty({
534+
h.with_pause_seconds_before(
535+
h.send_as_string([[export VISUAL=']] .. ksb_dir .. [[scripts/edit_command_line.bash']])
536+
),
537+
h.send_without_newline(h.clear()),
538+
h.with_pause_seconds_before(h.send_without_newline([[pepperjack cheese]])),
539+
h.send_without_newline(h.ctrl_x()),
540+
h.ctrl_e(),
541+
h.with_pause_seconds_before([[:qa!]]),
542+
}),
543+
{
544+
stdout = [[
545+
$ pepperjack cheese
546+
$
547+
]],
548+
cursor_y = 2,
549+
cursor_x = 3,
550+
}
551+
)
552+
end)
504553
end)

0 commit comments

Comments
 (0)