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

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