Mercurial > vim
diff src/testdir/test_vim9_expr.vim @ 19437:5d34ae66118e v8.2.0276
patch 8.2.0276: Vim9: not allowing space before ")" in function call
Commit: https://github.com/vim/vim/commit/38a5f517a70d7b76361152d2898d7f826c5b2491
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Feb 19 12:40:39 2020 +0100
patch 8.2.0276: Vim9: not allowing space before ")" in function call
Problem: Vim9: not allowing space before ")" in function call is too
restrictive. (Ben Jackson)
Solution: Skip space before the ")". Adjust other space checks.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 19 Feb 2020 12:45:04 +0100 |
parents | f3e8e74cb747 |
children | f8408ba21982 |
line wrap: on
line diff
--- a/src/testdir/test_vim9_expr.vim +++ b/src/testdir/test_vim9_expr.vim @@ -9,6 +9,14 @@ func CheckDefFailure(line, error) call delete('Xdef') endfunc +" Check that "line" inside ":def" results in an "error" message when executed. +func CheckDefExecFailure(line, error) + call writefile(['def! Func()', a:line, 'enddef'], 'Xdef') + so Xdef + call assert_fails('call Func()', a:error, a:line) + call delete('Xdef') +endfunc + func CheckDefFailureList(lines, error) call writefile(['def! Func()'] + a:lines + ['enddef'], 'Xdef') call assert_fails('so Xdef', a:error, string(a:lines)) @@ -725,9 +733,17 @@ func CallMe(arg) return a:arg endfunc +func CallMe2(one, two) + return a:one .. a:two +endfunc + def Test_expr7_trailing() " user function call assert_equal(123, CallMe(123)) + assert_equal(123, CallMe( 123)) + assert_equal(123, CallMe(123 )) + assert_equal('yesno', CallMe2('yes', 'no')) + assert_equal('yesno', CallMe2( 'yes', 'no' )) assert_equal('nothing', CallMe('nothing')) " partial call @@ -761,4 +777,8 @@ endfunc func Test_expr_fails() call CheckDefFailure("let x = '1'is2", 'E488:') call CheckDefFailure("let x = '1'isnot2", 'E488:') + + call CheckDefExecFailure("CallMe ('yes')", 'E492:') + call CheckDefFailure("CallMe2('yes','no')", 'E1069:') + call CheckDefFailure("CallMe2('yes' , 'no')", 'E1068:') endfunc