comparison src/testdir/test_method.vim @ 19787:906269bf83d5 v8.2.0450

patch 8.2.0450: not enough testing for restricted mode and function calls Commit: https://github.com/vim/vim/commit/7d941ee032c02a4b682201881eb5c1f1958f17ee Author: Bram Moolenaar <Bram@vim.org> Date: Thu Mar 26 14:11:58 2020 +0100 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 https://github.com/vim/vim/issues/5847)
author Bram Moolenaar <Bram@vim.org>
date Thu, 26 Mar 2020 14:15:04 +0100
parents b3e93a05c3ca
children 6a4806e326dd
comparison
equal deleted inserted replaced
19786:ae9edaa6f0f5 19787:906269bf83d5
150 call assert_equal(1, test_refcount(l)) 150 call assert_equal(1, test_refcount(l))
151 endfunc 151 endfunc
152 152
153 func Test_method_not_supported() 153 func Test_method_not_supported()
154 call assert_fails('eval 123->changenr()', 'E276:') 154 call assert_fails('eval 123->changenr()', 'E276:')
155 call assert_fails('echo "abc"->invalidfunc()', 'E117:')
156 " Test for too many or too few arguments to a method
157 call assert_fails('let n="abc"->len(2)', 'E118:')
158 call assert_fails('let n=10->setwinvar()', 'E119:')
155 endfunc 159 endfunc
156 160
157 " vim: shiftwidth=2 sts=2 expandtab 161 " Test for passing optional arguments to methods
162 func Test_method_args()
163 let v:errors = []
164 let n = 10->assert_inrange(1, 5, "Test_assert_inrange")
165 if v:errors[0] !~ 'Test_assert_inrange'
166 call assert_report(v:errors[0])
167 else
168 " Test passed
169 let v:errors = []
170 endif
171 endfunc
172
173 " vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker