1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
| | %prep
if ( zmodload -i zsh/zpty ) >/dev/null 2>&1; then
. $ZTST_srcdir/comptest
mkdir zle.tmp
cd zle.tmp
print -lr date 'echo xyz three' 'echo xyz two' 'echo 123 abc' \
'echo abc abcdef' 'echo abc' 'echo xyz' 'echo date' "echo '*OH NO*'" \
"echo '\n'" 'echo "*WHAT?*"' > historyX01
comptestinit -z $ZTST_testdir/../Src/zsh
else
ZTST_unimplemented="the zsh/zpty module is not available"
fi
%test
# Tests to add:
# case-insesitivity
# ignoring duplicate lines
# special keys
comptesteval 'fc -R historyX01'
termtest $'\C-Rabc'
0q:Verify incremental search first match
>echo <FG 2><BG 1>abc<FG 9><BG 9>
>bck-i-search: abc_
comptesteval 'fc -R historyX01'
termtest $'\C-Rabcd\C-H'
0q:Verify incremental search first match via backspace
>echo <FG 2><BG 1>abc<FG 9><BG 9>
>bck-i-search: abc_
comptesteval 'fc -R historyX01'
termtest $'\n\C-Rabc\C-R'
0q:Verify incremental search second match
>echo abc <FG 2><BG 1>abc<FG 9><BG 9>def
>bck-i-search: abc_
comptesteval 'fc -R historyX01'
termtest $'\C-Rabc\C-R\C-R'
0q:Verify incremental search third match
>echo <FG 2><BG 1>abc<FG 9><BG 9> abcdef
>bck-i-search: abc_
comptesteval 'fc -R historyX01'
termtest $'\C-Rabc\C-R\C-R\C-R'
0q:Verify incremental search fourth match
>echo 123 <FG 2><BG 1>abc<FG 9><BG 9>
>bck-i-search: abc_
comptesteval 'fc -R historyX01'
termtest $'\C-Rabc\C-R\C-R\C-R\C-R'
0q:Verify incremental search failed fifth match
>echo 123 abc
>failing bck-i-search: abc_
comptesteval 'fc -R historyX01'
termtest $'\C-Rabc\C-R\C-R\C-Rd'
0q:Verify incremental search pass something
>echo 123 abc
>failing bck-i-search: abcd_
comptesteval 'fc -R historyX01'
termtest $'\C-Rabc\C-R\C-R\C-Rd\C-H\C-H\C-Hd'
0q:Verify incremental search pass, backup, and find again.
>echo abc <FG 2><BG 1>abcd<FG 9><BG 9>ef
>bck-i-search: abcd_
comptesteval 'fc -R historyX01'
termtest $'\C-Rabcd\C-T'
0q:Verify incremental search pass, then use search forward to find.
>echo abc <FG 2><BG 1>abcd<FG 9><BG 9>ef
>fwd-i-search: abcd_
comptesteval 'fc -R historyX01'
termtest $'\C-R^date'
0q:Verify incremental search bol pattern
><FG 2><BG 1>date<FG 9><BG 9>
>bck-i-search: ^date_
comptesteval 'fc -R historyX01'
termtest $'\C-R\\'
0q:Verify incremental search backslash
>echo '<FG 2><BG 1>\<FG 9><BG 9>n'
>bck-i-search: \_
comptesteval 'fc -R historyX01'
termtest $'\C-XR\\*'
0q:Verify incremental search backslash star
>echo "*WHAT?<FG 2><BG 1>*<FG 9><BG 9>"
>bck-i-search: \*_
############# incremental pattern search
comptesteval 'fc -R historyX01'
termtest $'\C-XRabc'
0q:Verify incremental pattern search first match
>echo <FG 2><BG 1>abc<FG 9><BG 9>
>bck-i-search: abc_
comptesteval 'fc -R historyX01'
termtest $'\C-XRabcd\C-H'
0q:Verify incremental pattern search first match via backspace
>echo <FG 2><BG 1>abc<FG 9><BG 9>
>bck-i-search: abc_
comptesteval 'fc -R historyX01'
termtest $'\n\C-XRabc\C-XR'
0q:Verify incremental pattern search second match
>echo abc <FG 2><BG 1>abc<FG 9><BG 9>def
>bck-i-search: abc_
comptesteval 'fc -R historyX01'
termtest $'\C-XRabc\C-XR\C-XR'
0q:Verify incremental pattern search third match
>echo <FG 2><BG 1>abc<FG 9><BG 9> abcdef
>bck-i-search: abc_
comptesteval 'fc -R historyX01'
termtest $'\C-XRabc\C-XR\C-XR\C-XR'
0q:Verify incremental pattern search fourth match
>echo 123 <FG 2><BG 1>abc<FG 9><BG 9>
>bck-i-search: abc_
comptesteval 'fc -R historyX01'
termtest $'\C-XRabc\C-XR\C-XR\C-XR\C-XR'
0q:Verify incremental pattern search failed fifth match
>echo 123 abc
>failing bck-i-search: abc_
comptesteval 'fc -R historyX01'
termtest $'\C-XRabc\C-XR\C-XR\C-XRd'
0q:Verify incremental pattern search pass something
>echo 123 abc
>failing bck-i-search: abcd_
comptesteval 'fc -R historyX01'
termtest $'\C-XRabc\C-XR\C-XR\C-XRd\C-H\C-H\C-Hd'
0q:Verify incremental pattern search pass, backup, and find again.
>echo abc <FG 2><BG 1>abcd<FG 9><BG 9>ef
>bck-i-search: abcd_
comptesteval 'fc -R historyX01'
termtest $'\C-XRabcd\C-XT'
0q:Verify incremental pattern search pass, then use search forward to find.
>echo abc <FG 2><BG 1>abcd<FG 9><BG 9>ef
>fwd-i-search: abcd_
comptesteval 'fc -R historyX01'
termtest $'\C-XR^date'
0q:Verify incremental pattern search bol pattern
><FG 2><BG 1>date<FG 9><BG 9>
>bck-i-search: ^date_
comptesteval 'fc -R historyX01'
termtest $'\C-XR\\'
0q:Verify incremental pattern search backslash
>echo '<FG 2><BG 1>\<FG 9><BG 9>n'
>bck-i-search: \_
comptesteval 'fc -R historyX01'
termtest $'\C-XR\\*'
0q:Verify incremental pattern search backslash star
>echo "*WHAT?<FG 2><BG 1>*<FG 9><BG 9>"
>bck-i-search: \*_
%clean
zmodload -ui zsh/zpty
|