blob: 8481ecc5955e102a7d3b18408085eae8d82a2c65 [file] [log] [blame]
Bram Moolenaarcfe435d2020-04-25 20:02:55 +02001" Test commands that are not compiled in a :def function
2
Bram Moolenaar6378c4f2020-04-26 13:50:41 +02003source check.vim
Bram Moolenaarcfe435d2020-04-25 20:02:55 +02004source vim9.vim
Bram Moolenaare88c8e82020-11-01 17:03:37 +01005source term_util.vim
Bram Moolenaare9f262b2020-07-05 14:57:51 +02006source view_util.vim
Bram Moolenaarcfe435d2020-04-25 20:02:55 +02007
Bram Moolenaar39f3b142021-02-14 12:57:36 +01008def Test_vim9cmd()
9 var lines =<< trim END
10 vim9cmd var x = 123
11 let s:y = 'yes'
12 vim9c assert_equal(123, x)
13 vim9cm assert_equal('yes', y)
14 END
15 CheckScriptSuccess(lines)
Dominique Pelle6d37e8e2021-05-06 17:36:55 +020016 assert_fails('vim9cmd', 'E1164:')
Bram Moolenaar39f3b142021-02-14 12:57:36 +010017enddef
18
Bram Moolenaarcfe435d2020-04-25 20:02:55 +020019def Test_edit_wildcards()
Bram Moolenaarac564082020-09-27 19:05:33 +020020 var filename = 'Xtest'
Bram Moolenaarcfe435d2020-04-25 20:02:55 +020021 edit `=filename`
22 assert_equal('Xtest', bufname())
23
Bram Moolenaarac564082020-09-27 19:05:33 +020024 var filenr = 123
Bram Moolenaarcfe435d2020-04-25 20:02:55 +020025 edit Xtest`=filenr`
26 assert_equal('Xtest123', bufname())
27
28 filenr = 77
29 edit `=filename``=filenr`
30 assert_equal('Xtest77', bufname())
31
32 edit X`=filename`xx`=filenr`yy
33 assert_equal('XXtestxx77yy', bufname())
Bram Moolenaar025cb1c2020-12-14 18:31:27 +010034
35 CheckDefFailure(['edit `=xxx`'], 'E1001:')
36 CheckDefFailure(['edit `="foo"'], 'E1083:')
Bram Moolenaarb288ba92021-06-05 17:10:55 +020037
38 var files = ['file 1', 'file%2', 'file# 3']
39 args `=files`
40 assert_equal(files, argv())
Bram Moolenaarcfe435d2020-04-25 20:02:55 +020041enddef
42
Bram Moolenaar4389f9c2020-12-27 16:55:11 +010043def Test_expand_alternate_file()
44 var lines =<< trim END
45 edit Xfileone
46 var bone = bufnr()
47 edit Xfiletwo
48 var btwo = bufnr()
49 edit Xfilethree
50 var bthree = bufnr()
51
52 edit #
53 assert_equal(bthree, bufnr())
54 edit %%
55 assert_equal(btwo, bufnr())
56 edit %% # comment
57 assert_equal(bthree, bufnr())
58 edit %%yy
59 assert_equal('Xfiletwoyy', bufname())
60
61 exe "edit %%" .. bone
62 assert_equal(bone, bufnr())
63 exe "edit %%" .. btwo .. "xx"
64 assert_equal('Xfiletwoxx', bufname())
65
66 next Xfileone Xfiletwo Xfilethree
67 assert_equal('Xfileone', argv(0))
68 assert_equal('Xfiletwo', argv(1))
69 assert_equal('Xfilethree', argv(2))
70 next %%%zz
71 assert_equal('Xfileone', argv(0))
72 assert_equal('Xfiletwo', argv(1))
73 assert_equal('Xfilethreezz', argv(2))
74
75 v:oldfiles = ['Xonefile', 'Xtwofile']
76 edit %%<1
77 assert_equal('Xonefile', bufname())
78 edit %%<2
79 assert_equal('Xtwofile', bufname())
80 assert_fails('edit %%<3', 'E684:')
81
82 edit Xfileone.vim
83 edit Xfiletwo
84 edit %%:r
85 assert_equal('Xfileone', bufname())
Bram Moolenaardfbc5fd2021-01-23 15:15:01 +010086
87 assert_false(bufexists('altfoo'))
88 edit altfoo
89 edit bar
90 assert_true(bufexists('altfoo'))
91 assert_true(buflisted('altfoo'))
92 bdel %%
93 assert_true(bufexists('altfoo'))
94 assert_false(buflisted('altfoo'))
95 bwipe! altfoo
96 bwipe! bar
Bram Moolenaar4389f9c2020-12-27 16:55:11 +010097 END
98 CheckDefAndScriptSuccess(lines)
99enddef
100
Bram Moolenaar56ce9ea2020-12-25 18:35:29 +0100101def Test_global_backtick_expansion()
102 new
103 setline(1, 'xx')
104 var name = 'foobar'
105 g/^xx/s/.*/`=name`
106 assert_equal('foobar', getline(1))
107 bwipe!
108enddef
109
Bram Moolenaarecac5912021-01-05 19:23:28 +0100110def Test_folddo_backtick_expansion()
111 new
112 var name = 'xxx'
113 folddoopen edit `=name`
114 assert_equal('xxx', bufname())
115 bwipe!
116
117 new
118 setline(1, ['one', 'two'])
119 set nomodified
120 :1,2fold
121 foldclose
122 folddoclose edit `=name`
123 assert_equal('xxx', bufname())
124 bwipe!
125enddef
126
Bram Moolenaar6378c4f2020-04-26 13:50:41 +0200127def Test_hardcopy_wildcards()
128 CheckUnix
129 CheckFeature postscript
130
Bram Moolenaarac564082020-09-27 19:05:33 +0200131 var outfile = 'print'
Bram Moolenaar6378c4f2020-04-26 13:50:41 +0200132 hardcopy > X`=outfile`.ps
133 assert_true(filereadable('Xprint.ps'))
134
135 delete('Xprint.ps')
136enddef
137
138def Test_syn_include_wildcards()
139 writefile(['syn keyword Found found'], 'Xthemine.vim')
Bram Moolenaarac564082020-09-27 19:05:33 +0200140 var save_rtp = &rtp
Bram Moolenaar6378c4f2020-04-26 13:50:41 +0200141 &rtp = '.'
142
Bram Moolenaarac564082020-09-27 19:05:33 +0200143 var fname = 'mine'
Bram Moolenaar6378c4f2020-04-26 13:50:41 +0200144 syn include @Group Xthe`=fname`.vim
145 assert_match('Found.* contained found', execute('syn list Found'))
146
147 &rtp = save_rtp
148 delete('Xthemine.vim')
149enddef
150
Bram Moolenaar7e8967f2020-06-27 21:56:17 +0200151def Test_echo_linebreak()
Bram Moolenaarac564082020-09-27 19:05:33 +0200152 var lines =<< trim END
Bram Moolenaar7e8967f2020-06-27 21:56:17 +0200153 vim9script
154 redir @a
155 echo 'one'
156 .. 'two'
157 redir END
158 assert_equal("\nonetwo", @a)
159 END
160 CheckScriptSuccess(lines)
161
162 lines =<< trim END
163 vim9script
164 redir @a
165 echo 11 +
166 77
167 - 22
168 redir END
169 assert_equal("\n66", @a)
170 END
171 CheckScriptSuccess(lines)
172enddef
173
Bram Moolenaar13106602020-10-04 16:06:05 +0200174def Test_condition_types()
175 var lines =<< trim END
176 if 'text'
177 endif
178 END
Bram Moolenaarea2d4072020-11-12 12:08:51 +0100179 CheckDefAndScriptFailure(lines, 'E1135:', 1)
Bram Moolenaar13106602020-10-04 16:06:05 +0200180
181 lines =<< trim END
182 if [1]
183 endif
184 END
185 CheckDefFailure(lines, 'E1012:', 1)
186 CheckScriptFailure(['vim9script'] + lines, 'E745:', 2)
187
188 lines =<< trim END
189 g:cond = 'text'
190 if g:cond
191 endif
192 END
Bram Moolenaarea2d4072020-11-12 12:08:51 +0100193 CheckDefExecAndScriptFailure(lines, 'E1135:', 2)
Bram Moolenaar13106602020-10-04 16:06:05 +0200194
195 lines =<< trim END
196 g:cond = 0
197 if g:cond
198 elseif 'text'
199 endif
200 END
201 CheckDefFailure(lines, 'E1012:', 3)
Bram Moolenaarea2d4072020-11-12 12:08:51 +0100202 CheckScriptFailure(['vim9script'] + lines, 'E1135:', 4)
Bram Moolenaar13106602020-10-04 16:06:05 +0200203
204 lines =<< trim END
205 if g:cond
206 elseif [1]
207 endif
208 END
209 CheckDefFailure(lines, 'E1012:', 2)
210 CheckScriptFailure(['vim9script'] + lines, 'E745:', 3)
211
212 lines =<< trim END
213 g:cond = 'text'
214 if 0
215 elseif g:cond
216 endif
217 END
Bram Moolenaarea2d4072020-11-12 12:08:51 +0100218 CheckDefExecAndScriptFailure(lines, 'E1135:', 3)
Bram Moolenaar13106602020-10-04 16:06:05 +0200219
220 lines =<< trim END
221 while 'text'
222 endwhile
223 END
224 CheckDefFailure(lines, 'E1012:', 1)
Bram Moolenaarea2d4072020-11-12 12:08:51 +0100225 CheckScriptFailure(['vim9script'] + lines, 'E1135:', 2)
Bram Moolenaar13106602020-10-04 16:06:05 +0200226
227 lines =<< trim END
228 while [1]
229 endwhile
230 END
231 CheckDefFailure(lines, 'E1012:', 1)
232 CheckScriptFailure(['vim9script'] + lines, 'E745:', 2)
233
234 lines =<< trim END
235 g:cond = 'text'
236 while g:cond
237 endwhile
238 END
Bram Moolenaarea2d4072020-11-12 12:08:51 +0100239 CheckDefExecAndScriptFailure(lines, 'E1135:', 2)
Bram Moolenaar13106602020-10-04 16:06:05 +0200240enddef
241
Bram Moolenaarfaf86262020-06-27 23:07:36 +0200242def Test_if_linebreak()
Bram Moolenaarac564082020-09-27 19:05:33 +0200243 var lines =<< trim END
Bram Moolenaarfaf86262020-06-27 23:07:36 +0200244 vim9script
245 if 1 &&
Bram Moolenaar2bb26582020-10-03 22:52:39 +0200246 true
247 || 1
Bram Moolenaarfaf86262020-06-27 23:07:36 +0200248 g:res = 42
249 endif
250 assert_equal(42, g:res)
251 END
252 CheckScriptSuccess(lines)
253 unlet g:res
254
255 lines =<< trim END
256 vim9script
257 if 1 &&
258 0
259 g:res = 0
260 elseif 0 ||
261 0
262 || 1
263 g:res = 12
264 endif
265 assert_equal(12, g:res)
266 END
267 CheckScriptSuccess(lines)
268 unlet g:res
269enddef
270
271def Test_while_linebreak()
Bram Moolenaarac564082020-09-27 19:05:33 +0200272 var lines =<< trim END
Bram Moolenaarfaf86262020-06-27 23:07:36 +0200273 vim9script
Bram Moolenaarac564082020-09-27 19:05:33 +0200274 var nr = 0
Bram Moolenaard5053d02020-06-28 15:51:16 +0200275 while nr <
276 10 + 3
277 nr = nr
278 + 4
279 endwhile
280 assert_equal(16, nr)
281 END
282 CheckScriptSuccess(lines)
283
284 lines =<< trim END
285 vim9script
Bram Moolenaarac564082020-09-27 19:05:33 +0200286 var nr = 0
Bram Moolenaard5053d02020-06-28 15:51:16 +0200287 while nr
288 <
289 10
290 +
291 3
292 nr = nr
293 +
294 4
Bram Moolenaarfaf86262020-06-27 23:07:36 +0200295 endwhile
296 assert_equal(16, nr)
297 END
298 CheckScriptSuccess(lines)
299enddef
Bram Moolenaarcfe435d2020-04-25 20:02:55 +0200300
Bram Moolenaarb7a78f72020-06-28 18:43:40 +0200301def Test_for_linebreak()
Bram Moolenaarac564082020-09-27 19:05:33 +0200302 var lines =<< trim END
Bram Moolenaarb7a78f72020-06-28 18:43:40 +0200303 vim9script
Bram Moolenaarac564082020-09-27 19:05:33 +0200304 var nr = 0
Bram Moolenaarb7a78f72020-06-28 18:43:40 +0200305 for x
306 in
307 [1, 2, 3, 4]
308 nr = nr + x
309 endfor
310 assert_equal(10, nr)
311 END
312 CheckScriptSuccess(lines)
313
314 lines =<< trim END
315 vim9script
Bram Moolenaarac564082020-09-27 19:05:33 +0200316 var nr = 0
Bram Moolenaarb7a78f72020-06-28 18:43:40 +0200317 for x
318 in
319 [1, 2,
320 3, 4
321 ]
322 nr = nr
323 +
324 x
325 endfor
326 assert_equal(10, nr)
327 END
328 CheckScriptSuccess(lines)
329enddef
330
Bram Moolenaare0890d62021-02-17 14:52:14 +0100331def MethodAfterLinebreak(arg: string)
332 arg
333 ->setline(1)
334enddef
335
Bram Moolenaard2ef6b32020-07-02 21:11:34 +0200336def Test_method_call_linebreak()
Bram Moolenaarac564082020-09-27 19:05:33 +0200337 var lines =<< trim END
Bram Moolenaar5f195932020-07-01 20:07:14 +0200338 vim9script
Bram Moolenaarac564082020-09-27 19:05:33 +0200339 var res = []
Bram Moolenaar5f195932020-07-01 20:07:14 +0200340 func RetArg(
341 arg
342 )
343 let s:res = a:arg
344 endfunc
345 [1,
346 2,
347 3]->RetArg()
348 assert_equal([1, 2, 3], res)
349 END
350 CheckScriptSuccess(lines)
Bram Moolenaar148be9b2021-02-02 21:33:52 +0100351
352 lines =<< trim END
353 new
354 var name = [1, 2]
355 name
356 ->copy()
357 ->setline(1)
358 assert_equal(['1', '2'], getline(1, 2))
359 bwipe!
360 END
361 CheckDefAndScriptSuccess(lines)
362
363 lines =<< trim END
364 new
Bram Moolenaar6914e872021-03-06 21:01:09 +0100365 def Foo(): string
366 return 'the text'
367 enddef
368 def Bar(F: func): string
369 return F()
370 enddef
371 def Test()
Bram Moolenaar77b10ff2021-03-14 13:21:35 +0100372 Foo ->Bar()
373 ->setline(1)
Bram Moolenaar6914e872021-03-06 21:01:09 +0100374 enddef
375 Test()
376 assert_equal('the text', getline(1))
377 bwipe!
378 END
379 CheckDefAndScriptSuccess(lines)
380
381 lines =<< trim END
382 new
Bram Moolenaar148be9b2021-02-02 21:33:52 +0100383 g:shortlist
384 ->copy()
385 ->setline(1)
386 assert_equal(['1', '2'], getline(1, 2))
387 bwipe!
388 END
389 g:shortlist = [1, 2]
390 CheckDefAndScriptSuccess(lines)
391 unlet g:shortlist
Bram Moolenaare0890d62021-02-17 14:52:14 +0100392
393 new
394 MethodAfterLinebreak('foobar')
395 assert_equal('foobar', getline(1))
396 bwipe!
Bram Moolenaar2e2d7582021-03-03 21:22:41 +0100397
398 lines =<< trim END
399 vim9script
400 def Foo(): string
401 return '# some text'
402 enddef
403
404 def Bar(F: func): string
405 return F()
406 enddef
407
Bram Moolenaar77b10ff2021-03-14 13:21:35 +0100408 Foo->Bar()
Bram Moolenaar2e2d7582021-03-03 21:22:41 +0100409 ->setline(1)
410 END
411 CheckScriptSuccess(lines)
412 assert_equal('# some text', getline(1))
413 bwipe!
Bram Moolenaar5f195932020-07-01 20:07:14 +0200414enddef
415
Bram Moolenaar7cebe8b2021-01-23 14:22:16 +0100416def Test_method_call_whitespace()
417 var lines =<< trim END
418 new
419 var yank = 'text'
420 yank->setline(1)
421 yank ->setline(2)
422 yank-> setline(3)
423 yank -> setline(4)
424 assert_equal(['text', 'text', 'text', 'text'], getline(1, 4))
425 bwipe!
426 END
427 CheckDefAndScriptSuccess(lines)
428enddef
429
Bram Moolenaar77b10ff2021-03-14 13:21:35 +0100430def Test_method_and_user_command()
431 var lines =<< trim END
432 vim9script
433 def Cmd()
434 g:didFunc = 1
435 enddef
436 command Cmd g:didCmd = 1
437 Cmd
438 assert_equal(1, g:didCmd)
439 Cmd()
440 assert_equal(1, g:didFunc)
441 unlet g:didFunc
442 unlet g:didCmd
443
444 def InDefFunc()
445 Cmd
446 assert_equal(1, g:didCmd)
447 Cmd()
448 assert_equal(1, g:didFunc)
449 unlet g:didFunc
450 unlet g:didCmd
451 enddef
452 InDefFunc()
453 END
454 CheckScriptSuccess(lines)
455enddef
456
Bram Moolenaar683581e2020-10-22 21:22:58 +0200457def Test_skipped_expr_linebreak()
458 if 0
459 var x = []
Bram Moolenaar2949cfd2020-12-31 21:28:47 +0100460 ->map(() => 0)
Bram Moolenaar683581e2020-10-22 21:22:58 +0200461 endif
462enddef
463
Bram Moolenaar0a47e092020-07-08 18:30:06 +0200464def Test_dict_member()
Bram Moolenaare0de1712020-12-02 17:36:54 +0100465 var test: dict<list<number>> = {data: [3, 1, 2]}
Bram Moolenaar0a47e092020-07-08 18:30:06 +0200466 test.data->sort()
Bram Moolenaare0de1712020-12-02 17:36:54 +0100467 assert_equal({data: [1, 2, 3]}, test)
Bram Moolenaar0a47e092020-07-08 18:30:06 +0200468 test.data
469 ->reverse()
Bram Moolenaare0de1712020-12-02 17:36:54 +0100470 assert_equal({data: [3, 2, 1]}, test)
Bram Moolenaar0a47e092020-07-08 18:30:06 +0200471
Bram Moolenaarac564082020-09-27 19:05:33 +0200472 var lines =<< trim END
Bram Moolenaar0a47e092020-07-08 18:30:06 +0200473 vim9script
Bram Moolenaare0de1712020-12-02 17:36:54 +0100474 var test: dict<list<number>> = {data: [3, 1, 2]}
Bram Moolenaar0a47e092020-07-08 18:30:06 +0200475 test.data->sort()
Bram Moolenaare0de1712020-12-02 17:36:54 +0100476 assert_equal({data: [1, 2, 3]}, test)
Bram Moolenaar0a47e092020-07-08 18:30:06 +0200477 END
478 CheckScriptSuccess(lines)
479enddef
480
Bram Moolenaare9f262b2020-07-05 14:57:51 +0200481def Test_bar_after_command()
482 def RedrawAndEcho()
Bram Moolenaarac564082020-09-27 19:05:33 +0200483 var x = 'did redraw'
Bram Moolenaare9f262b2020-07-05 14:57:51 +0200484 redraw | echo x
485 enddef
486 RedrawAndEcho()
487 assert_match('did redraw', Screenline(&lines))
488
Bram Moolenaar788123c2020-07-05 15:32:17 +0200489 def CallAndEcho()
Bram Moolenaarac564082020-09-27 19:05:33 +0200490 var x = 'did redraw'
Bram Moolenaar788123c2020-07-05 15:32:17 +0200491 reg_executing() | echo x
492 enddef
493 CallAndEcho()
494 assert_match('did redraw', Screenline(&lines))
495
Bram Moolenaare9f262b2020-07-05 14:57:51 +0200496 if has('unix')
497 # bar in filter write command does not start new command
498 def WriteToShell()
499 new
500 setline(1, 'some text')
501 w !cat | cat > Xoutfile
502 bwipe!
503 enddef
504 WriteToShell()
505 assert_equal(['some text'], readfile('Xoutfile'))
506 delete('Xoutfile')
507
508 # bar in filter read command does not start new command
509 def ReadFromShell()
510 new
511 r! echo hello there | cat > Xoutfile
512 r !echo again | cat >> Xoutfile
513 bwipe!
514 enddef
515 ReadFromShell()
516 assert_equal(['hello there', 'again'], readfile('Xoutfile'))
517 delete('Xoutfile')
518 endif
519enddef
520
Bram Moolenaarb074e8b2020-07-11 13:40:45 +0200521def Test_filter_is_not_modifier()
Bram Moolenaare0de1712020-12-02 17:36:54 +0100522 var tags = [{a: 1, b: 2}, {x: 3, y: 4}]
Bram Moolenaar2949cfd2020-12-31 21:28:47 +0100523 filter(tags, ( _, v) => has_key(v, 'x') ? 1 : 0 )
Bram Moolenaare0de1712020-12-02 17:36:54 +0100524 assert_equal([{x: 3, y: 4}], tags)
Bram Moolenaarb074e8b2020-07-11 13:40:45 +0200525enddef
526
Bram Moolenaare88c8e82020-11-01 17:03:37 +0100527def Test_command_modifier_filter()
Bram Moolenaar4f6b6ed2020-10-29 20:24:34 +0100528 var lines =<< trim END
529 final expected = "\nType Name Content\n c \"c piyo"
530 @a = 'hoge'
531 @b = 'fuga'
532 @c = 'piyo'
533
534 assert_equal(execute('filter /piyo/ registers abc'), expected)
535 END
536 CheckDefAndScriptSuccess(lines)
537enddef
538
Bram Moolenaare88c8e82020-11-01 17:03:37 +0100539def Test_win_command_modifiers()
540 assert_equal(1, winnr('$'))
541
542 set splitright
543 vsplit
544 assert_equal(2, winnr())
545 close
546 aboveleft vsplit
547 assert_equal(1, winnr())
548 close
549 set splitright&
550
551 vsplit
552 assert_equal(1, winnr())
553 close
554 belowright vsplit
555 assert_equal(2, winnr())
556 close
557 rightbelow vsplit
558 assert_equal(2, winnr())
559 close
560
Bram Moolenaar97a19002020-11-01 22:15:44 +0100561 if has('browse')
562 browse set
563 assert_equal('option-window', expand('%'))
564 close
565 endif
Bram Moolenaare88c8e82020-11-01 17:03:37 +0100566
567 vsplit
568 botright split
569 assert_equal(3, winnr())
570 assert_equal(&columns, winwidth(0))
571 close
572 close
573
574 vsplit
575 topleft split
576 assert_equal(1, winnr())
577 assert_equal(&columns, winwidth(0))
578 close
579 close
580
581 gettabinfo()->len()->assert_equal(1)
582 tab split
583 gettabinfo()->len()->assert_equal(2)
584 tabclose
585
586 vertical new
587 assert_inrange(&columns / 2 - 2, &columns / 2 + 1, winwidth(0))
588 close
589enddef
590
591func Test_command_modifier_confirm()
592 CheckNotGui
593 CheckRunVimInTerminal
594
595 " Test for saving all the modified buffers
596 let lines =<< trim END
597 call setline(1, 'changed')
598 def Getout()
599 confirm write Xfile
600 enddef
601 END
602 call writefile(lines, 'Xconfirmscript')
603 call writefile(['empty'], 'Xfile')
604 let buf = RunVimInTerminal('-S Xconfirmscript', {'rows': 8})
605 call term_sendkeys(buf, ":call Getout()\n")
606 call WaitForAssert({-> assert_match('(Y)es, \[N\]o: ', term_getline(buf, 8))}, 1000)
607 call term_sendkeys(buf, "y")
Bram Moolenaar645cd3e2020-11-01 20:04:57 +0100608 call WaitForAssert({-> assert_match('(Y)es, \[N\]o: ', term_getline(buf, 8))}, 1000)
609 call term_sendkeys(buf, "\<CR>")
610 call TermWait(buf)
Bram Moolenaare88c8e82020-11-01 17:03:37 +0100611 call StopVimInTerminal(buf)
612
613 call assert_equal(['changed'], readfile('Xfile'))
614 call delete('Xfile')
Bram Moolenaar645cd3e2020-11-01 20:04:57 +0100615 call delete('.Xfile.swp') " in case Vim was killed
Bram Moolenaare88c8e82020-11-01 17:03:37 +0100616 call delete('Xconfirmscript')
617endfunc
618
619def Test_command_modifiers_keep()
620 if has('unix')
621 def DoTest(addRflag: bool, keepMarks: bool, hasMarks: bool)
622 new
623 setline(1, ['one', 'two', 'three'])
624 normal 1Gma
625 normal 2Gmb
626 normal 3Gmc
627 if addRflag
628 set cpo+=R
629 else
630 set cpo-=R
631 endif
632 if keepMarks
633 keepmarks :%!cat
634 else
635 :%!cat
636 endif
637 if hasMarks
638 assert_equal(1, line("'a"))
639 assert_equal(2, line("'b"))
640 assert_equal(3, line("'c"))
641 else
642 assert_equal(0, line("'a"))
643 assert_equal(0, line("'b"))
644 assert_equal(0, line("'c"))
645 endif
646 quit!
647 enddef
648 DoTest(false, false, true)
649 DoTest(true, false, false)
650 DoTest(false, true, true)
651 DoTest(true, true, true)
652 set cpo&vim
Bram Moolenaarf65b35b2020-11-04 18:02:44 +0100653
654 new
655 setline(1, ['one', 'two', 'three', 'four'])
656 assert_equal(4, line("$"))
657 normal 1Gma
658 normal 2Gmb
659 normal 3Gmc
660 lockmarks :1,2!wc
661 # line is deleted, marks don't move
662 assert_equal(3, line("$"))
663 assert_equal('four', getline(3))
664 assert_equal(1, line("'a"))
665 assert_equal(2, line("'b"))
666 assert_equal(3, line("'c"))
667 quit!
Bram Moolenaare88c8e82020-11-01 17:03:37 +0100668 endif
669
Bram Moolenaarf65b35b2020-11-04 18:02:44 +0100670 edit Xone
671 edit Xtwo
672 assert_equal('Xone', expand('#'))
673 keepalt edit Xthree
674 assert_equal('Xone', expand('#'))
675
676 normal /a*b*
677 assert_equal('a*b*', histget("search"))
678 keeppatterns normal /c*d*
679 assert_equal('a*b*', histget("search"))
680
681 new
682 setline(1, range(10))
683 :10
684 normal gg
685 assert_equal(10, getpos("''")[1])
686 keepjumps normal 5G
687 assert_equal(10, getpos("''")[1])
688 quit!
Bram Moolenaare88c8e82020-11-01 17:03:37 +0100689enddef
690
Bram Moolenaar8242ebb2020-12-29 11:15:01 +0100691def Test_bar_line_continuation()
692 var lines =<< trim END
693 au BufNewFile Xfile g:readFile = 1
694 | g:readExtra = 2
695 g:readFile = 0
696 g:readExtra = 0
697 edit Xfile
698 assert_equal(1, g:readFile)
699 assert_equal(2, g:readExtra)
700 bwipe!
701 au! BufNewFile
702
703 au BufNewFile Xfile g:readFile = 1
704 | g:readExtra = 2
705 | g:readMore = 3
706 g:readFile = 0
707 g:readExtra = 0
708 g:readMore = 0
709 edit Xfile
710 assert_equal(1, g:readFile)
711 assert_equal(2, g:readExtra)
712 assert_equal(3, g:readMore)
713 bwipe!
714 au! BufNewFile
715 unlet g:readFile
716 unlet g:readExtra
717 unlet g:readMore
718 END
719 CheckDefAndScriptSuccess(lines)
720enddef
721
Bram Moolenaare88c8e82020-11-01 17:03:37 +0100722def Test_command_modifier_other()
Bram Moolenaar66669fc2020-11-04 18:53:35 +0100723 new Xsomefile
724 setline(1, 'changed')
725 var buf = bufnr()
726 hide edit Xotherfile
727 var info = getbufinfo(buf)
728 assert_equal(1, info[0].hidden)
729 assert_equal(1, info[0].changed)
730 edit Xsomefile
731 bwipe!
732
733 au BufNewFile Xfile g:readFile = 1
734 g:readFile = 0
735 edit Xfile
736 assert_equal(1, g:readFile)
737 bwipe!
738 g:readFile = 0
739 noautocmd edit Xfile
740 assert_equal(0, g:readFile)
Bram Moolenaardcc58e02020-12-28 20:53:21 +0100741 au! BufNewFile
Bram Moolenaardcc58e02020-12-28 20:53:21 +0100742 unlet g:readFile
Bram Moolenaar66669fc2020-11-04 18:53:35 +0100743
744 noswapfile edit XnoSwap
Bram Moolenaardd1f4262020-12-31 17:41:01 +0100745 assert_equal(false, &l:swapfile)
Bram Moolenaar66669fc2020-11-04 18:53:35 +0100746 bwipe!
747
748 var caught = false
749 try
750 sandbox !ls
751 catch /E48:/
752 caught = true
753 endtry
754 assert_true(caught)
755
756 :8verbose g:verbose_now = &verbose
757 assert_equal(8, g:verbose_now)
758 unlet g:verbose_now
759enddef
760
761def EchoHere()
762 echomsg 'here'
763enddef
764def EchoThere()
765 unsilent echomsg 'there'
766enddef
767
768def Test_modifier_silent_unsilent()
769 echomsg 'last one'
770 silent echomsg "text"
771 assert_equal("\nlast one", execute(':1messages'))
772
773 silent! echoerr "error"
774
775 echomsg 'last one'
776 silent EchoHere()
777 assert_equal("\nlast one", execute(':1messages'))
778
779 silent EchoThere()
780 assert_equal("\nthere", execute(':1messages'))
Bram Moolenaar20a76292020-12-25 19:47:24 +0100781
782 try
783 silent eval [][0]
784 catch
785 echomsg "caught"
786 endtry
787 assert_equal("\ncaught", execute(':1messages'))
Bram Moolenaare88c8e82020-11-01 17:03:37 +0100788enddef
789
Bram Moolenaar36113e42020-11-02 21:08:47 +0100790def Test_range_after_command_modifier()
Bram Moolenaar6e2c2c52020-12-25 19:25:45 +0100791 CheckScriptFailure(['vim9script', 'silent keepjump 1d _'], 'E1050: Colon required before a range: 1d _', 2)
Bram Moolenaar36113e42020-11-02 21:08:47 +0100792 new
793 setline(1, 'xxx')
794 CheckScriptSuccess(['vim9script', 'silent keepjump :1d _'])
795 assert_equal('', getline(1))
796 bwipe!
797enddef
798
Bram Moolenaarece0b872021-01-08 20:40:45 +0100799def Test_silent_pattern()
800 new
801 silent! :/pat/put _
802 bwipe!
803enddef
804
Bram Moolenaarfa984412021-03-25 22:15:28 +0100805def Test_useless_command_modifier()
806 g:maybe = true
807 var lines =<< trim END
808 if g:maybe
809 silent endif
810 END
811 CheckDefAndScriptFailure(lines, 'E1176:', 2)
812
813 lines =<< trim END
814 for i in [0]
815 silent endfor
816 END
817 CheckDefAndScriptFailure(lines, 'E1176:', 2)
818
819 lines =<< trim END
820 while g:maybe
821 silent endwhile
822 END
823 CheckDefAndScriptFailure(lines, 'E1176:', 2)
824
825 lines =<< trim END
826 silent try
827 finally
828 endtry
829 END
830 CheckDefAndScriptFailure(lines, 'E1176:', 1)
831
832 lines =<< trim END
833 try
834 silent catch
835 endtry
836 END
837 CheckDefAndScriptFailure(lines, 'E1176:', 2)
838
839 lines =<< trim END
840 try
841 silent finally
842 endtry
843 END
844 CheckDefAndScriptFailure(lines, 'E1176:', 2)
845
846 lines =<< trim END
847 try
848 finally
849 silent endtry
850 END
851 CheckDefAndScriptFailure(lines, 'E1176:', 3)
852enddef
853
Bram Moolenaar007f9d62020-07-06 23:04:49 +0200854def Test_eval_command()
Bram Moolenaarac564082020-09-27 19:05:33 +0200855 var from = 3
856 var to = 5
Bram Moolenaar007f9d62020-07-06 23:04:49 +0200857 g:val = 111
858 def Increment(nrs: list<number>)
859 for nr in nrs
860 g:val += nr
861 endfor
862 enddef
863 eval range(from, to)
864 ->Increment()
865 assert_equal(111 + 3 + 4 + 5, g:val)
866 unlet g:val
Bram Moolenaard0fe6202020-12-05 17:11:12 +0100867
868 var lines =<< trim END
869 vim9script
870 g:caught = 'no'
871 try
872 eval 123 || 0
873 catch
874 g:caught = 'yes'
875 endtry
876 assert_equal('yes', g:caught)
877 unlet g:caught
878 END
879 CheckScriptSuccess(lines)
Bram Moolenaar007f9d62020-07-06 23:04:49 +0200880enddef
881
Bram Moolenaarb8a92962020-08-20 18:02:47 +0200882def Test_map_command()
Bram Moolenaarac564082020-09-27 19:05:33 +0200883 var lines =<< trim END
Bram Moolenaarb8a92962020-08-20 18:02:47 +0200884 nnoremap <F3> :echo 'hit F3 #'<CR>
885 assert_equal(":echo 'hit F3 #'<CR>", maparg("<F3>", "n"))
886 END
887 CheckDefSuccess(lines)
888 CheckScriptSuccess(['vim9script'] + lines)
889enddef
890
Bram Moolenaarb3ea36c2020-08-23 21:46:32 +0200891def Test_normal_command()
892 new
893 setline(1, 'doesnotexist')
Bram Moolenaarac564082020-09-27 19:05:33 +0200894 var caught = 0
Bram Moolenaarb3ea36c2020-08-23 21:46:32 +0200895 try
896 exe "norm! \<C-]>"
897 catch /E433/
898 caught = 2
899 endtry
900 assert_equal(2, caught)
901
902 try
903 exe "norm! 3\<C-]>"
904 catch /E433/
905 caught = 3
906 endtry
907 assert_equal(3, caught)
908 bwipe!
909enddef
910
Bram Moolenaarc3516f72020-09-08 22:45:35 +0200911def Test_put_command()
912 new
913 @p = 'ppp'
914 put p
915 assert_equal('ppp', getline(2))
916
917 put ='below'
918 assert_equal('below', getline(3))
919 put! ='above'
920 assert_equal('above', getline(3))
921 assert_equal('below', getline(4))
922
Bram Moolenaar883cf972021-01-15 18:04:43 +0100923 :2put =['a', 'b', 'c']
924 assert_equal(['ppp', 'a', 'b', 'c', 'above'], getline(2, 6))
925
Bram Moolenaar08597872020-12-10 19:43:40 +0100926 # compute range at runtime
927 setline(1, range(1, 8))
928 @a = 'aaa'
929 :$-2put a
930 assert_equal('aaa', getline(7))
931
932 setline(1, range(1, 8))
933 :2
934 :+2put! a
935 assert_equal('aaa', getline(4))
936
Bram Moolenaara28639e2021-01-19 22:48:09 +0100937 []->mapnew(() => 0)
938 :$put ='end'
939 assert_equal('end', getline('$'))
940
Bram Moolenaarc3516f72020-09-08 22:45:35 +0200941 bwipe!
Bram Moolenaar025cb1c2020-12-14 18:31:27 +0100942
943 CheckDefFailure(['put =xxx'], 'E1001:')
944enddef
945
946def Test_put_with_linebreak()
947 new
948 var lines =<< trim END
949 vim9script
950 pu =split('abc', '\zs')
951 ->join()
952 END
953 CheckScriptSuccess(lines)
954 getline(2)->assert_equal('a b c')
955 bwipe!
Bram Moolenaarc3516f72020-09-08 22:45:35 +0200956enddef
957
Bram Moolenaar3bd8de42020-09-14 16:37:34 +0200958def Test_command_star_range()
959 new
960 setline(1, ['xxx foo xxx', 'xxx bar xxx', 'xxx foo xx bar'])
961 setpos("'<", [0, 1, 0, 0])
962 setpos("'>", [0, 3, 0, 0])
963 :*s/\(foo\|bar\)/baz/g
964 getline(1, 3)->assert_equal(['xxx baz xxx', 'xxx baz xxx', 'xxx baz xx baz'])
965
966 bwipe!
967enddef
968
Bram Moolenaar20d89e02020-10-20 23:11:33 +0200969def Test_f_args()
970 var lines =<< trim END
971 vim9script
972
973 func SaveCmdArgs(...)
974 let g:args = a:000
975 endfunc
976
977 command -nargs=* TestFArgs call SaveCmdArgs(<f-args>)
978
979 TestFArgs
980 assert_equal([], g:args)
981
982 TestFArgs one two three
983 assert_equal(['one', 'two', 'three'], g:args)
984 END
985 CheckScriptSuccess(lines)
986enddef
Bram Moolenaarc3516f72020-09-08 22:45:35 +0200987
Bram Moolenaard1510ee2021-01-04 16:15:58 +0100988def Test_user_command_comment()
989 command -nargs=1 Comd echom <q-args>
990
991 var lines =<< trim END
Bram Moolenaarb98cec22021-04-25 16:35:55 +0200992 vim9script
993 Comd # comment
Bram Moolenaard1510ee2021-01-04 16:15:58 +0100994 END
995 CheckScriptSuccess(lines)
996
997 lines =<< trim END
Bram Moolenaarb98cec22021-04-25 16:35:55 +0200998 vim9script
999 Comd# comment
Bram Moolenaard1510ee2021-01-04 16:15:58 +01001000 END
1001 CheckScriptFailure(lines, 'E1144:')
Bram Moolenaard1510ee2021-01-04 16:15:58 +01001002 delcommand Comd
Bram Moolenaarb98cec22021-04-25 16:35:55 +02001003
1004 lines =<< trim END
1005 vim9script
1006 command Foo echo 'Foo'
1007 Foo3Bar
1008 END
1009 CheckScriptFailure(lines, 'E1144: Command "Foo" is not followed by white space: Foo3Bar')
1010
1011 delcommand Foo
Bram Moolenaard1510ee2021-01-04 16:15:58 +01001012enddef
1013
Bram Moolenaar95388e32020-11-20 21:07:00 +01001014def Test_star_command()
1015 var lines =<< trim END
1016 vim9script
1017 @s = 'g:success = 8'
1018 set cpo+=*
1019 exe '*s'
1020 assert_equal(8, g:success)
1021 unlet g:success
1022 set cpo-=*
1023 assert_fails("exe '*s'", 'E1050:')
1024 END
1025 CheckScriptSuccess(lines)
1026enddef
1027
Bram Moolenaar47a2abf2020-11-25 20:12:11 +01001028def Test_cmd_argument_without_colon()
1029 new Xfile
1030 setline(1, ['a', 'b', 'c', 'd'])
1031 write
1032 edit +3 %
1033 assert_equal(3, getcurpos()[1])
1034 edit +/a %
1035 assert_equal(1, getcurpos()[1])
1036 bwipe
1037 delete('Xfile')
1038enddef
1039
Bram Moolenaar1c0aa972020-12-16 21:43:54 +01001040def Test_ambiguous_user_cmd()
Bram Moolenaard1510ee2021-01-04 16:15:58 +01001041 command Cmd1 eval 0
1042 command Cmd2 eval 0
Bram Moolenaar1c0aa972020-12-16 21:43:54 +01001043 var lines =<< trim END
Bram Moolenaar1c0aa972020-12-16 21:43:54 +01001044 Cmd
1045 END
Bram Moolenaard1510ee2021-01-04 16:15:58 +01001046 CheckDefAndScriptFailure(lines, 'E464:', 1)
1047 delcommand Cmd1
1048 delcommand Cmd2
Bram Moolenaar1c0aa972020-12-16 21:43:54 +01001049enddef
1050
Bram Moolenaar52c124d2020-12-20 21:43:35 +01001051def Test_command_not_recognized()
1052 var lines =<< trim END
1053 d.key = 'asdf'
1054 END
1055 CheckDefFailure(lines, 'E1146:', 1)
1056
1057 lines =<< trim END
1058 d['key'] = 'asdf'
1059 END
1060 CheckDefFailure(lines, 'E1146:', 1)
1061enddef
Bram Moolenaarb7a78f72020-06-28 18:43:40 +02001062
Bram Moolenaarf4e20992020-12-21 19:59:08 +01001063def Test_magic_not_used()
1064 new
1065 for cmd in ['set magic', 'set nomagic']
1066 exe cmd
1067 setline(1, 'aaa')
1068 s/.../bbb/
1069 assert_equal('bbb', getline(1))
1070 endfor
1071
1072 set magic
1073 setline(1, 'aaa')
1074 assert_fails('s/.\M../bbb/', 'E486:')
1075 assert_fails('snomagic/.../bbb/', 'E486:')
1076 assert_equal('aaa', getline(1))
1077
1078 bwipe!
1079enddef
1080
Bram Moolenaar60f63102020-12-21 20:32:43 +01001081def Test_gdefault_not_used()
1082 new
1083 for cmd in ['set gdefault', 'set nogdefault']
1084 exe cmd
1085 setline(1, 'aaa')
1086 s/./b/
1087 assert_equal('baa', getline(1))
1088 endfor
1089
1090 set nogdefault
1091 bwipe!
1092enddef
1093
Bram Moolenaar179eb562020-12-27 18:03:22 +01001094def g:SomeComplFunc(findstart: number, base: string): any
1095 if findstart
1096 return 0
1097 else
1098 return ['aaa', 'bbb']
1099 endif
1100enddef
1101
1102def Test_insert_complete()
1103 # this was running into an error with the matchparen hack
1104 new
1105 set completefunc=SomeComplFunc
1106 feedkeys("i\<c-x>\<c-u>\<Esc>", 'ntx')
1107 assert_equal('aaa', getline(1))
1108
1109 set completefunc=
1110 bwipe!
1111enddef
1112
Bram Moolenaara11919f2021-01-02 19:44:56 +01001113def Test_wincmd()
1114 split
1115 var id1 = win_getid()
1116 if true
1117 try | wincmd w | catch | endtry
1118 endif
1119 assert_notequal(id1, win_getid())
1120 close
Bram Moolenaar1ff89de2021-03-24 20:08:12 +01001121
1122 split
1123 var id = win_getid()
1124 split
1125 :2wincmd o
1126 assert_equal(id, win_getid())
1127 only
1128
1129 split
1130 split
1131 assert_equal(3, winnr('$'))
1132 :2wincmd c
1133 assert_equal(2, winnr('$'))
1134 only
1135
1136 split
1137 split
1138 assert_equal(3, winnr('$'))
1139 :2wincmd q
1140 assert_equal(2, winnr('$'))
1141 only
Bram Moolenaara11919f2021-01-02 19:44:56 +01001142enddef
1143
Bram Moolenaar9567efa2021-01-11 22:16:30 +01001144def Test_windo_missing_endif()
1145 var lines =<< trim END
1146 windo if 1
1147 END
1148 CheckDefExecFailure(lines, 'E171:', 1)
1149enddef
1150
Bram Moolenaarb2cb6c82021-03-28 20:38:34 +02001151let s:theList = [1, 2, 3]
1152
1153def Test_lockvar()
1154 s:theList[1] = 22
1155 assert_equal([1, 22, 3], s:theList)
1156 lockvar s:theList
1157 assert_fails('theList[1] = 77', 'E741:')
1158 unlockvar s:theList
1159 s:theList[1] = 44
1160 assert_equal([1, 44, 3], s:theList)
1161
1162 var lines =<< trim END
1163 vim9script
1164 var theList = [1, 2, 3]
1165 def SetList()
1166 theList[1] = 22
1167 assert_equal([1, 22, 3], theList)
1168 lockvar theList
1169 theList[1] = 77
1170 enddef
1171 SetList()
1172 END
1173 CheckScriptFailure(lines, 'E1119', 4)
1174
1175 lines =<< trim END
1176 var theList = [1, 2, 3]
1177 lockvar theList
1178 END
1179 CheckDefFailure(lines, 'E1178', 2)
1180
1181 lines =<< trim END
1182 var theList = [1, 2, 3]
1183 unlockvar theList
1184 END
1185 CheckDefFailure(lines, 'E1178', 2)
1186enddef
1187
Bram Moolenaar4c137212021-04-19 16:48:48 +02001188def Test_substitute_expr()
1189 var to = 'repl'
1190 new
1191 setline(1, 'one from two')
1192 s/from/\=to
1193 assert_equal('one repl two', getline(1))
1194
1195 setline(1, 'one from two')
1196 s/from/\=to .. '_x'
1197 assert_equal('one repl_x two', getline(1))
1198
1199 setline(1, 'one from two from three')
1200 var also = 'also'
1201 s/from/\=to .. '_' .. also/g#e
1202 assert_equal('one repl_also two repl_also three', getline(1))
1203
Bram Moolenaar8238f082021-04-20 21:10:48 +02001204 setline(1, 'abc abc abc')
1205 for choice in [true, false]
1206 :1s/abc/\=choice ? 'yes' : 'no'/
1207 endfor
1208 assert_equal('yes no abc', getline(1))
1209
Bram Moolenaard386e922021-04-25 14:48:49 +02001210 bwipe!
1211
Bram Moolenaar4c137212021-04-19 16:48:48 +02001212 CheckDefFailure(['s/from/\="x")/'], 'E488:')
1213 CheckDefFailure(['s/from/\="x"/9'], 'E488:')
1214
Bram Moolenaard386e922021-04-25 14:48:49 +02001215 # When calling a function the right instruction list needs to be restored.
Bram Moolenaar5930ddc2021-04-26 20:32:59 +02001216 g:cond = true
Bram Moolenaard386e922021-04-25 14:48:49 +02001217 var lines =<< trim END
1218 vim9script
1219 def Foo()
1220 Bar([])
1221 enddef
1222 def Bar(l: list<number>)
Bram Moolenaar5930ddc2021-04-26 20:32:59 +02001223 if g:cond
Bram Moolenaard386e922021-04-25 14:48:49 +02001224 s/^/\=Rep()/
1225 for n in l[:]
1226 endfor
Bram Moolenaar5930ddc2021-04-26 20:32:59 +02001227 endif
Bram Moolenaard386e922021-04-25 14:48:49 +02001228 enddef
1229 def Rep(): string
1230 return 'rep'
1231 enddef
1232 new
1233 Foo()
1234 assert_equal('rep', getline(1))
1235 bwipe!
1236 END
1237 CheckScriptSuccess(lines)
Bram Moolenaar5930ddc2021-04-26 20:32:59 +02001238 unlet g:cond
Bram Moolenaar27523602021-06-05 21:36:19 +02001239
1240 # List results in multiple lines
1241 new
1242 setline(1, 'some text here')
1243 s/text/\=['aaa', 'bbb', 'ccc']/
1244 assert_equal(['some aaa', 'bbb', 'ccc', ' here'], getline(1, '$'))
1245 bwipe!
Bram Moolenaar4c137212021-04-19 16:48:48 +02001246enddef
1247
Bram Moolenaar2d1c57e2021-04-19 20:50:03 +02001248def Test_redir_to_var()
1249 var result: string
1250 redir => result
1251 echo 'something'
1252 redir END
1253 assert_equal("\nsomething", result)
1254
1255 redir =>> result
1256 echo 'more'
1257 redir END
1258 assert_equal("\nsomething\nmore", result)
1259
Bram Moolenaar753bcf82021-04-21 14:24:24 +02001260 var d: dict<string>
1261 redir => d.redir
1262 echo 'dict'
1263 redir END
1264 assert_equal({redir: "\ndict"}, d)
1265
1266 var l = ['a', 'b', 'c']
1267 redir => l[1]
1268 echo 'list'
1269 redir END
1270 assert_equal(['a', "\nlist", 'c'], l)
1271
1272 var dl = {l: ['x']}
1273 redir => dl.l[0]
1274 echo 'dict-list'
1275 redir END
1276 assert_equal({l: ["\ndict-list"]}, dl)
1277
Bram Moolenaara369c3d2021-04-21 16:00:10 +02001278 redir =>> d.redir
1279 echo 'more'
1280 redir END
1281 assert_equal({redir: "\ndict\nmore"}, d)
1282
Bram Moolenaar2d1c57e2021-04-19 20:50:03 +02001283 var lines =<< trim END
1284 redir => notexist
1285 END
1286 CheckDefFailure(lines, 'E1089:')
Bram Moolenaar753bcf82021-04-21 14:24:24 +02001287
1288 lines =<< trim END
1289 var ls = 'asdf'
1290 redir => ls[1]
1291 redir END
1292 END
1293 CheckDefFailure(lines, 'E1141:')
Bram Moolenaar2d1c57e2021-04-19 20:50:03 +02001294enddef
1295
Bram Moolenaar68db9962021-05-09 23:19:22 +02001296def Test_echo_void()
1297 var lines =<< trim END
1298 vim9script
1299 def NoReturn()
1300 echo 'nothing'
1301 enddef
1302 echo NoReturn()
1303 END
1304 CheckScriptFailure(lines, 'E1186:', 5)
1305
1306 lines =<< trim END
1307 vim9script
1308 def NoReturn()
1309 echo 'nothing'
1310 enddef
1311 def Try()
1312 echo NoReturn()
1313 enddef
1314 defcompile
1315 END
1316 CheckScriptFailure(lines, 'E1186:', 1)
1317enddef
1318
Bram Moolenaarb2cb6c82021-03-28 20:38:34 +02001319
Bram Moolenaarcfe435d2020-04-25 20:02:55 +02001320" vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker