forked from aniani/vim
patch 8.2.2264: Vim9: no error for mismatched :endfunc or :enddef
Problem: Vim9: no error for mismatched :endfunc or :enddef. Solution: Check for the mismatch. (issue #7582)
This commit is contained in:
@@ -79,6 +79,25 @@ def Test_funcdepth_error()
|
||||
set maxfuncdepth&
|
||||
enddef
|
||||
|
||||
def Test_endfunc_enddef()
|
||||
var lines =<< trim END
|
||||
def Test()
|
||||
echo 'test'
|
||||
endfunc
|
||||
enddef
|
||||
END
|
||||
CheckScriptFailure(lines, 'E1151:', 3)
|
||||
|
||||
lines =<< trim END
|
||||
def Test()
|
||||
func Nested()
|
||||
echo 'test'
|
||||
enddef
|
||||
enddef
|
||||
END
|
||||
CheckScriptFailure(lines, 'E1152:', 4)
|
||||
enddef
|
||||
|
||||
def ReturnString(): string
|
||||
return 'string'
|
||||
enddef
|
||||
|
||||
Reference in New Issue
Block a user