1
0
forked from aniani/vim

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 #7344)
This commit is contained in:
Bram Moolenaar
2020-11-22 18:15:44 +01:00
parent dcbab75db3
commit 6abdcf8285
9 changed files with 127 additions and 9 deletions

View File

@@ -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