fork/fish-shell

git clone https://git.julia.blue/fork/fish-shell

Johannes Altmanningertests/checks/tmux-abbr.fish: fix on BusyBox less (alpine CI)ff284d642

master
1.7 KiB58 linesraw
1#RUN: %fish %s
2#REQUIRES: command -v tmux
3
4isolated-tmux-start -C '
5    set -g fish_autosuggestion_enabled 0
6    function abbr-test
7    end
8    abbr -g abbr-test "abbr-test [expanded]"
9'
10
11if { command -v less && ! less --version 2>&1 | grep BusyBox } >/dev/null
12    isolated-tmux send-keys "abbr --help | sed 1q | less" Enter
13    tmux-sleep
14    isolated-tmux capture-pane -p
15    isolated-tmux send-keys q
16else
17    echo '(END)'
18    echo 'prompt 0> abbr --help | sed 1q | less'
19    echo 'Documentation for abbr'
20end
21# CHECK: (END)
22# CHECK: prompt 0> abbr --help | sed 1q | less
23# CHECK: Documentation for abbr
24
25# Expand abbreviations on space.
26isolated-tmux send-keys abbr-test Space arg1 Enter
27tmux-sleep
28# CHECK: prompt {{\d+}}> abbr-test [expanded] arg1
29
30# Expand abbreviations at the cursor when executing.
31isolated-tmux send-keys abbr-test Enter
32tmux-sleep
33# CHECK: prompt {{\d+}}> abbr-test [expanded]
34
35# Use Control+Z right after abbreviation expansion, to keep going without expanding.
36isolated-tmux send-keys abbr-test Space C-z arg2 Enter
37tmux-sleep
38# CHECK: prompt {{\d+}}> abbr-test arg2
39
40# Same with a redundant space; it does not expand abbreviations.
41isolated-tmux send-keys C-u abbr-test Space C-z Space arg2 Enter
42tmux-sleep
43# CHECK: prompt {{\d+}}> abbr-test  arg2
44
45# Or use Control+Space to the same effect.
46isolated-tmux send-keys abbr-test C-Space arg3 Enter
47tmux-sleep
48# CHECK: prompt {{\d+}}> abbr-test arg3
49
50# Do not expand abbreviation if the cursor is not at the command, even if it's just white space.
51# This makes the behavior more consistent with the above two scenarios.
52isolated-tmux send-keys abbr-test C-Space Enter
53tmux-sleep
54# CHECK: prompt {{\d+}}> abbr-test
55
56# CHECK: prompt {{\d+}}>
57
58isolated-tmux capture-pane -p