diff options
| author | zeertzjq <zeertzjq@outlook.com> | 2022-10-27 08:56:48 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-10-27 08:56:48 +0800 |
| commit | bce6891a69c6de3657173b880d3a800dc94cc651 (patch) | |
| tree | 7622a4d9d73b918660bd9c8e762fd09790fae28e /src/nvim/testdir/test_user_func.vim | |
| parent | 23204c83ed5333811192513ed9f61d70682fbee5 (diff) | |
| parent | 905bef7bd9cd5d1751fc09aad3c6fb78e2c60ff8 (diff) | |
| download | rneovim-bce6891a69c6de3657173b880d3a800dc94cc651.tar.gz rneovim-bce6891a69c6de3657173b880d3a800dc94cc651.tar.bz2 rneovim-bce6891a69c6de3657173b880d3a800dc94cc651.zip | |
Merge pull request #20823 from zeertzjq/vim-8.2.2100
vim-patch:8.2.{2100,2726,2727}
Diffstat (limited to 'src/nvim/testdir/test_user_func.vim')
| -rw-r--r-- | src/nvim/testdir/test_user_func.vim | 36 |
1 files changed, 34 insertions, 2 deletions
diff --git a/src/nvim/testdir/test_user_func.vim b/src/nvim/testdir/test_user_func.vim index 8b5ee72bf1..01bf2e1d0f 100644 --- a/src/nvim/testdir/test_user_func.vim +++ b/src/nvim/testdir/test_user_func.vim @@ -149,8 +149,8 @@ func Test_default_arg() call assert_equal(res.optional, 2) call assert_equal(res['0'], 1) - call assert_fails("call MakeBadFunc()", 'E989') - call assert_fails("fu F(a=1 ,) | endf", 'E475') + call assert_fails("call MakeBadFunc()", 'E989:') + call assert_fails("fu F(a=1 ,) | endf", 'E1068:') " Since neovim does not have v:none, the ability to use the default " argument with the intermediate argument set to v:none has been omitted. @@ -445,4 +445,36 @@ func Test_func_arg_error() delfunc Xfunc endfunc +func Test_func_dict() + let mydict = {'a': 'b'} + function mydict.somefunc() dict + return len(self) + endfunc + + call assert_equal("{'a': 'b', 'somefunc': function('2')}", string(mydict)) + call assert_equal(2, mydict.somefunc()) + call assert_match("^\n function \\d\\\+() dict" + \ .. "\n1 return len(self)" + \ .. "\n endfunction$", execute('func mydict.somefunc')) +endfunc + +func Test_func_range() + new + call setline(1, range(1, 8)) + func FuncRange() range + echo a:firstline + echo a:lastline + endfunc + 3 + call assert_equal("\n3\n3", execute('call FuncRange()')) + call assert_equal("\n4\n6", execute('4,6 call FuncRange()')) + call assert_equal("\n function FuncRange() range" + \ .. "\n1 echo a:firstline" + \ .. "\n2 echo a:lastline" + \ .. "\n endfunction", + \ execute('function FuncRange')) + + bwipe! +endfunc + " vim: shiftwidth=2 sts=2 expandtab |