diff src/vim9execute.c @ 27756:60ac4228a73d v8.2.4404

patch 8.2.4404: Vim9: some code not covered by tests Commit: https://github.com/vim/vim/commit/cd1cda2f877aab5ec954e14bcba59076533529a4 Author: Bram Moolenaar <Bram@vim.org> Date: Wed Feb 16 21:48:25 2022 +0000 patch 8.2.4404: Vim9: some code not covered by tests Problem: Vim9: some code not covered by tests. Solution: Add a few specific test cases.
author Bram Moolenaar <Bram@vim.org>
date Wed, 16 Feb 2022 23:00:03 +0100
parents a6ffe874a24b
children 3196066c5795
line wrap: on
line diff
--- a/src/vim9execute.c
+++ b/src/vim9execute.c
@@ -367,6 +367,16 @@ call_dfunc(
 	    semsg(_(e_nr_arguments_too_many), -arg_to_add);
 	return FAIL;
     }
+    else if (arg_to_add > ufunc->uf_def_args.ga_len)
+    {
+	int missing = arg_to_add - ufunc->uf_def_args.ga_len;
+
+	if (missing == 1)
+	    emsg(_(e_one_argument_too_few));
+	else
+	    semsg(_(e_nr_arguments_too_few), missing);
+	return FAIL;
+    }
 
     // Reserve space for:
     // - missing arguments