OILS / spec / builtin-bind.test.sh View on Github | oilshell.org

79 lines, 25 significant
1## oils_failures_allowed: 1
2## compare_shells: bash
3
4# NB: This is only for NON-interactive tests of bind.
5# See spec/stateful/bind.py for the remaining tests.
6
7#### bind -l should report readline functions
8
9# This test depends on the exact version
10
11# bind -l | sort > _tmp/this-shell-bind-l.txt
12# comm -23 $REPO_ROOT/spec/testdata/bind/bind_l_function_list.txt _tmp/this-shell-bind-l.txt
13
14# More relaxed test
15bind -l | grep accept-line
16
17## status: 0
18## STDOUT:
19accept-line
20## END
21
22
23#### bind -p -P to print function names and key bindings
24
25bind -p | grep menu-complete-backward
26echo
27
28bind -P | grep menu-complete-backward
29
30## STDOUT:
31"\C-p": menu-complete-backward
32
33menu-complete-backward can be found on "\C-p".
34## END
35
36#### bind -s -S accepted
37
38# TODO: add non-trivial tests here
39
40bind -s
41bind -S
42
43## STDOUT:
44## END
45
46#### bind -v -V accepted
47
48bind -v | grep blink-matching-paren
49echo
50
51# transform silly quote so we don't mess up syntax highlighting
52bind -V | grep blink-matching-paren | sed "s/\`/'/g"
53
54## STDOUT:
55set blink-matching-paren off
56
57blink-matching-paren is set to 'off'
58## END
59
60#### bind -q
61
62bind -q zz-bad
63echo status=$?
64
65# bash prints message to stdout
66
67bind -q vi-subst
68echo status=$?
69
70bind -q menu-complete
71echo status=$?
72
73## STDOUT:
74status=1
75vi-subst is not bound to any keys.
76status=1
77menu-complete can be invoked via "\C-n".
78status=0
79## END