diff options
author | Bram Moolenaar <Bram@vim.org> | 2020-09-18 22:42:00 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2020-09-18 22:42:00 +0200 |
commit | b185a4074515f576b420cfc7a5a07f840cf6b51f (patch) | |
tree | e282afc4297490873aa89ef1bfea9b5b394e6b9e /src/testdir | |
parent | 2bbada811625ee53c7bcdf689dbf409e9975ea8f (diff) | |
download | vim-git-b185a4074515f576b420cfc7a5a07f840cf6b51f.tar.gz |
patch 8.2.1708: Vim9: error message for function has unpritable charactersv8.2.1708
Problem: Vim9: error message for function has unpritable characters.
Solution: use printable_func_name(). (closes #6965)
Diffstat (limited to 'src/testdir')
-rw-r--r-- | src/testdir/test_vim9_func.vim | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/src/testdir/test_vim9_func.vim b/src/testdir/test_vim9_func.vim index 8c2349c34..fe7bf69b8 100644 --- a/src/testdir/test_vim9_func.vim +++ b/src/testdir/test_vim9_func.vim @@ -280,6 +280,50 @@ def Test_call_wrong_args() Func([]) END CheckScriptFailure(lines, 'E1013: Argument 1: type mismatch, expected string but got list<unknown>', 5) + + lines =<< trim END + vim9script + def FuncOne(nr: number) + echo nr + enddef + def FuncTwo() + FuncOne() + enddef + defcompile + END + writefile(lines, 'Xscript') + let didCatch = false + try + source Xscript + catch + assert_match('E119: Not enough arguments for function: <SNR>\d\+_FuncOne', v:exception) + assert_match('Xscript\[8\]..function <SNR>\d\+_FuncTwo, line 1', v:throwpoint) + didCatch = true + endtry + assert_true(didCatch) + + lines =<< trim END + vim9script + def FuncOne(nr: number) + echo nr + enddef + def FuncTwo() + FuncOne(1, 2) + enddef + defcompile + END + writefile(lines, 'Xscript') + didCatch = false + try + source Xscript + catch + assert_match('E118: Too many arguments for function: <SNR>\d\+_FuncOne', v:exception) + assert_match('Xscript\[8\]..function <SNR>\d\+_FuncTwo, line 1', v:throwpoint) + didCatch = true + endtry + assert_true(didCatch) + + delete('Xscript') enddef " Default arg and varargs |