diff src/testdir/test_cmdline.vim @ 29369:b1f345ec827e v9.0.0027

patch 9.0.0027: the command line test is getting quite big Commit: https://github.com/vim/vim/commit/2d2950198231a31bf87c1cd4322099cc36b0bb93 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Jul 2 16:29:34 2022 +0100 patch 9.0.0027: the command line test is getting quite big Problem: The command line test is getting quite big. Solution: Move command line window tests to a separate file.
author Bram Moolenaar <Bram@vim.org>
date Sat, 02 Jul 2022 17:30:02 +0200
parents 98de9a961a64
children 5c390aa28f44
line wrap: on
line diff
--- a/src/testdir/test_cmdline.vim
+++ b/src/testdir/test_cmdline.vim
@@ -1322,57 +1322,6 @@ func Test_getcmdtype()
   call assert_equal('', getcmdline())
 endfunc
 
-func Test_getcmdwintype()
-  CheckFeature cmdwin
-
-  call feedkeys("q/:let a = getcmdwintype()\<CR>:q\<CR>", 'x!')
-  call assert_equal('/', a)
-
-  call feedkeys("q?:let a = getcmdwintype()\<CR>:q\<CR>", 'x!')
-  call assert_equal('?', a)
-
-  call feedkeys("q::let a = getcmdwintype()\<CR>:q\<CR>", 'x!')
-  call assert_equal(':', a)
-
-  call feedkeys(":\<C-F>:let a = getcmdwintype()\<CR>:q\<CR>", 'x!')
-  call assert_equal(':', a)
-
-  call assert_equal('', getcmdwintype())
-endfunc
-
-func Test_getcmdwin_autocmd()
-  CheckFeature cmdwin
-
-  let s:seq = []
-  augroup CmdWin
-  au WinEnter * call add(s:seq, 'WinEnter ' .. win_getid())
-  au WinLeave * call add(s:seq, 'WinLeave ' .. win_getid())
-  au BufEnter * call add(s:seq, 'BufEnter ' .. bufnr())
-  au BufLeave * call add(s:seq, 'BufLeave ' .. bufnr())
-  au CmdWinEnter * call add(s:seq, 'CmdWinEnter ' .. win_getid())
-  au CmdWinLeave * call add(s:seq, 'CmdWinLeave ' .. win_getid())
-
-  let org_winid = win_getid()
-  let org_bufnr = bufnr()
-  call feedkeys("q::let a = getcmdwintype()\<CR>:let s:cmd_winid = win_getid()\<CR>:let s:cmd_bufnr = bufnr()\<CR>:q\<CR>", 'x!')
-  call assert_equal(':', a)
-  call assert_equal([
-	\ 'WinLeave ' .. org_winid,
-	\ 'WinEnter ' .. s:cmd_winid,
-	\ 'BufLeave ' .. org_bufnr,
-	\ 'BufEnter ' .. s:cmd_bufnr,
-	\ 'CmdWinEnter ' .. s:cmd_winid,
-	\ 'CmdWinLeave ' .. s:cmd_winid,
-	\ 'BufLeave ' .. s:cmd_bufnr,
-	\ 'WinLeave ' .. s:cmd_winid,
-	\ 'WinEnter ' .. org_winid,
-	\ 'BufEnter ' .. org_bufnr,
-	\ ], s:seq)
-
-  au!
-  augroup END
-endfunc
-
 func Test_verbosefile()
   set verbosefile=Xlog
   echomsg 'foo'
@@ -1454,65 +1403,6 @@ func Test_cmdline_overstrike()
   let &encoding = encoding_save
 endfunc
 
-func Test_cmdwin_bug()
-  CheckFeature cmdwin
-
-  let winid = win_getid()
-  sp
-  try
-    call feedkeys("q::call win_gotoid(" .. winid .. ")\<CR>:q\<CR>", 'x!')
-  catch /^Vim\%((\a\+)\)\=:E11/
-  endtry
-  bw!
-endfunc
-
-func Test_cmdwin_restore()
-  CheckFeature cmdwin
-  CheckScreendump
-
-  let lines =<< trim [SCRIPT]
-    augroup vimHints | au! | augroup END
-    call setline(1, range(30))
-    2split
-  [SCRIPT]
-  call writefile(lines, 'XTest_restore')
-
-  let buf = RunVimInTerminal('-S XTest_restore', {'rows': 12})
-  call TermWait(buf, 50)
-  call term_sendkeys(buf, "q:")
-  call VerifyScreenDump(buf, 'Test_cmdwin_restore_1', {})
-
-  " normal restore
-  call term_sendkeys(buf, ":q\<CR>")
-  call VerifyScreenDump(buf, 'Test_cmdwin_restore_2', {})
-
-  " restore after setting 'lines' with one window
-  call term_sendkeys(buf, ":close\<CR>")
-  call term_sendkeys(buf, "q:")
-  call term_sendkeys(buf, ":set lines=18\<CR>")
-  call term_sendkeys(buf, ":q\<CR>")
-  call VerifyScreenDump(buf, 'Test_cmdwin_restore_3', {})
-
-  " clean up
-  call StopVimInTerminal(buf)
-  call delete('XTest_restore')
-endfunc
-
-func Test_cmdwin_no_terminal()
-  CheckFeature cmdwin
-  CheckFeature terminal
-  CheckNotMSWindows
-
-  let buf = RunVimInTerminal('', {'rows': 12})
-  call TermWait(buf, 50)
-  call term_sendkeys(buf, ":set cmdheight=2\<CR>")
-  call term_sendkeys(buf, "q:")
-  call term_sendkeys(buf, ":let buf = term_start(['/bin/echo'], #{hidden: 1})\<CR>")
-  call VerifyScreenDump(buf, 'Test_cmdwin_no_terminal', {})
-  call term_sendkeys(buf, ":q\<CR>")
-  call StopVimInTerminal(buf)
-endfunc
-
 func Test_buffers_lastused()
   " check that buffers are sorted by time when wildmode has lastused
   call test_settime(1550020000)	  " middle
