diff options
author | Bram Moolenaar <Bram@vim.org> | 2022-01-05 10:16:30 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-01-05 10:16:30 +0000 |
commit | c653e4a2bd4099e2fac8e1c448a0f34581d5a658 (patch) | |
tree | d4d5f0f8578e7377b4f895eb06301d6162826312 /src/testdir/test_vim9_assign.vim | |
parent | a6f7929e62c19a6a2418a016b4c59b83eb1887ac (diff) | |
download | vim-git-c653e4a2bd4099e2fac8e1c448a0f34581d5a658.tar.gz |
patch 8.2.4006: Vim9: crash when declaring variable on the command linev8.2.4006
Problem: Vim9: crash when declaring variable on the command line.
Solution: Use a temporary type list. (closes #9474)
Diffstat (limited to 'src/testdir/test_vim9_assign.vim')
-rw-r--r-- | src/testdir/test_vim9_assign.vim | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/testdir/test_vim9_assign.vim b/src/testdir/test_vim9_assign.vim index c91cd6547..209ac95f8 100644 --- a/src/testdir/test_vim9_assign.vim +++ b/src/testdir/test_vim9_assign.vim @@ -2,6 +2,7 @@ source check.vim source vim9.vim +source term_util.vim let s:appendToMe = 'xxx' let s:addToMe = 111 @@ -2281,6 +2282,23 @@ 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 = RunVimInTerminal('', {'rows': 6}) + term_sendkeys(buf, ":vim9 var abc: list<list<number>> = [ [1, 2, 3], [4, 5, 6] ]\<CR>") + TermWait(buf) + term_sendkeys(buf, ":echo abc\<CR>") + TermWait(buf) + WaitForAssert(() => assert_match('\[\[1, 2, 3\], \[4, 5, 6\]\]', term_getline(buf, 6))) + StopVimInTerminal(buf) +enddef + " vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker |