1 | ## oils_failures_allowed: 0
|
2 | ## oils_cpp_failures_allowed: 7
|
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 | # 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
|
15 | bind -l | grep accept-line
|
16 |
|
17 | ## status: 0
|
18 | ## STDOUT:
|
19 | accept-line
|
20 | ## END
|
21 |
|
22 |
|
23 | #### bind -p -P to print function names and key bindings
|
24 |
|
25 | # silly workaround for spec test format - change # comment to %
|
26 | bind -p | grep vi-subst | sed 's/^#/%/'
|
27 | echo
|
28 |
|
29 | bind -P | grep vi-subst
|
30 |
|
31 | ## STDOUT:
|
32 | % vi-subst (not bound)
|
33 |
|
34 | vi-subst is not bound to any keys
|
35 | ## END
|
36 |
|
37 | #### bind -s -S accepted
|
38 |
|
39 | # TODO: add non-trivial tests here
|
40 |
|
41 | bind -s
|
42 | bind -S
|
43 |
|
44 | ## STDOUT:
|
45 | ## END
|
46 |
|
47 | #### bind -v -V accepted
|
48 |
|
49 | bind -v | grep blink-matching-paren
|
50 | echo
|
51 |
|
52 | # transform silly quote so we don't mess up syntax highlighting
|
53 | bind -V | grep blink-matching-paren | sed "s/\`/'/g"
|
54 |
|
55 | ## STDOUT:
|
56 | set blink-matching-paren off
|
57 |
|
58 | blink-matching-paren is set to 'off'
|
59 | ## END
|
60 |
|
61 | #### bind -q
|
62 |
|
63 | bind -q zz-bad
|
64 | echo status=$?
|
65 |
|
66 | # bash prints message to stdout
|
67 |
|
68 | bind -q vi-subst
|
69 | echo status=$?
|
70 |
|
71 | bind -q yank
|
72 | echo status=$?
|
73 |
|
74 | ## STDOUT:
|
75 | status=1
|
76 | vi-subst is not bound to any keys.
|
77 | status=1
|
78 | yank can be invoked via "\C-y".
|
79 | status=0
|
80 | ## END
|
81 |
|
82 |
|
83 | #### bind -X
|
84 | bind -X | grep -oF '\C-o\C-s\C-h'
|
85 | echo status=$?
|
86 |
|
87 | bind -x '"\C-o\C-s\C-h": echo foo'
|
88 | bind -X | grep -oF '\C-o\C-s\C-h'
|
89 | bind -X | grep -oF 'echo foo'
|
90 | echo status=$?
|
91 |
|
92 | ## STDOUT:
|
93 | status=1
|
94 | \C-o\C-s\C-h
|
95 | echo foo
|
96 | status=0
|
97 | ## END
|
98 |
|
99 |
|
100 | #### bind -m with bind -x/-X
|
101 | bind -X | grep -oF 'emacs|vi'
|
102 | echo status=$?
|
103 |
|
104 | bind -m emacs -x '"\C-o\C-s\C-h": echo emacs'
|
105 | bind -m emacs -X | grep -oF 'emacs'
|
106 | echo status=$?
|
107 |
|
108 | bind -m vi -x '"\C-o\C-s\C-h": echo vi'
|
109 | bind -m vi -X | grep -oF 'vi'
|
110 | echo status=$?
|
111 |
|
112 | ## STDOUT:
|
113 | status=1
|
114 | emacs
|
115 | status=0
|
116 | vi
|
117 | status=0
|
118 | ## END
|
119 |
|
120 |
|
121 | #### bind -r
|
122 | bind -q yank | grep -oF '\C-o\C-s\C-h'
|
123 | echo status=$?
|
124 |
|
125 | bind '"\C-o\C-s\C-h": yank'
|
126 | bind -q yank | grep -oF '\C-o\C-s\C-h'
|
127 | echo status=$?
|
128 |
|
129 | bind -r "\C-o\C-s\C-h"
|
130 | bind -q yank | grep -oF '\C-o\C-s\C-h'
|
131 | echo status=$?
|
132 |
|
133 | ## STDOUT:
|
134 | status=1
|
135 | \C-o\C-s\C-h
|
136 | status=0
|
137 | status=1
|
138 | ## END
|
139 |
|
140 |
|
141 | #### bind -r of bind -x commands
|
142 | bind -X | grep -oF '\C-o\C-s\C-h'
|
143 | echo status=$?
|
144 |
|
145 | bind -x '"\C-o\C-s\C-h": echo foo'
|
146 | bind -X | grep -oF '\C-o\C-s\C-h'
|
147 | echo status=$?
|
148 |
|
149 | bind -r "\C-o\C-s\C-h"
|
150 | bind -X | grep -oF '\C-o\C-s\C-h'
|
151 | echo status=$?
|
152 |
|
153 | ## STDOUT:
|
154 | status=1
|
155 | \C-o\C-s\C-h
|
156 | status=0
|
157 | status=1
|
158 | ## END
|