Mercurial > vim
diff src/testdir/test_user_func.vim @ 24685:04205b7d67d5 v8.2.2881
patch 8.2.2881: various pieces of code not covered by tests
Commit: https://github.com/vim/vim/commit/611728f80604dd56960e8c197e5749d203c8feb1
Author: Yegappan Lakshmanan <yegappan@yahoo.com>
Date: Mon May 24 15:15:47 2021 +0200
patch 8.2.2881: various pieces of code not covered by tests
Problem: Various pieces of code not covered by tests.
Solution: Add a few more tests. (Yegappan Lakshmanan, closes https://github.com/vim/vim/issues/8245)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Mon, 24 May 2021 15:30:03 +0200 |
parents | da8b8a320bb3 |
children | 13efbfc53054 |
line wrap: on
line diff
--- a/src/testdir/test_user_func.vim +++ b/src/testdir/test_user_func.vim @@ -405,6 +405,7 @@ func Test_func_def_error() let l = join(lines, "\n") . "\n" exe l call assert_fails('exe l', 'E717:') + call assert_fails('call feedkeys(":func d.F1()\<CR>", "xt")', 'E717:') " Define an autoload function with an incorrect file name call writefile(['func foo#Bar()', 'return 1', 'endfunc'], 'Xscript') @@ -420,6 +421,11 @@ func Test_del_func() call assert_fails('delfunction Xabc', 'E130:') let d = {'a' : 10} call assert_fails('delfunc d.a', 'E718:') + func d.fn() + return 1 + endfunc + delfunc d.fn + call assert_equal({'a' : 10}, d) endfunc " Test for calling return outside of a function @@ -451,11 +457,12 @@ func Test_func_dict() return len(self) endfunc - call assert_equal("{'a': 'b', 'somefunc': function('2')}", string(mydict)) + call assert_equal("{'a': 'b', 'somefunc': function('3')}", 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')) + call assert_fails('call mydict.nonexist()', 'E716:') endfunc func Test_func_range()