@@ -1558,61 +1448,6 @@ func Test_buffers_lastused()
   bwipeout bufc
 endfunc
 
-func Test_cmdwin_feedkeys()
-  CheckFeature cmdwin
-
-  " This should not generate E488
-  call feedkeys("q:\<CR>", 'x')
-  " Using feedkeys with q: only should automatically close the cmd window
-  call feedkeys('q:', 'xt')
-  call assert_equal(1, winnr('$'))
-  call assert_equal('', getcmdwintype())
-endfunc
-
-" Tests for the issues fixed in 7.4.441.
-" When 'cedit' is set to Ctrl-C, opening the command window hangs Vim
-func Test_cmdwin_cedit()
-  CheckFeature cmdwin
-
-  exe "set cedit=\<C-c>"
-  normal! :
-  call assert_equal(1, winnr('$'))
-
-  let g:cmd_wintype = ''
-  func CmdWinType()
-      let g:cmd_wintype = getcmdwintype()
-      let g:wintype = win_gettype()
-      return ''
-  endfunc
-
-  call feedkeys("\<C-c>a\<C-R>=CmdWinType()\<CR>\<CR>")
-  echo input('')
-  call assert_equal('@', g:cmd_wintype)
-  call assert_equal('command', g:wintype)
-
-  set cedit&vim
-  delfunc CmdWinType
-endfunc
-
-" Test for CmdwinEnter autocmd
-func Test_cmdwin_autocmd()
-  CheckFeature cmdwin
-
-  augroup CmdWin
-    au!
-    autocmd BufLeave * if &buftype == '' | update | endif
-    autocmd CmdwinEnter * startinsert
-  augroup END
-
-  call assert_fails('call feedkeys("q:xyz\<CR>", "xt")', 'E492:')
-  call assert_equal('xyz', @:)
-
-  augroup CmdWin
-    au!
-  augroup END
-  augroup! CmdWin
-endfunc
-
 func Test_cmdlineclear_tabenter()
   CheckScreendump
 
@@ -1649,57 +1484,6 @@ func Test_cmdline_expand_special()
   call delete('Xfile.java')
 endfunc
 
-func Test_cmdwin_jump_to_win()
-  CheckFeature cmdwin
-
-  call assert_fails('call feedkeys("q:\<C-W>\<C-W>\<CR>", "xt")', 'E11:')
-  new
-  set modified
-  call assert_fails('call feedkeys("q/:qall\<CR>", "xt")', ['E37:', 'E162:'])
-  close!
-  call feedkeys("q/:close\<CR>", "xt")
-  call assert_equal(1, winnr('$'))
-  call feedkeys("q/:exit\<CR>", "xt")
-  call assert_equal(1, winnr('$'))
-
-  " opening command window twice should fail
-  call assert_beeps('call feedkeys("q:q:\<CR>\<CR>", "xt")')
-  call assert_equal(1, winnr('$'))
-endfunc
-
-func Test_cmdwin_tabpage()
-  tabedit
-  call assert_fails("silent norm q/g	:I\<Esc>", 'E11:')
-  tabclose!
-endfunc
-
-func Test_cmdwin_interrupted()
-  CheckFeature cmdwin
-  CheckScreendump
-
-  " aborting the :smile output caused the cmdline window to use the current
-  " buffer.
-  let lines =<< trim [SCRIPT]
-    au WinNew * smile
-  [SCRIPT]
-  call writefile(lines, 'XTest_cmdwin')
-
-  let buf = RunVimInTerminal('-S XTest_cmdwin', {'rows': 18})
-  " open cmdwin
-  call term_sendkeys(buf, "q:")
-  call WaitForAssert({-> assert_match('-- More --', term_getline(buf, 18))})
-  " quit more prompt for :smile command
-  call term_sendkeys(buf, "q")
-  call WaitForAssert({-> assert_match('^$', term_getline(buf, 18))})
-  " execute a simple command
-  call term_sendkeys(buf, "aecho 'done'\<CR>")
-  call VerifyScreenDump(buf, 'Test_cmdwin_interrupted', {})
-
-  " clean up
-  call StopVimInTerminal(buf)
-  call delete('XTest_cmdwin')
-endfunc
-
 " Test for backtick expression in the command line
 func Test_cmd_backtick()
   %argd
