mirror of
https://github.com/neovim/neovim.git
synced 2025-09-06 19:38:20 +00:00
vim-patch:partial: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 vim/vim#8245)
611728f806
Only port the last two hunks of test_user_func.vim.
Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
This commit is contained in:
@@ -420,6 +420,11 @@ func Test_del_func()
|
|||||||
call assert_fails('delfunction Xabc', 'E130:')
|
call assert_fails('delfunction Xabc', 'E130:')
|
||||||
let d = {'a' : 10}
|
let d = {'a' : 10}
|
||||||
call assert_fails('delfunc d.a', 'E718:')
|
call assert_fails('delfunc d.a', 'E718:')
|
||||||
|
func d.fn()
|
||||||
|
return 1
|
||||||
|
endfunc
|
||||||
|
delfunc d.fn
|
||||||
|
call assert_equal({'a' : 10}, d)
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
" Test for calling return outside of a function
|
" Test for calling return outside of a function
|
||||||
@@ -451,11 +456,12 @@ func Test_func_dict()
|
|||||||
return len(self)
|
return len(self)
|
||||||
endfunc
|
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_equal(2, mydict.somefunc())
|
||||||
call assert_match("^\n function \\d\\\+() dict"
|
call assert_match("^\n function \\d\\\+() dict"
|
||||||
\ .. "\n1 return len(self)"
|
\ .. "\n1 return len(self)"
|
||||||
\ .. "\n endfunction$", execute('func mydict.somefunc'))
|
\ .. "\n endfunction$", execute('func mydict.somefunc'))
|
||||||
|
call assert_fails('call mydict.nonexist()', 'E716:')
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_func_range()
|
func Test_func_range()
|
||||||
|
Reference in New Issue
Block a user