0
0
mirror of https://github.com/vim/vim.git synced 2025-09-30 04:44:14 -04:00

patch 8.2.0613: Vim9: no check for space before #comment

Problem:    Vim9: no check for space before #comment.
Solution:   Add space checks.
This commit is contained in:
Bram Moolenaar
2020-04-20 22:42:32 +02:00
parent 2c7f8c574f
commit 1966c24881
6 changed files with 210 additions and 32 deletions

View File

@@ -1210,6 +1210,176 @@ def Test_vim9_comment()
'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()