blob: f9995a4bc89a0569c4495562c27ec075c7d4c7b9 [file] [log] [blame]
Bram Moolenaar72defda2016-01-17 18:04:33 +01001" Test argument list commands
2
Bram Moolenaar494e9062020-05-31 21:28:02 +02003source check.vim
Bram Moolenaar9f6277b2020-02-11 22:04:02 +01004source shared.vim
5source term_util.vim
6
Bram Moolenaar72defda2016-01-17 18:04:33 +01007func Test_argidx()
8 args a b c
9 last
10 call assert_equal(2, argidx())
11 %argdelete
12 call assert_equal(0, argidx())
Bram Moolenaar69a92fb2017-03-09 15:58:30 +010013 " doing it again doesn't result in an error
14 %argdelete
15 call assert_equal(0, argidx())
16 call assert_fails('2argdelete', 'E16:')
Bram Moolenaar72defda2016-01-17 18:04:33 +010017
18 args a b c
19 call assert_equal(0, argidx())
20 next
21 call assert_equal(1, argidx())
22 next
23 call assert_equal(2, argidx())
24 1argdelete
25 call assert_equal(1, argidx())
26 1argdelete
27 call assert_equal(0, argidx())
28 1argdelete
29 call assert_equal(0, argidx())
30endfunc
Bram Moolenaara24f0a52016-01-17 19:39:00 +010031
32func Test_argadd()
33 %argdelete
34 argadd a b c
35 call assert_equal(0, argidx())
36
37 %argdelete
38 argadd a
39 call assert_equal(0, argidx())
40 argadd b c d
41 call assert_equal(0, argidx())
42
43 call Init_abc()
44 argadd x
45 call Assert_argc(['a', 'b', 'x', 'c'])
46 call assert_equal(1, argidx())
47
48 call Init_abc()
49 0argadd x
50 call Assert_argc(['x', 'a', 'b', 'c'])
51 call assert_equal(2, argidx())
52
53 call Init_abc()
54 1argadd x
55 call Assert_argc(['a', 'x', 'b', 'c'])
56 call assert_equal(2, argidx())
57
58 call Init_abc()
59 $argadd x
60 call Assert_argc(['a', 'b', 'c', 'x'])
61 call assert_equal(1, argidx())
62
63 call Init_abc()
64 $argadd x
65 +2argadd y
66 call Assert_argc(['a', 'b', 'c', 'x', 'y'])
67 call assert_equal(1, argidx())
Bram Moolenaar2faa29f2016-01-23 23:02:34 +010068
69 %argd
70 edit d
71 arga
Bram Moolenaar398ee732017-08-03 14:29:14 +020072 call assert_equal(1, len(argv()))
73 call assert_equal('d', get(argv(), 0, ''))
74
75 %argd
76 edit some\ file
77 arga
78 call assert_equal(1, len(argv()))
79 call assert_equal('some file', get(argv(), 0, ''))
Bram Moolenaar2faa29f2016-01-23 23:02:34 +010080
81 %argd
82 new
83 arga
Bram Moolenaar398ee732017-08-03 14:29:14 +020084 call assert_equal(0, len(argv()))
Bram Moolenaara24f0a52016-01-17 19:39:00 +010085endfunc
86
Bram Moolenaar32bbd002018-08-31 23:06:22 +020087func Test_argadd_empty_curbuf()
88 new
89 let curbuf = bufnr('%')
90 call writefile(['test', 'Xargadd'], 'Xargadd')
91 " must not re-use the current buffer.
92 argadd Xargadd
93 call assert_equal(curbuf, bufnr('%'))
94 call assert_equal('', bufname('%'))
Bram Moolenaar02b31112019-08-31 22:16:38 +020095 call assert_equal(1, '$'->line())
Bram Moolenaar32bbd002018-08-31 23:06:22 +020096 rew
Bram Moolenaar073e4b92019-08-18 23:01:56 +020097 call assert_notequal(curbuf, '%'->bufnr())
98 call assert_equal('Xargadd', '%'->bufname())
Bram Moolenaar32bbd002018-08-31 23:06:22 +020099 call assert_equal(2, line('$'))
100
Bram Moolenaard3398282018-09-24 21:32:11 +0200101 call delete('Xargadd')
Bram Moolenaar32bbd002018-08-31 23:06:22 +0200102 %argd
103 bwipe!
104endfunc
105
Bram Moolenaara24f0a52016-01-17 19:39:00 +0100106func Init_abc()
107 args a b c
108 next
109endfunc
110
111func Assert_argc(l)
112 call assert_equal(len(a:l), argc())
113 let i = 0
114 while i < len(a:l) && i < argc()
115 call assert_equal(a:l[i], argv(i))
116 let i += 1
117 endwhile
118endfunc
Bram Moolenaar99dbe292016-01-19 13:07:23 +0100119
120" Test for [count]argument and [count]argdelete commands
121" Ported from the test_argument_count.in test script
Bram Moolenaar8c34aa02017-03-16 22:52:32 +0100122func Test_argument()
Bram Moolenaar99dbe292016-01-19 13:07:23 +0100123 " Clean the argument list
124 arga a | %argd
125
126 let save_hidden = &hidden
127 set hidden
128
129 let g:buffers = []
130 augroup TEST
131 au BufEnter * call add(buffers, expand('%:t'))
132 augroup END
133
134 argadd a b c d
135 $argu
136 $-argu
137 -argu
138 1argu
139 +2argu
140
141 augroup TEST
142 au!
143 augroup END
144
145 call assert_equal(['d', 'c', 'b', 'a', 'c'], g:buffers)
146
Bram Moolenaar949f1982019-07-23 23:00:08 +0200147 call assert_equal("\na b [c] d ", execute(':args'))
Bram Moolenaar99dbe292016-01-19 13:07:23 +0100148
149 .argd
150 call assert_equal(['a', 'b', 'd'], argv())
151
152 -argd
153 call assert_equal(['a', 'd'], argv())
154
155 $argd
156 call assert_equal(['a'], argv())
157
158 1arga c
159 1arga b
160 $argu
161 $arga x
162 call assert_equal(['a', 'b', 'c', 'x'], argv())
163
Bram Moolenaar30141702016-01-19 14:14:08 +0100164 0arga y
165 call assert_equal(['y', 'a', 'b', 'c', 'x'], argv())
Bram Moolenaar99dbe292016-01-19 13:07:23 +0100166
167 %argd
168 call assert_equal([], argv())
169
170 arga a b c d e f
171 2,$-argd
172 call assert_equal(['a', 'f'], argv())
173
174 let &hidden = save_hidden
175
Bram Moolenaar9800bfe2019-07-27 21:23:45 +0200176 let save_columns = &columns
177 let &columns = 79
178 exe 'args ' .. join(range(1, 81))
179 call assert_equal(join([
180 \ '',
181 \ '[1] 6 11 16 21 26 31 36 41 46 51 56 61 66 71 76 81 ',
182 \ '2 7 12 17 22 27 32 37 42 47 52 57 62 67 72 77 ',
183 \ '3 8 13 18 23 28 33 38 43 48 53 58 63 68 73 78 ',
184 \ '4 9 14 19 24 29 34 39 44 49 54 59 64 69 74 79 ',
185 \ '5 10 15 20 25 30 35 40 45 50 55 60 65 70 75 80 ',
186 \ ], "\n"),
187 \ execute('args'))
188
189 " No trailing newline with one item per row.
190 let long_arg = repeat('X', 81)
191 exe 'args ' .. long_arg
192 call assert_equal("\n[".long_arg.']', execute('args'))
193 let &columns = save_columns
194
Bram Moolenaar99dbe292016-01-19 13:07:23 +0100195 " Setting argument list should fail when the current buffer has unsaved
196 " changes
197 %argd
198 enew!
199 set modified
200 call assert_fails('args x y z', 'E37:')
201 args! x y z
202 call assert_equal(['x', 'y', 'z'], argv())
203 call assert_equal('x', expand('%:t'))
204
205 last | enew | argu
206 call assert_equal('z', expand('%:t'))
207
208 %argdelete
209 call assert_fails('argument', 'E163:')
Bram Moolenaar8c34aa02017-03-16 22:52:32 +0100210endfunc
Bram Moolenaar99dbe292016-01-19 13:07:23 +0100211
Bram Moolenaar5d69da42018-04-20 22:01:41 +0200212func Test_list_arguments()
213 " Clean the argument list
214 arga a | %argd
215
216 " four args half the screen width makes two lines with two columns
217 let aarg = repeat('a', &columns / 2 - 4)
218 let barg = repeat('b', &columns / 2 - 4)
219 let carg = repeat('c', &columns / 2 - 4)
220 let darg = repeat('d', &columns / 2 - 4)
221 exe 'argadd ' aarg barg carg darg
222
223 redir => result
224 args
225 redir END
226 call assert_match('\[' . aarg . '] \+' . carg . '\n' . barg . ' \+' . darg, trim(result))
227
228 " if one arg is longer than half the screen make one column
229 exe 'argdel' aarg
230 let aarg = repeat('a', &columns / 2 + 2)
231 exe '0argadd' aarg
232 redir => result
233 args
234 redir END
235 call assert_match(aarg . '\n\[' . barg . ']\n' . carg . '\n' . darg, trim(result))
236
237 %argdelete
238endfunc
239
Bram Moolenaar2ac372c2018-12-28 19:06:47 +0100240func Test_args_with_quote()
Bram Moolenaar3de8c2d2018-12-28 19:29:35 +0100241 " Only on Unix can a file name include a double quote.
242 if has('unix')
243 args \"foobar
244 call assert_equal('"foobar', argv(0))
245 %argdelete
246 endif
Bram Moolenaar2ac372c2018-12-28 19:06:47 +0100247endfunc
248
Bram Moolenaar99dbe292016-01-19 13:07:23 +0100249" Test for 0argadd and 0argedit
250" Ported from the test_argument_0count.in test script
Bram Moolenaar8c34aa02017-03-16 22:52:32 +0100251func Test_zero_argadd()
Bram Moolenaar99dbe292016-01-19 13:07:23 +0100252 " Clean the argument list
253 arga a | %argd
254
255 arga a b c d
256 2argu
257 0arga added
258 call assert_equal(['added', 'a', 'b', 'c', 'd'], argv())
259
260 2argu
261 arga third
262 call assert_equal(['added', 'a', 'third', 'b', 'c', 'd'], argv())
263
264 %argd
265 arga a b c d
266 2argu
267 0arge edited
268 call assert_equal(['edited', 'a', 'b', 'c', 'd'], argv())
269
270 2argu
271 arga third
272 call assert_equal(['edited', 'a', 'third', 'b', 'c', 'd'], argv())
Bram Moolenaar90305c62017-07-16 15:31:17 +0200273
274 2argu
275 argedit file\ with\ spaces another file
276 call assert_equal(['edited', 'a', 'file with spaces', 'another', 'file', 'third', 'b', 'c', 'd'], argv())
277 call assert_equal('file with spaces', expand('%'))
Bram Moolenaar8c34aa02017-03-16 22:52:32 +0100278endfunc
Bram Moolenaar99dbe292016-01-19 13:07:23 +0100279
Bram Moolenaar8c34aa02017-03-16 22:52:32 +0100280func Reset_arglist()
Bram Moolenaar99dbe292016-01-19 13:07:23 +0100281 args a | %argd
Bram Moolenaar8c34aa02017-03-16 22:52:32 +0100282endfunc
Bram Moolenaar99dbe292016-01-19 13:07:23 +0100283
284" Test for argc()
Bram Moolenaar8c34aa02017-03-16 22:52:32 +0100285func Test_argc()
Bram Moolenaar99dbe292016-01-19 13:07:23 +0100286 call Reset_arglist()
287 call assert_equal(0, argc())
288 argadd a b
289 call assert_equal(2, argc())
Bram Moolenaar8c34aa02017-03-16 22:52:32 +0100290endfunc
Bram Moolenaar99dbe292016-01-19 13:07:23 +0100291
292" Test for arglistid()
Bram Moolenaar8c34aa02017-03-16 22:52:32 +0100293func Test_arglistid()
Bram Moolenaar99dbe292016-01-19 13:07:23 +0100294 call Reset_arglist()
295 arga a b
296 call assert_equal(0, arglistid())
297 split
298 arglocal
299 call assert_equal(1, arglistid())
300 tabnew | tabfirst
301 call assert_equal(0, arglistid(2))
302 call assert_equal(1, arglistid(1, 1))
303 call assert_equal(0, arglistid(2, 1))
304 call assert_equal(1, arglistid(1, 2))
305 tabonly | only | enew!
306 argglobal
307 call assert_equal(0, arglistid())
Bram Moolenaar8c34aa02017-03-16 22:52:32 +0100308endfunc
Bram Moolenaar99dbe292016-01-19 13:07:23 +0100309
Bram Moolenaare6e39892018-10-25 12:32:11 +0200310" Tests for argv() and argc()
Bram Moolenaar8c34aa02017-03-16 22:52:32 +0100311func Test_argv()
Bram Moolenaar99dbe292016-01-19 13:07:23 +0100312 call Reset_arglist()
313 call assert_equal([], argv())
314 call assert_equal("", argv(2))
Bram Moolenaare6e39892018-10-25 12:32:11 +0200315 call assert_equal(0, argc())
Bram Moolenaar99dbe292016-01-19 13:07:23 +0100316 argadd a b c d
Bram Moolenaare6e39892018-10-25 12:32:11 +0200317 call assert_equal(4, argc())
Bram Moolenaar99dbe292016-01-19 13:07:23 +0100318 call assert_equal('c', argv(2))
Bram Moolenaare6e39892018-10-25 12:32:11 +0200319
320 let w1_id = win_getid()
321 split
322 let w2_id = win_getid()
323 arglocal
324 args e f g
325 tabnew
326 let w3_id = win_getid()
327 split
328 let w4_id = win_getid()
329 argglobal
330 tabfirst
331 call assert_equal(4, argc(w1_id))
332 call assert_equal('b', argv(1, w1_id))
333 call assert_equal(['a', 'b', 'c', 'd'], argv(-1, w1_id))
334
335 call assert_equal(3, argc(w2_id))
336 call assert_equal('f', argv(1, w2_id))
337 call assert_equal(['e', 'f', 'g'], argv(-1, w2_id))
338
339 call assert_equal(3, argc(w3_id))
340 call assert_equal('e', argv(0, w3_id))
341 call assert_equal(['e', 'f', 'g'], argv(-1, w3_id))
342
343 call assert_equal(4, argc(w4_id))
344 call assert_equal('c', argv(2, w4_id))
345 call assert_equal(['a', 'b', 'c', 'd'], argv(-1, w4_id))
346
347 call assert_equal(4, argc(-1))
348 call assert_equal(3, argc())
349 call assert_equal('d', argv(3, -1))
350 call assert_equal(['a', 'b', 'c', 'd'], argv(-1, -1))
351 tabonly | only | enew!
352 " Negative test cases
353 call assert_equal(-1, argc(100))
354 call assert_equal('', argv(1, 100))
355 call assert_equal([], argv(-1, 100))
356 call assert_equal('', argv(10, -1))
Bram Moolenaar8c34aa02017-03-16 22:52:32 +0100357endfunc
Bram Moolenaar99dbe292016-01-19 13:07:23 +0100358
359" Test for the :argedit command
Bram Moolenaar8c34aa02017-03-16 22:52:32 +0100360func Test_argedit()
Bram Moolenaar99dbe292016-01-19 13:07:23 +0100361 call Reset_arglist()
362 argedit a
363 call assert_equal(['a'], argv())
364 call assert_equal('a', expand('%:t'))
365 argedit b
366 call assert_equal(['a', 'b'], argv())
367 call assert_equal('b', expand('%:t'))
368 argedit a
Bram Moolenaar90305c62017-07-16 15:31:17 +0200369 call assert_equal(['a', 'b', 'a'], argv())
Bram Moolenaar99dbe292016-01-19 13:07:23 +0100370 call assert_equal('a', expand('%:t'))
Bram Moolenaar9b50bba2017-07-16 16:42:13 +0200371 " When file name case is ignored, an existing buffer with only case
Bram Moolenaarcf1ba352017-10-27 00:55:04 +0200372 " difference is re-used.
Bram Moolenaar90305c62017-07-16 15:31:17 +0200373 argedit C D
374 call assert_equal('C', expand('%:t'))
375 call assert_equal(['a', 'b', 'a', 'C', 'D'], argv())
Bram Moolenaar99dbe292016-01-19 13:07:23 +0100376 argedit c
Bram Moolenaar9b50bba2017-07-16 16:42:13 +0200377 if has('fname_case')
378 call assert_equal(['a', 'b', 'a', 'C', 'c', 'D'], argv())
379 else
380 call assert_equal(['a', 'b', 'a', 'C', 'C', 'D'], argv())
381 endif
Bram Moolenaar99dbe292016-01-19 13:07:23 +0100382 0argedit x
Bram Moolenaar9b50bba2017-07-16 16:42:13 +0200383 if has('fname_case')
384 call assert_equal(['x', 'a', 'b', 'a', 'C', 'c', 'D'], argv())
385 else
386 call assert_equal(['x', 'a', 'b', 'a', 'C', 'C', 'D'], argv())
387 endif
Bram Moolenaar99dbe292016-01-19 13:07:23 +0100388 enew! | set modified
389 call assert_fails('argedit y', 'E37:')
390 argedit! y
Bram Moolenaar9b50bba2017-07-16 16:42:13 +0200391 if has('fname_case')
392 call assert_equal(['x', 'y', 'y', 'a', 'b', 'a', 'C', 'c', 'D'], argv())
393 else
394 call assert_equal(['x', 'y', 'y', 'a', 'b', 'a', 'C', 'C', 'D'], argv())
395 endif
Bram Moolenaar99dbe292016-01-19 13:07:23 +0100396 %argd
Bram Moolenaar9b50bba2017-07-16 16:42:13 +0200397 bwipe! C
398 bwipe! D
Bram Moolenaar46a53df2018-04-24 21:58:51 +0200399
400 " :argedit reuses the current buffer if it is empty
401 %argd
402 " make sure to use a new buffer number for x when it is loaded
403 bw! x
404 new
Bram Moolenaara8eee212019-08-24 22:14:58 +0200405 let a = bufnr()
Bram Moolenaar46a53df2018-04-24 21:58:51 +0200406 argedit x
Bram Moolenaara8eee212019-08-24 22:14:58 +0200407 call assert_equal(a, bufnr())
408 call assert_equal('x', bufname())
Bram Moolenaar46a53df2018-04-24 21:58:51 +0200409 %argd
410 bw! x
Bram Moolenaar8c34aa02017-03-16 22:52:32 +0100411endfunc
Bram Moolenaar99dbe292016-01-19 13:07:23 +0100412
413" Test for the :argdelete command
Bram Moolenaar8c34aa02017-03-16 22:52:32 +0100414func Test_argdelete()
Bram Moolenaar99dbe292016-01-19 13:07:23 +0100415 call Reset_arglist()
416 args aa a aaa b bb
417 argdelete a*
418 call assert_equal(['b', 'bb'], argv())
419 call assert_equal('aa', expand('%:t'))
420 last
421 argdelete %
422 call assert_equal(['b'], argv())
423 call assert_fails('argdelete', 'E471:')
424 call assert_fails('1,100argdelete', 'E16:')
425 %argd
Bram Moolenaar8c34aa02017-03-16 22:52:32 +0100426endfunc
Bram Moolenaar99dbe292016-01-19 13:07:23 +0100427
Bram Moolenaarb513d302018-12-02 14:55:08 +0100428func Test_argdelete_completion()
429 args foo bar
430
431 call feedkeys(":argdelete \<C-A>\<C-B>\"\<CR>", 'tx')
432 call assert_equal('"argdelete bar foo', @:)
433
434 call feedkeys(":argdelete x \<C-A>\<C-B>\"\<CR>", 'tx')
435 call assert_equal('"argdelete x bar foo', @:)
436
437 %argd
438endfunc
439
Bram Moolenaar99dbe292016-01-19 13:07:23 +0100440" Tests for the :next, :prev, :first, :last, :rewind commands
Bram Moolenaar8c34aa02017-03-16 22:52:32 +0100441func Test_argpos()
Bram Moolenaar99dbe292016-01-19 13:07:23 +0100442 call Reset_arglist()
443 args a b c d
444 last
445 call assert_equal(3, argidx())
446 call assert_fails('next', 'E165:')
447 prev
448 call assert_equal(2, argidx())
449 Next
450 call assert_equal(1, argidx())
451 first
452 call assert_equal(0, argidx())
453 call assert_fails('prev', 'E164:')
454 3next
455 call assert_equal(3, argidx())
456 rewind
457 call assert_equal(0, argidx())
458 %argd
Bram Moolenaar8c34aa02017-03-16 22:52:32 +0100459endfunc
Bram Moolenaar53f16732016-09-07 20:46:39 +0200460
461" Test for autocommand that redefines the argument list, when doing ":all".
Bram Moolenaar8c34aa02017-03-16 22:52:32 +0100462func Test_arglist_autocmd()
Bram Moolenaar53f16732016-09-07 20:46:39 +0200463 autocmd BufReadPost Xxx2 next Xxx2 Xxx1
464 call writefile(['test file Xxx1'], 'Xxx1')
465 call writefile(['test file Xxx2'], 'Xxx2')
466 call writefile(['test file Xxx3'], 'Xxx3')
467
468 new
469 " redefine arglist; go to Xxx1
470 next! Xxx1 Xxx2 Xxx3
471 " open window for all args
472 all
473 call assert_equal('test file Xxx1', getline(1))
474 wincmd w
475 wincmd w
476 call assert_equal('test file Xxx1', getline(1))
477 " should now be in Xxx2
478 rewind
479 call assert_equal('test file Xxx2', getline(1))
480
481 autocmd! BufReadPost Xxx2
482 enew! | only
483 call delete('Xxx1')
484 call delete('Xxx2')
485 call delete('Xxx3')
486 argdelete Xxx*
487 bwipe! Xxx1 Xxx2 Xxx3
Bram Moolenaar8c34aa02017-03-16 22:52:32 +0100488endfunc
489
490func Test_arg_all_expand()
491 call writefile(['test file Xxx1'], 'Xx x')
492 next notexist Xx\ x runtest.vim
493 call assert_equal('notexist Xx\ x runtest.vim', expand('##'))
494 call delete('Xx x')
495endfunc
Bram Moolenaare961cba2018-09-18 21:51:47 +0200496
497func Test_large_arg()
498 " Argument longer or equal to the number of columns used to cause
499 " access to invalid memory.
500 exe 'argadd ' .repeat('x', &columns)
501 args
502endfunc
Bram Moolenaar72e1b392019-08-03 13:50:08 +0200503
504func Test_argdo()
505 next! Xa.c Xb.c Xc.c
506 new
507 let l = []
508 argdo call add(l, expand('%'))
509 call assert_equal(['Xa.c', 'Xb.c', 'Xc.c'], l)
510 bwipe Xa.c Xb.c Xc.c
511endfunc
Bram Moolenaar9f6277b2020-02-11 22:04:02 +0100512
513" Test for quiting Vim with unedited files in the argument list
514func Test_quit_with_arglist()
Bram Moolenaar494e9062020-05-31 21:28:02 +0200515 CheckRunVimInTerminal
Bram Moolenaar9f6277b2020-02-11 22:04:02 +0100516 let buf = RunVimInTerminal('', {'rows': 6})
Bram Moolenaar818fc9a2020-02-21 17:54:45 +0100517 call term_sendkeys(buf, ":set nomore\n")
Bram Moolenaar9f6277b2020-02-11 22:04:02 +0100518 call term_sendkeys(buf, ":args a b c\n")
519 call term_sendkeys(buf, ":quit\n")
Bram Moolenaar6a2c5a72020-04-08 21:50:25 +0200520 call TermWait(buf)
Bram Moolenaar9f6277b2020-02-11 22:04:02 +0100521 call WaitForAssert({-> assert_match('^E173:', term_getline(buf, 6))})
522 call StopVimInTerminal(buf)
Bram Moolenaar406cd902020-02-18 21:54:41 +0100523
524 " Try :confirm quit with unedited files in arglist
525 let buf = RunVimInTerminal('', {'rows': 6})
526 call term_sendkeys(buf, ":set nomore\n")
527 call term_sendkeys(buf, ":args a b c\n")
528 call term_sendkeys(buf, ":confirm quit\n")
Bram Moolenaar6a2c5a72020-04-08 21:50:25 +0200529 call TermWait(buf)
Bram Moolenaar406cd902020-02-18 21:54:41 +0100530 call WaitForAssert({-> assert_match('^\[Y\]es, (N)o: *$',
531 \ term_getline(buf, 6))})
532 call term_sendkeys(buf, "N")
Bram Moolenaar6a2c5a72020-04-08 21:50:25 +0200533 call TermWait(buf)
Bram Moolenaar406cd902020-02-18 21:54:41 +0100534 call term_sendkeys(buf, ":confirm quit\n")
535 call WaitForAssert({-> assert_match('^\[Y\]es, (N)o: *$',
536 \ term_getline(buf, 6))})
537 call term_sendkeys(buf, "Y")
Bram Moolenaar6a2c5a72020-04-08 21:50:25 +0200538 call TermWait(buf)
Bram Moolenaar818fc9a2020-02-21 17:54:45 +0100539 call WaitForAssert({-> assert_equal("finished", term_getstatus(buf))})
540 only!
Bram Moolenaar1671f442020-03-10 07:48:13 +0100541 " When this test fails, swap files are left behind which breaks subsequent
542 " tests
543 call delete('.a.swp')
544 call delete('.b.swp')
545 call delete('.c.swp')
Bram Moolenaar9f6277b2020-02-11 22:04:02 +0100546endfunc
547
548" vim: shiftwidth=2 sts=2 expandtab