Mercurial > vim
comparison src/testdir/test_vim9_func.vim @ 22973:4c97c0747017 v8.2.2033
patch 8.2.2033: Vim9: :def without argument gives compilation error
Commit: https://github.com/vim/vim/commit/6abdcf82859e158713a3d5aa6b1012748ea5c2a0
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Nov 22 18:15:44 2020 +0100
patch 8.2.2033: Vim9: :def without argument gives compilation error
Problem: Vim9: :def without argument gives compilation error.
Solution: Add the DEF instruction. (closes https://github.com/vim/vim/issues/7344)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 22 Nov 2020 18:30:05 +0100 |
parents | dcb59b1cc0c1 |
children | 1fa84623fc68 |
comparison
equal
deleted
inserted
replaced
22972:d2b36acb42dd | 22973:4c97c0747017 |
---|---|
286 defcompile | 286 defcompile |
287 END | 287 END |
288 CheckScriptFailure(lines, "E1073:") | 288 CheckScriptFailure(lines, "E1073:") |
289 enddef | 289 enddef |
290 | 290 |
291 def DefListAll() | |
292 def | |
293 enddef | |
294 | |
295 def DefListOne() | |
296 def DefListOne | |
297 enddef | |
298 | |
299 def DefListMatches() | |
300 def /DefList | |
301 enddef | |
302 | |
303 def Test_nested_def_list() | |
304 var funcs = split(execute('call DefListAll()'), "\n") | |
305 assert_true(len(funcs) > 10) | |
306 assert_true(funcs->index('def DefListAll()') >= 0) | |
307 | |
308 funcs = split(execute('call DefListOne()'), "\n") | |
309 assert_equal([' def DefListOne()', '1 def DefListOne', ' enddef'], funcs) | |
310 | |
311 funcs = split(execute('call DefListMatches()'), "\n") | |
312 assert_true(len(funcs) >= 3) | |
313 assert_true(funcs->index('def DefListAll()') >= 0) | |
314 assert_true(funcs->index('def DefListOne()') >= 0) | |
315 assert_true(funcs->index('def DefListMatches()') >= 0) | |
316 enddef | |
317 | |
291 def Test_global_local_function() | 318 def Test_global_local_function() |
292 var lines =<< trim END | 319 var lines =<< trim END |
293 vim9script | 320 vim9script |
294 def g:Func(): string | 321 def g:Func(): string |
295 return 'global' | 322 return 'global' |