Mercurial > vim
comparison src/testdir/test_vim9_script.vim @ 19862:846fbbacce3a v8.2.0487
patch 8.2.0487: Vim9: compiling not sufficiently tested
Commit: https://github.com/vim/vim/commit/bd5da371aafe5a2207065643502f4d1ff6b286c7
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Mar 31 23:13:10 2020 +0200
patch 8.2.0487: Vim9: compiling not sufficiently tested
Problem: Vim9: compiling not sufficiently tested.
Solution: Add more tests. Fix bug with PCALL.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Tue, 31 Mar 2020 23:15:04 +0200 |
parents | 37c4779ca8f5 |
children | 8a7bede7b138 |
comparison
equal
deleted
inserted
replaced
19861:e517915a786d | 19862:846fbbacce3a |
---|---|
258 | 258 |
259 func TakesOneArg(arg) | 259 func TakesOneArg(arg) |
260 echo a:arg | 260 echo a:arg |
261 endfunc | 261 endfunc |
262 | 262 |
263 def Test_call_wrong_arg_count() | 263 def Test_call_wrong_args() |
264 call CheckDefFailure(['TakesOneArg()'], 'E119:') | 264 call CheckDefFailure(['TakesOneArg()'], 'E119:') |
265 call CheckDefFailure(['TakesOneArg(11, 22)'], 'E118:') | 265 call CheckDefFailure(['TakesOneArg(11, 22)'], 'E118:') |
266 call CheckDefFailure(['bufnr(xxx)'], 'E1001:') | |
266 enddef | 267 enddef |
267 | 268 |
268 " Default arg and varargs | 269 " Default arg and varargs |
269 def MyDefVarargs(one: string, two = 'foo', ...rest: list<string>): string | 270 def MyDefVarargs(one: string, two = 'foo', ...rest: list<string>): string |
270 let res = one .. ',' .. two | 271 let res = one .. ',' .. two |
1027 result ..= cnt .. '_' | 1028 result ..= cnt .. '_' |
1028 endwhile | 1029 endwhile |
1029 assert_equal('1_3_', result) | 1030 assert_equal('1_3_', result) |
1030 enddef | 1031 enddef |
1031 | 1032 |
1033 def Test_for_loop_fails() | |
1034 call CheckDefFailure(['for # in range(5)'], 'E690:') | |
1035 call CheckDefFailure(['for i In range(5)'], 'E690:') | |
1036 call CheckDefFailure(['let x = 5', 'for x in range(5)'], 'E1023:') | |
1037 call CheckScriptFailure(['def Func(arg)', 'for arg in range(5)', 'enddef'], 'E1006:') | |
1038 call CheckDefFailure(['for i in "text"'], 'E1024:') | |
1039 enddef | |
1040 | |
1032 def Test_interrupt_loop() | 1041 def Test_interrupt_loop() |
1033 let caught = false | 1042 let caught = false |
1034 let x = 0 | 1043 let x = 0 |
1035 try | 1044 try |
1036 while 1 | 1045 while 1 |