Mercurial > vim
diff 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 |
line wrap: on
line diff
--- a/src/testdir/test_vim9_func.vim +++ b/src/testdir/test_vim9_func.vim @@ -288,6 +288,33 @@ def Test_nested_global_function() CheckScriptFailure(lines, "E1073:") enddef +def DefListAll() + def +enddef + +def DefListOne() + def DefListOne +enddef + +def DefListMatches() + def /DefList +enddef + +def Test_nested_def_list() + var funcs = split(execute('call DefListAll()'), "\n") + assert_true(len(funcs) > 10) + assert_true(funcs->index('def DefListAll()') >= 0) + + funcs = split(execute('call DefListOne()'), "\n") + assert_equal([' def DefListOne()', '1 def DefListOne', ' enddef'], funcs) + + funcs = split(execute('call DefListMatches()'), "\n") + assert_true(len(funcs) >= 3) + assert_true(funcs->index('def DefListAll()') >= 0) + assert_true(funcs->index('def DefListOne()') >= 0) + assert_true(funcs->index('def DefListMatches()') >= 0) +enddef + def Test_global_local_function() var lines =<< trim END vim9script