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".
diff --git a/src/testdir/test_vim9_script.vim b/src/testdir/test_vim9_script.vim
index f60fb36..a503d11 100644
--- a/src/testdir/test_vim9_script.vim
+++ b/src/testdir/test_vim9_script.vim
@@ -460,7 +460,7 @@
endtry
catch /wrong/
add(l, 'caught')
- fina
+ finally
add(l, 'finally')
endtry
assert_equal(['1', 'caught', 'finally'], l)
@@ -1004,7 +1004,7 @@
def s:ReturnFinally(): string
try
return 'intry'
- finall
+ finally
g:in_finally = 'finally'
endtry
return 'end'
@@ -3374,6 +3374,37 @@
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