patch 8.2.0613: Vim9: no check for space before #comment
Problem: Vim9: no check for space before #comment.
Solution: Add space checks.
diff --git a/src/testdir/test_vim9_script.vim b/src/testdir/test_vim9_script.vim
index a541d88..219a86f 100644
--- a/src/testdir/test_vim9_script.vim
+++ b/src/testdir/test_vim9_script.vim
@@ -1210,6 +1210,176 @@
'vim9script',
'hi# comment',
], 'E416:')
+ CheckScriptSuccess([
+ 'vim9script',
+ 'hi Search # comment',
+ ])
+ CheckScriptFailure([
+ 'vim9script',
+ 'hi Search# comment',
+ ], 'E416:')
+ CheckScriptSuccess([
+ 'vim9script',
+ 'hi link This Search # comment',
+ ])
+ CheckScriptFailure([
+ 'vim9script',
+ 'hi link This That# comment',
+ ], 'E413:')
+ CheckScriptSuccess([
+ 'vim9script',
+ 'hi clear This # comment',
+ 'hi clear # comment',
+ ])
+ " not tested, because it doesn't give an error but a warning:
+ " hi clear This# comment',
+ CheckScriptFailure([
+ 'vim9script',
+ 'hi clear# comment',
+ ], 'E416:')
+
+ CheckScriptSuccess([
+ 'vim9script',
+ 'hi Group term=bold',
+ 'match Group /todo/ # comment',
+ ])
+ CheckScriptFailure([
+ 'vim9script',
+ 'hi Group term=bold',
+ 'match Group /todo/# comment',
+ ], 'E488:')
+ CheckScriptSuccess([
+ 'vim9script',
+ 'match # comment',
+ ])
+ CheckScriptFailure([
+ 'vim9script',
+ 'match# comment',
+ ], 'E475:')
+ CheckScriptSuccess([
+ 'vim9script',
+ 'match none # comment',
+ ])
+ CheckScriptFailure([
+ 'vim9script',
+ 'match none# comment',
+ ], 'E475:')
+
+ CheckScriptSuccess([
+ 'vim9script',
+ 'menutrans clear # comment',
+ ])
+ CheckScriptFailure([
+ 'vim9script',
+ 'menutrans clear# comment text',
+ ], 'E474:')
+
+ CheckScriptSuccess([
+ 'vim9script',
+ 'syntax clear # comment',
+ ])
+ CheckScriptFailure([
+ 'vim9script',
+ 'syntax clear# comment text',
+ ], 'E28:')
+ CheckScriptSuccess([
+ 'vim9script',
+ 'syntax keyword Word some',
+ 'syntax clear Word # comment',
+ ])
+ CheckScriptFailure([
+ 'vim9script',
+ 'syntax keyword Word some',
+ 'syntax clear Word# comment text',
+ ], 'E28:')
+
+ CheckScriptSuccess([
+ 'vim9script',
+ 'syntax list # comment',
+ ])
+ CheckScriptFailure([
+ 'vim9script',
+ 'syntax list# comment text',
+ ], 'E28:')
+
+ CheckScriptSuccess([
+ 'vim9script',
+ 'syntax match Word /pat/ oneline # comment',
+ ])
+ CheckScriptFailure([
+ 'vim9script',
+ 'syntax match Word /pat/ oneline# comment',
+ ], 'E475:')
+
+ CheckScriptSuccess([
+ 'vim9script',
+ 'syntax keyword Word word # comm[ent',
+ ])
+ CheckScriptFailure([
+ 'vim9script',
+ 'syntax keyword Word word# comm[ent',
+ ], 'E789:')
+
+ CheckScriptSuccess([
+ 'vim9script',
+ 'syntax match Word /pat/ # comment',
+ ])
+ CheckScriptFailure([
+ 'vim9script',
+ 'syntax match Word /pat/# comment',
+ ], 'E402:')
+
+ CheckScriptSuccess([
+ 'vim9script',
+ 'syntax match Word /pat/ contains=Something # comment',
+ ])
+ CheckScriptFailure([
+ 'vim9script',
+ 'syntax match Word /pat/ contains=Something# comment',
+ ], 'E475:')
+ CheckScriptFailure([
+ 'vim9script',
+ 'syntax match Word /pat/ contains= # comment',
+ ], 'E406:')
+ CheckScriptFailure([
+ 'vim9script',
+ 'syntax match Word /pat/ contains=# comment',
+ ], 'E475:')
+
+ CheckScriptSuccess([
+ 'vim9script',
+ 'syntax region Word start=/pat/ end=/pat/ # comment',
+ ])
+ CheckScriptFailure([
+ 'vim9script',
+ 'syntax region Word start=/pat/ end=/pat/# comment',
+ ], 'E475:')
+
+ CheckScriptSuccess([
+ 'vim9script',
+ 'syntax sync # comment',
+ ])
+ CheckScriptFailure([
+ 'vim9script',
+ 'syntax sync# comment',
+ ], 'E404:')
+ CheckScriptSuccess([
+ 'vim9script',
+ 'syntax sync ccomment # comment',
+ ])
+ CheckScriptFailure([
+ 'vim9script',
+ 'syntax sync ccomment# comment',
+ ], 'E404:')
+
+ CheckScriptSuccess([
+ 'vim9script',
+ 'syntax cluster Some contains=Word # comment',
+ ])
+ CheckScriptFailure([
+ 'vim9script',
+ 'syntax cluster Some contains=Word# comment',
+ ], 'E475:')
enddef
def Test_vim9_comment_gui()