patch 8.2.3924: Vim9: no error if something follows :enddef
Problem: Vim9: no error if something follows :enddef in a nested function.
Solution: Give an error. Move common code to a function.
diff --git a/src/testdir/test_vim9_func.vim b/src/testdir/test_vim9_func.vim
index 88c0af8..7a5f0f1 100644
--- a/src/testdir/test_vim9_func.vim
+++ b/src/testdir/test_vim9_func.vim
@@ -1686,7 +1686,7 @@
# Compile all functions
defcompile
END
- CheckScriptFailure(lines, 'E476: Invalid command: AAAAA')
+ CheckScriptFailure(lines, 'E1173: Text found after enddef: BBBB')
enddef
def Test_nested_function_with_args_split()
@@ -1703,8 +1703,17 @@
# Compile all functions
defcompile
END
- # FIXME: this should fail on the BBBB
- CheckScriptSuccess(lines)
+ CheckScriptFailure(lines, 'E1173: Text found after enddef: BBBB')
+
+ lines =<< trim END
+ vim9script
+ def FirstFunction()
+ func SecondFunction()
+ endfunc|BBBB
+ enddef
+ defcompile
+ END
+ CheckScriptFailure(lines, 'E1173: Text found after endfunction: BBBB')
enddef
def Test_return_type_wrong()