0
0
mirror of https://github.com/vim/vim.git synced 2025-09-26 04:04:07 -04:00

patch 8.1.1821: no test for wrong number of method arguments

Problem:    No test for wrong number of method arguments.
Solution:   Add a test.
This commit is contained in:
Bram Moolenaar
2019-08-06 20:34:10 +02:00
parent 761fdf01c6
commit f97d46f816
2 changed files with 12 additions and 0 deletions

View File

@@ -97,8 +97,18 @@ func Test_method_funcref()
let FuncRef = function('Concat') let FuncRef = function('Concat')
eval 'foo'->FuncRef('bar', 'tail')->assert_equal('foobartail') eval 'foo'->FuncRef('bar', 'tail')->assert_equal('foobartail')
" not enough arguments
call assert_fails("eval 'foo'->FuncRef('bar')", 'E119:')
" too many arguments
call assert_fails("eval 'foo'->FuncRef('bar', 'tail', 'four')", 'E118:')
let Partial = function('Concat', ['two']) let Partial = function('Concat', ['two'])
eval 'one'->Partial('three')->assert_equal('onetwothree') eval 'one'->Partial('three')->assert_equal('onetwothree')
" not enough arguments
call assert_fails("eval 'one'->Partial()", 'E119:')
" too many arguments
call assert_fails("eval 'one'->Partial('three', 'four')", 'E118:')
delfunc Concat delfunc Concat
endfunc endfunc

View File

@@ -773,6 +773,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
1821,
/**/ /**/
1820, 1820,
/**/ /**/