0
0
mirror of https://github.com/vim/vim.git synced 2025-10-03 05:14:07 -04:00

patch 8.2.4510: Vim9: shortening commands leads to confusing script

Problem:    Vim9: shortening commands leads to confusing script.
Solution:   In Vim9 script require at least ":cont" for ":continue", "const"
            instead of "cons", "break" instead of "brea", "catch" instead of
            "cat", "else" instead of "el" "elseif" instead of "elsei" "endfor"
            instead of "endfo" "endif" instead of "en" "endtry" instead of
            "endt", "finally" instead of "fina", "throw" instead of "th",
            "while" instead of "wh".
This commit is contained in:
Bram Moolenaar
2022-03-05 12:56:44 +00:00
parent e1d1211799
commit 204852ae2a
7 changed files with 70 additions and 37 deletions

View File

@@ -460,7 +460,7 @@ def Test_try_catch_throw()
endtry
catch /wrong/
add(l, 'caught')
fina
finally
add(l, 'finally')
endtry
assert_equal(['1', 'caught', 'finally'], l)
@@ -1004,7 +1004,7 @@ enddef
def s:ReturnFinally(): string
try
return 'intry'
finall
finally
g:in_finally = 'finally'
endtry
return 'end'
@@ -3374,6 +3374,37 @@ def Run_test_reject_declaration()
g:StopVimInTerminal(buf)
enddef
def Test_minimal_command_name_length()
var names = [
'cons',
'brea',
'cat',
'catc',
'con',
'el',
'els',
'elsei',
'endfo',
'en',
'end',
'endi',
'endw',
'endt',
'endtr',
'fina',
'finall',
'th',
'thr',
'thro',
'wh',
'whi',
'whil',
]
for name in names
v9.CheckDefAndScriptFailure([name .. ' '], 'E1065:')
endfor
enddef
def Test_unset_any_variable()
var lines =<< trim END
var name: any