0
0
mirror of https://github.com/vim/vim.git synced 2025-09-29 04:34:16 -04:00

patch 8.2.0611: 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 17:46:14 +02:00
parent 08f4157c5c
commit faac410409
5 changed files with 69 additions and 4 deletions

View File

@@ -1208,6 +1208,69 @@ def Test_vim9_comment_not_compiled()
'let g:var = 123',
'unlet g:var # something',
], 'E488:')
CheckScriptSuccess([
'vim9script',
'if 1 # comment',
' echo "yes"',
'elseif 2 #comment',
' echo "no"',
'endif',
])
CheckScriptFailure([
'vim9script',
'if 1# comment',
' echo "yes"',
'endif',
], 'E15:')
CheckScriptFailure([
'vim9script',
'if 0 # comment',
' echo "yes"',
'elseif 2#comment',
' echo "no"',
'endif',
], 'E15:')
CheckScriptSuccess([
'vim9script',
'let # comment',
])
CheckScriptFailure([
'vim9script',
'let# comment',
], 'E121:')
CheckScriptSuccess([
'vim9script',
'let v:version # comment',
])
CheckScriptFailure([
'vim9script',
'let v:version# comment',
], 'E121:')
CheckScriptSuccess([
'vim9script',
'new'
'call setline(1, ["# define pat", "last"])',
'$',
'dsearch /pat/ #comment',
'bwipe!',
])
CheckScriptFailure([
'vim9script',
'new'
'call setline(1, ["# define pat", "last"])',
'$',
'dsearch /pat/#comment',
'bwipe!',
], 'E488:')
enddef
" Keep this last, it messes up highlighting.