Mercurial > vim
comparison src/testdir/test_vim9_cmd.vim @ 24124:f4061617c438 v8.2.2603
patch 8.2.2603: Vim9: no effect if user command is also a function
Commit: https://github.com/vim/vim/commit/77b10ffad4ebad15022614be4db2745f6a90f405
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Mar 14 13:21:35 2021 +0100
patch 8.2.2603: Vim9: no effect if user command is also a function
Problem: Vim9: no effect if user command is also a function.
Solution: Check for paren following. (closes https://github.com/vim/vim/issues/7960)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 14 Mar 2021 13:30:03 +0100 |
parents | 780dec2ffa6b |
children | 77cb22562852 |
comparison
equal
deleted
inserted
replaced
24123:d97cddd9f357 | 24124:f4061617c438 |
---|---|
362 enddef | 362 enddef |
363 def Bar(F: func): string | 363 def Bar(F: func): string |
364 return F() | 364 return F() |
365 enddef | 365 enddef |
366 def Test() | 366 def Test() |
367 Foo | 367 Foo ->Bar() |
368 ->Bar() | 368 ->setline(1) |
369 ->setline(1) | |
370 enddef | 369 enddef |
371 Test() | 370 Test() |
372 assert_equal('the text', getline(1)) | 371 assert_equal('the text', getline(1)) |
373 bwipe! | 372 bwipe! |
374 END | 373 END |
399 | 398 |
400 def Bar(F: func): string | 399 def Bar(F: func): string |
401 return F() | 400 return F() |
402 enddef | 401 enddef |
403 | 402 |
404 Foo | 403 Foo->Bar() |
405 ->Bar() | |
406 ->setline(1) | 404 ->setline(1) |
407 END | 405 END |
408 CheckScriptSuccess(lines) | 406 CheckScriptSuccess(lines) |
409 assert_equal('# some text', getline(1)) | 407 assert_equal('# some text', getline(1)) |
410 bwipe! | 408 bwipe! |
420 yank -> setline(4) | 418 yank -> setline(4) |
421 assert_equal(['text', 'text', 'text', 'text'], getline(1, 4)) | 419 assert_equal(['text', 'text', 'text', 'text'], getline(1, 4)) |
422 bwipe! | 420 bwipe! |
423 END | 421 END |
424 CheckDefAndScriptSuccess(lines) | 422 CheckDefAndScriptSuccess(lines) |
423 enddef | |
424 | |
425 def Test_method_and_user_command() | |
426 var lines =<< trim END | |
427 vim9script | |
428 def Cmd() | |
429 g:didFunc = 1 | |
430 enddef | |
431 command Cmd g:didCmd = 1 | |
432 Cmd | |
433 assert_equal(1, g:didCmd) | |
434 Cmd() | |
435 assert_equal(1, g:didFunc) | |
436 unlet g:didFunc | |
437 unlet g:didCmd | |
438 | |
439 def InDefFunc() | |
440 Cmd | |
441 assert_equal(1, g:didCmd) | |
442 Cmd() | |
443 assert_equal(1, g:didFunc) | |
444 unlet g:didFunc | |
445 unlet g:didCmd | |
446 enddef | |
447 InDefFunc() | |
448 END | |
449 CheckScriptSuccess(lines) | |
425 enddef | 450 enddef |
426 | 451 |
427 def Test_skipped_expr_linebreak() | 452 def Test_skipped_expr_linebreak() |
428 if 0 | 453 if 0 |
429 var x = [] | 454 var x = [] |