@@ -2033,14 +1817,6 @@ func Test_cmdline_inputmethod()
   %bwipe!
 endfunc
 
-" Test for recursively getting multiple command line inputs
-func Test_cmdwin_multi_input()
-  CheckFeature cmdwin
-
-  call feedkeys(":\<C-R>=input('P: ')\<CR>\"cyan\<CR>\<CR>", 'xt')
-  call assert_equal('"cyan', @:)
-endfunc
-
 " Test for using CTRL-_ in the command line with 'allowrevins'
 func Test_cmdline_revins()
   CheckNotMSWindows
@@ -2059,58 +1835,6 @@ func Test_cmdline_composing_chars()
   call assert_equal('"ゔ', @:)
 endfunc
 
-" Test for normal mode commands not supported in the cmd window
-func Test_cmdwin_blocked_commands()
-  CheckFeature cmdwin
-
-  call assert_fails('call feedkeys("q:\<C-T>\<CR>", "xt")', 'E11:')
-  call assert_fails('call feedkeys("q:\<C-]>\<CR>", "xt")', 'E11:')
-  call assert_fails('call feedkeys("q:\<C-^>\<CR>", "xt")', 'E11:')
-  call assert_fails('call feedkeys("q:Q\<CR>", "xt")', 'E11:')
-  call assert_fails('call feedkeys("q:Z\<CR>", "xt")', 'E11:')
-  call assert_fails('call feedkeys("q:\<F1>\<CR>", "xt")', 'E11:')
-  call assert_fails('call feedkeys("q:\<C-W>s\<CR>", "xt")', 'E11:')
-  call assert_fails('call feedkeys("q:\<C-W>v\<CR>", "xt")', 'E11:')
-  call assert_fails('call feedkeys("q:\<C-W>^\<CR>", "xt")', 'E11:')
-  call assert_fails('call feedkeys("q:\<C-W>n\<CR>", "xt")', 'E11:')
-  call assert_fails('call feedkeys("q:\<C-W>z\<CR>", "xt")', 'E11:')
-  call assert_fails('call feedkeys("q:\<C-W>o\<CR>", "xt")', 'E11:')
-  call assert_fails('call feedkeys("q:\<C-W>w\<CR>", "xt")', 'E11:')
-  call assert_fails('call feedkeys("q:\<C-W>j\<CR>", "xt")', 'E11:')
-  call assert_fails('call feedkeys("q:\<C-W>k\<CR>", "xt")', 'E11:')
-  call assert_fails('call feedkeys("q:\<C-W>h\<CR>", "xt")', 'E11:')
-  call assert_fails('call feedkeys("q:\<C-W>l\<CR>", "xt")', 'E11:')
-  call assert_fails('call feedkeys("q:\<C-W>T\<CR>", "xt")', 'E11:')
-  call assert_fails('call feedkeys("q:\<C-W>x\<CR>", "xt")', 'E11:')
-  call assert_fails('call feedkeys("q:\<C-W>r\<CR>", "xt")', 'E11:')
-  call assert_fails('call feedkeys("q:\<C-W>R\<CR>", "xt")', 'E11:')
-  call assert_fails('call feedkeys("q:\<C-W>K\<CR>", "xt")', 'E11:')
-  call assert_fails('call feedkeys("q:\<C-W>}\<CR>", "xt")', 'E11:')
-  call assert_fails('call feedkeys("q:\<C-W>]\<CR>", "xt")', 'E11:')
-  call assert_fails('call feedkeys("q:\<C-W>f\<CR>", "xt")', 'E11:')
-  call assert_fails('call feedkeys("q:\<C-W>d\<CR>", "xt")', 'E11:')
-  call assert_fails('call feedkeys("q:\<C-W>g\<CR>", "xt")', 'E11:')
-endfunc
-
-" Close the Cmd-line window in insert mode using CTRL-C
-func Test_cmdwin_insert_mode_close()
-  CheckFeature cmdwin
-
-  %bw!
-  let s = ''
-  exe "normal q:a\<C-C>let s='Hello'\<CR>"
-  call assert_equal('Hello', s)
-  call assert_equal(1, winnr('$'))
-endfunc
-
-func Test_cmdwin_ex_mode_with_modifier()
-  " this was accessing memory after allocated text in Ex mode
-  new
-  call setline(1, ['some', 'text', 'lines'])
-  silent! call feedkeys("gQnormal vq:atopleft\<C-V>\<CR>\<CR>", 'xt')
-  bwipe!
-endfunc
-
 " test that ";" works to find a match at the start of the first line
 func Test_zero_line_search()
   new