patch 8.2.0586: Vim9: # comment not sufficiently tested
Problem: Vim9: # comment not sufficiently tested
Solution: Check for preceding white space.
diff --git a/src/testdir/test_vim9_script.vim b/src/testdir/test_vim9_script.vim
index a96910e..58363ba 100644
--- a/src/testdir/test_vim9_script.vim
+++ b/src/testdir/test_vim9_script.vim
@@ -1025,6 +1025,20 @@
':# something',
], 'E488:')
+ { # block start
+ } # block end
+ CheckDefFailure([
+ '{# comment',
+ ], 'E488:')
+ CheckDefFailure([
+ '{',
+ '}# comment',
+ ], 'E488:')
+
+ echo "yes" # comment
+ CheckDefFailure([
+ 'echo "yes"# comment',
+ ], 'E488:')
CheckScriptSuccess([
'vim9script',
'echo "yes" # something',
@@ -1041,6 +1055,29 @@
'echo "yes" # something',
], 'E121:')
+ exe "echo" # comment
+ CheckDefFailure([
+ 'exe "echo"# comment',
+ ], 'E488:')
+ CheckScriptSuccess([
+ 'vim9script',
+ 'exe "echo" # something',
+ ])
+ CheckScriptFailure([
+ 'vim9script',
+ 'exe "echo"# something',
+ ], 'E121:')
+ CheckDefFailure([
+ 'exe # comment',
+ ], 'E1015:')
+ CheckScriptFailure([
+ 'vim9script',
+ 'exe# something',
+ ], 'E121:')
+ CheckScriptFailure([
+ 'exe "echo" # something',
+ ], 'E121:')
+
CheckDefFailure([
'try# comment',
'echo "yes"',