aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-11-18 22:26:39 +0800
committerzeertzjq <zeertzjq@outlook.com>2022-11-18 22:30:47 +0800
commitfdeb20ddde627ea99521a2c4c1525a91ffcd763c (patch)
tree7ff0704aba06eaf8c08e7b676feff806c4afc197
parent88d0d7ad10781d51d496aa194dca972e8ba145e1 (diff)
downloadrneovim-fdeb20ddde627ea99521a2c4c1525a91ffcd763c.tar.gz
rneovim-fdeb20ddde627ea99521a2c4c1525a91ffcd763c.tar.bz2
rneovim-fdeb20ddde627ea99521a2c4c1525a91ffcd763c.zip
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) https://github.com/vim/vim/commit/7d941ee032c02a4b682201881eb5c1f1958f17ee
-rw-r--r--src/nvim/testdir/test_method.vim18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/nvim/testdir/test_method.vim b/src/nvim/testdir/test_method.vim
index 057f4a1bea..ca3b736429 100644
--- a/src/nvim/testdir/test_method.vim
+++ b/src/nvim/testdir/test_method.vim
@@ -153,6 +153,22 @@ endfunc
func Test_method_not_supported()
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
-" 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