Mercurial > vim
diff 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 |
line wrap: on
line diff
--- a/src/testdir/test_vim9_cmd.vim +++ b/src/testdir/test_vim9_cmd.vim @@ -364,9 +364,8 @@ def Test_method_call_linebreak() return F() enddef def Test() - Foo - ->Bar() - ->setline(1) + Foo ->Bar() + ->setline(1) enddef Test() assert_equal('the text', getline(1)) @@ -401,8 +400,7 @@ def Test_method_call_linebreak() return F() enddef - Foo - ->Bar() + Foo->Bar() ->setline(1) END CheckScriptSuccess(lines) @@ -424,6 +422,33 @@ def Test_method_call_whitespace() CheckDefAndScriptSuccess(lines) enddef +def Test_method_and_user_command() + var lines =<< trim END + vim9script + def Cmd() + g:didFunc = 1 + enddef + command Cmd g:didCmd = 1 + Cmd + assert_equal(1, g:didCmd) + Cmd() + assert_equal(1, g:didFunc) + unlet g:didFunc + unlet g:didCmd + + def InDefFunc() + Cmd + assert_equal(1, g:didCmd) + Cmd() + assert_equal(1, g:didFunc) + unlet g:didFunc + unlet g:didCmd + enddef + InDefFunc() + END + CheckScriptSuccess(lines) +enddef + def Test_skipped_expr_linebreak() if 0 var x = []