mirror of
https://github.com/vim/vim.git
synced 2025-10-03 05:14:07 -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:
@@ -3326,34 +3326,50 @@ enddef
|
||||
func Test_no_redraw_when_restoring_cpo()
|
||||
CheckScreendump
|
||||
CheckFeature timers
|
||||
call Run_test_no_redraw_when_restoring_cpo()
|
||||
endfunc
|
||||
|
||||
let lines =<< trim END
|
||||
def Run_test_no_redraw_when_restoring_cpo()
|
||||
var lines =<< trim END
|
||||
vim9script
|
||||
export def Func()
|
||||
enddef
|
||||
END
|
||||
call mkdir('Xdir/autoload', 'p')
|
||||
call writefile(lines, 'Xdir/autoload/script.vim')
|
||||
mkdir('Xdir/autoload', 'p')
|
||||
writefile(lines, 'Xdir/autoload/script.vim')
|
||||
|
||||
let lines =<< trim END
|
||||
lines =<< trim END
|
||||
vim9script
|
||||
set cpo+=M
|
||||
exe 'set rtp^=' .. getcwd() .. '/Xdir'
|
||||
au CmdlineEnter : ++once timer_start(0, (_) => script#Func())
|
||||
setline(1, 'some text')
|
||||
END
|
||||
call writefile(lines, 'XTest_redraw_cpo')
|
||||
let buf = g:RunVimInTerminal('-S XTest_redraw_cpo', {'rows': 6})
|
||||
call term_sendkeys(buf, "V:")
|
||||
call VerifyScreenDump(buf, 'Test_vim9_no_redraw', {})
|
||||
writefile(lines, 'XTest_redraw_cpo')
|
||||
var buf = g:RunVimInTerminal('-S XTest_redraw_cpo', {'rows': 6})
|
||||
term_sendkeys(buf, "V:")
|
||||
g:VerifyScreenDump(buf, 'Test_vim9_no_redraw', {})
|
||||
|
||||
" clean up
|
||||
call term_sendkeys(buf, "\<Esc>u")
|
||||
call g:StopVimInTerminal(buf)
|
||||
call delete('XTest_redraw_cpo')
|
||||
call delete('Xdir', 'rf')
|
||||
# clean up
|
||||
term_sendkeys(buf, "\<Esc>u")
|
||||
g:StopVimInTerminal(buf)
|
||||
delete('XTest_redraw_cpo')
|
||||
delete('Xdir', 'rf')
|
||||
enddef
|
||||
|
||||
func Test_reject_declaration()
|
||||
CheckScreendump
|
||||
call Run_test_reject_declaration()
|
||||
endfunc
|
||||
|
||||
def Run_test_reject_declaration()
|
||||
var buf = g:RunVimInTerminal('', {'rows': 6})
|
||||
term_sendkeys(buf, ":vim9cmd var x: number\<CR>")
|
||||
g:VerifyScreenDump(buf, 'Test_vim9_reject_declaration', {})
|
||||
|
||||
# clean up
|
||||
g:StopVimInTerminal(buf)
|
||||
enddef
|
||||
|
||||
def Test_unset_any_variable()
|
||||
var lines =<< trim END
|
||||
|
Reference in New Issue
Block a user