1
0
forked from aniani/vim

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 #8245)
This commit is contained in:
Yegappan Lakshmanan
2021-05-24 15:15:47 +02:00
committed by Bram Moolenaar
parent ad5c178a19
commit 611728f806
8 changed files with 49 additions and 2 deletions

View File

@@ -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()