changeset 17648:511a03fcdc78 v8.1.1821

patch 8.1.1821: no test for wrong number of method arguments commit https://github.com/vim/vim/commit/f97d46f816e84edb6899a903a1c334a50a6d31bb Author: Bram Moolenaar <Bram@vim.org> Date: Tue Aug 6 20:34:10 2019 +0200 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.
author Bram Moolenaar <Bram@vim.org>
date Tue, 06 Aug 2019 20:45:06 +0200
parents a944c60c3ef6
children 221733de15e7
files src/testdir/test_method.vim src/version.c
diffstat 2 files changed, 12 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/testdir/test_method.vim
+++ b/src/testdir/test_method.vim
@@ -97,8 +97,18 @@ func Test_method_funcref()
   let FuncRef = function('Concat')
   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'])
   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
 endfunc
--- a/src/version.c
+++ b/src/version.c
@@ -774,6 +774,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    1821,
+/**/
     1820,
 /**/
     1819,