mirror of
https://github.com/neovim/neovim.git
synced 2025-09-07 20:08:17 +00:00
vim-patch:8.2.0450: not enough testing for restricted mode and function calls
Problem: Not enough testing for restricted mode and function calls.
Solution: Add more tests. (Yegappan Lakshmanan, closes vim/vim#5847)
7d941ee032
This commit is contained in:
@@ -153,6 +153,22 @@ endfunc
|
|||||||
|
|
||||||
func Test_method_not_supported()
|
func Test_method_not_supported()
|
||||||
call assert_fails('eval 123->changenr()', 'E276:')
|
call assert_fails('eval 123->changenr()', 'E276:')
|
||||||
|
call assert_fails('echo "abc"->invalidfunc()', 'E117:')
|
||||||
|
" Test for too many or too few arguments to a method
|
||||||
|
call assert_fails('let n="abc"->len(2)', 'E118:')
|
||||||
|
call assert_fails('let n=10->setwinvar()', 'E119:')
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
" vim: shiftwidth=2 sts=2 expandtab
|
" Test for passing optional arguments to methods
|
||||||
|
func Test_method_args()
|
||||||
|
let v:errors = []
|
||||||
|
let n = 10->assert_inrange(1, 5, "Test_assert_inrange")
|
||||||
|
if v:errors[0] !~ 'Test_assert_inrange'
|
||||||
|
call assert_report(v:errors[0])
|
||||||
|
else
|
||||||
|
" Test passed
|
||||||
|
let v:errors = []
|
||||||
|
endif
|
||||||
|
endfunc
|
||||||
|
|
||||||
|
" vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker
|
||||||
|
Reference in New Issue
Block a user