comparison src/testdir/test_vim9_func.vim @ 22318:3f5f96a8dd83 v8.2.1708

patch 8.2.1708: Vim9: error message for function has unpritable characters Commit: https://github.com/vim/vim/commit/b185a4074515f576b420cfc7a5a07f840cf6b51f Author: Bram Moolenaar <Bram@vim.org> Date: Fri Sep 18 22:42:00 2020 +0200 patch 8.2.1708: Vim9: error message for function has unpritable characters Problem: Vim9: error message for function has unpritable characters. Solution: use printable_func_name(). (closes https://github.com/vim/vim/issues/6965)
author Bram Moolenaar <Bram@vim.org>
date Fri, 18 Sep 2020 22:45:04 +0200
parents 41e118669df3
children 56f674e7518c
comparison
equal deleted inserted replaced
22317:f75c88539e94 22318:3f5f96a8dd83
278 echo s 278 echo s
279 enddef 279 enddef
280 Func([]) 280 Func([])
281 END 281 END
282 CheckScriptFailure(lines, 'E1013: Argument 1: type mismatch, expected string but got list<unknown>', 5) 282 CheckScriptFailure(lines, 'E1013: Argument 1: type mismatch, expected string but got list<unknown>', 5)
283
284 lines =<< trim END
285 vim9script
286 def FuncOne(nr: number)
287 echo nr
288 enddef
289 def FuncTwo()
290 FuncOne()
291 enddef
292 defcompile
293 END
294 writefile(lines, 'Xscript')
295 let didCatch = false
296 try
297 source Xscript
298 catch
299 assert_match('E119: Not enough arguments for function: <SNR>\d\+_FuncOne', v:exception)
300 assert_match('Xscript\[8\]..function <SNR>\d\+_FuncTwo, line 1', v:throwpoint)
301 didCatch = true
302 endtry
303 assert_true(didCatch)
304
305 lines =<< trim END
306 vim9script
307 def FuncOne(nr: number)
308 echo nr
309 enddef
310 def FuncTwo()
311 FuncOne(1, 2)
312 enddef
313 defcompile
314 END
315 writefile(lines, 'Xscript')
316 didCatch = false
317 try
318 source Xscript
319 catch
320 assert_match('E118: Too many arguments for function: <SNR>\d\+_FuncOne', v:exception)
321 assert_match('Xscript\[8\]..function <SNR>\d\+_FuncTwo, line 1', v:throwpoint)
322 didCatch = true
323 endtry
324 assert_true(didCatch)
325
326 delete('Xscript')
283 enddef 327 enddef
284 328
285 " Default arg and varargs 329 " Default arg and varargs
286 def MyDefVarargs(one: string, two = 'foo', ...rest: list<string>): string 330 def MyDefVarargs(one: string, two = 'foo', ...rest: list<string>): string
287 let res = one .. ',' .. two 331 let res = one .. ',' .. two