Patch 8.2.1797 Problem: Vim9: some parts of the code not tested. Solution: Add a few tests. Files: src/testdir/test_vim9_func.vim
*** ../vim-8.2.1796/src/testdir/test_vim9_func.vim 2020-10-04 13:42:30.299568231 +0200 --- src/testdir/test_vim9_func.vim 2020-10-04 14:13:18.673865650 +0200 *************** *** 1056,1061 **** --- 1056,1063 ---- CheckDefFailure(['var RefAny: func(): any', 'RefAny = FuncNoArgNoRet'], 'E1012: Type mismatch; expected func(): any but got func()') CheckDefFailure(['var RefAny: func(): any', 'RefAny = FuncOneArgNoRet'], 'E1012: Type mismatch; expected func(): any but got func(number)') + var RefAnyNoArgs: func: any = RefAny + var RefNr: func: number RefNr = FuncNoArgRetNumber RefNr = FuncOneArgRetNumber *************** *** 1100,1105 **** --- 1102,1123 ---- CheckDefFailure(['var str: string', 'str = FuncNoArgRetNumber()'], 'E1012: Type mismatch; expected string but got number') enddef + def Test_func_common_type() + def FuncOne(n: number): number + return n + enddef + def FuncTwo(s: string): number + return len(s) + enddef + def FuncThree(n: number, s: string): number + return n + len(s) + enddef + var list = [FuncOne, FuncTwo, FuncThree] + assert_equal(8, list[0](8)) + assert_equal(4, list[1]('word')) + assert_equal(7, list[2](3, 'word')) + enddef + def MultiLine( arg1: string, arg2 = 1234, *************** *** 1948,1953 **** --- 1966,1974 ---- Xsetlist = function('setqflist', [[], ' ']) Xsetlist({'title': 'test'}) getqflist({'title': 1})->assert_equal({'title': 'test'}) + + var Len: func: number = function('len', ['word']) + assert_equal(4, Len()) enddef def Test_cmd_modifier() *** ../vim-8.2.1796/src/version.c 2020-10-04 13:42:30.299568231 +0200 --- src/version.c 2020-10-04 14:17:09.881404502 +0200 *************** *** 752,753 **** --- 752,755 ---- { /* Add new patch number below this line */ + /**/ + 1797, /**/ -- Time is an illusion. Lunchtime doubly so. -- Ford Prefect, in Douglas Adams' "The Hitchhiker's Guide to the Galaxy" /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org /// -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_dev/202010041218.094CI0l92099153%40masaka.moolenaar.net.