mirror of
https://github.com/vim/vim.git
synced 2025-09-25 03:54:15 -04:00
patch 8.2.4500: Vim9: can declare a global variable on the command line
Problem: Vim9: can declare a global variable on the command line. Solution: Disallow declaring a variable on the command line. (closes #9881)
This commit is contained in:
@@ -2480,23 +2480,6 @@ def Test_abort_after_error()
|
||||
delete('Xtestscript')
|
||||
enddef
|
||||
|
||||
func Test_declare_command_line()
|
||||
CheckRunVimInTerminal
|
||||
call Run_Test_declare_command_line()
|
||||
endfunc
|
||||
|
||||
def Run_Test_declare_command_line()
|
||||
# On the command line the type is parsed but not used.
|
||||
# To get rid of the script context have to run this in another Vim instance.
|
||||
var buf = g:RunVimInTerminal('', {'rows': 6})
|
||||
term_sendkeys(buf, ":vim9 var abc: list<list<number>> = [ [1, 2, 3], [4, 5, 6] ]\<CR>")
|
||||
g:TermWait(buf)
|
||||
term_sendkeys(buf, ":echo abc\<CR>")
|
||||
g:TermWait(buf)
|
||||
g:WaitForAssert(() => assert_match('\[\[1, 2, 3\], \[4, 5, 6\]\]', term_getline(buf, 6)))
|
||||
g:StopVimInTerminal(buf)
|
||||
enddef
|
||||
|
||||
def Test_using_s_var_in_function()
|
||||
var lines =<< trim END
|
||||
vim9script
|
||||
|
Reference in New Issue
Block a user