Skip to content

Commit 2d29501

Browse files
committed
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.
1 parent c5274dd commit 2d29501

6 files changed

Lines changed: 364 additions & 377 deletions

File tree

src/testdir/Make_all.mak

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ NEW_TESTS = \
8787
test_clientserver \
8888
test_close_count \
8989
test_cmdline \
90+
test_cmdwin \
9091
test_command_count \
9192
test_comments \
9293
test_comparators \
@@ -345,6 +346,7 @@ NEW_TESTS_RES = \
345346
test_clientserver.res \
346347
test_close_count.res \
347348
test_cmdline.res \
349+
test_cmdwin.res \
348350
test_command_count.res \
349351
test_comments.res \
350352
test_comparators.res \

src/testdir/test_cmdline.vim

Lines changed: 0 additions & 276 deletions
Original file line numberDiff line numberDiff line change
@@ -1322,57 +1322,6 @@ func Test_getcmdtype()
13221322
call assert_equal('', getcmdline())
13231323
endfunc
13241324

1325-
func Test_getcmdwintype()
1326-
CheckFeature cmdwin
1327-
1328-
call feedkeys("q/:let a = getcmdwintype()\<CR>:q\<CR>", 'x!')
1329-
call assert_equal('/', a)
1330-
1331-
call feedkeys("q?:let a = getcmdwintype()\<CR>:q\<CR>", 'x!')
1332-
call assert_equal('?', a)
1333-
1334-
call feedkeys("q::let a = getcmdwintype()\<CR>:q\<CR>", 'x!')
1335-
call assert_equal(':', a)
1336-
1337-
call feedkeys(":\<C-F>:let a = getcmdwintype()\<CR>:q\<CR>", 'x!')
1338-
call assert_equal(':', a)
1339-
1340-
call assert_equal('', getcmdwintype())
1341-
endfunc
1342-
1343-
func Test_getcmdwin_autocmd()
1344-
CheckFeature cmdwin
1345-
1346-
let s:seq = []
1347-
augroup CmdWin
1348-
au WinEnter * call add(s:seq, 'WinEnter ' .. win_getid())
1349-
au WinLeave * call add(s:seq, 'WinLeave ' .. win_getid())
1350-
au BufEnter * call add(s:seq, 'BufEnter ' .. bufnr())
1351-
au BufLeave * call add(s:seq, 'BufLeave ' .. bufnr())
1352-
au CmdWinEnter * call add(s:seq, 'CmdWinEnter ' .. win_getid())
1353-
au CmdWinLeave * call add(s:seq, 'CmdWinLeave ' .. win_getid())
1354-
1355-
let org_winid = win_getid()
1356-
let org_bufnr = bufnr()
1357-
call feedkeys("q::let a = getcmdwintype()\<CR>:let s:cmd_winid = win_getid()\<CR>:let s:cmd_bufnr = bufnr()\<CR>:q\<CR>", 'x!')
1358-
call assert_equal(':', a)
1359-
call assert_equal([
1360-
\ 'WinLeave ' .. org_winid,
1361-
\ 'WinEnter ' .. s:cmd_winid,
1362-
\ 'BufLeave ' .. org_bufnr,
1363-
\ 'BufEnter ' .. s:cmd_bufnr,
1364-
\ 'CmdWinEnter ' .. s:cmd_winid,
1365-
\ 'CmdWinLeave ' .. s:cmd_winid,
1366-
\ 'BufLeave ' .. s:cmd_bufnr,
1367-
\ 'WinLeave ' .. s:cmd_winid,
1368-
\ 'WinEnter ' .. org_winid,
1369-
\ 'BufEnter ' .. org_bufnr,
1370-
\ ], s:seq)
1371-
1372-
au!
1373-
augroup END
1374-
endfunc
1375-
13761325
func Test_verbosefile()
13771326
set verbosefile=Xlog
13781327
echomsg 'foo'
@@ -1454,65 +1403,6 @@ func Test_cmdline_overstrike()
14541403
let &encoding = encoding_save
14551404
endfunc
14561405

1457-
func Test_cmdwin_bug()
1458-
CheckFeature cmdwin
1459-
1460-
let winid = win_getid()
1461-
sp
1462-
try
1463-
call feedkeys("q::call win_gotoid(" .. winid .. ")\<CR>:q\<CR>", 'x!')
1464-
catch /^Vim\%((\a\+)\)\=:E11/
1465-
endtry
1466-
bw!
1467-
endfunc
1468-
1469-
func Test_cmdwin_restore()
1470-
CheckFeature cmdwin
1471-
CheckScreendump
1472-
1473-
let lines =<< trim [SCRIPT]
1474-
augroup vimHints | au! | augroup END
1475-
call setline(1, range(30))
1476-
2split
1477-
[SCRIPT]
1478-
call writefile(lines, 'XTest_restore')
1479-
1480-
let buf = RunVimInTerminal('-S XTest_restore', {'rows': 12})
1481-
call TermWait(buf, 50)
1482-
call term_sendkeys(buf, "q:")
1483-
call VerifyScreenDump(buf, 'Test_cmdwin_restore_1', {})
1484-
1485-
" normal restore
1486-
call term_sendkeys(buf, ":q\<CR>")
1487-
call VerifyScreenDump(buf, 'Test_cmdwin_restore_2', {})
1488-
1489-
" restore after setting 'lines' with one window
1490-
call term_sendkeys(buf, ":close\<CR>")
1491-
call term_sendkeys(buf, "q:")
1492-
call term_sendkeys(buf, ":set lines=18\<CR>")
1493-
call term_sendkeys(buf, ":q\<CR>")
1494-
call VerifyScreenDump(buf, 'Test_cmdwin_restore_3', {})
1495-
1496-
" clean up
1497-
call StopVimInTerminal(buf)
1498-
call delete('XTest_restore')
1499-
endfunc
1500-
1501-
func Test_cmdwin_no_terminal()
1502-
CheckFeature cmdwin
1503-
CheckFeature terminal
1504-
CheckNotMSWindows
1505-
1506-
let buf = RunVimInTerminal('', {'rows': 12})
1507-
call TermWait(buf, 50)
1508-
call term_sendkeys(buf, ":set cmdheight=2\<CR>")
1509-
call term_sendkeys(buf, "q:")
1510-
call term_sendkeys(buf, ":let buf = term_start(['/bin/echo'], #{hidden: 1})\<CR>")
1511-
call VerifyScreenDump(buf, 'Test_cmdwin_no_terminal', {})
1512-
call term_sendkeys(buf, ":q\<CR>")
1513-
call StopVimInTerminal(buf)
1514-
endfunc
1515-
15161406
func Test_buffers_lastused()
15171407
" check that buffers are sorted by time when wildmode has lastused
15181408
call test_settime(1550020000) " middle
@@ -1558,61 +1448,6 @@ func Test_buffers_lastused()
15581448
bwipeout bufc
15591449
endfunc
15601450

1561-
func Test_cmdwin_feedkeys()
1562-
CheckFeature cmdwin
1563-
1564-
" This should not generate E488
1565-
call feedkeys("q:\<CR>", 'x')
1566-
" Using feedkeys with q: only should automatically close the cmd window
1567-
call feedkeys('q:', 'xt')
1568-
call assert_equal(1, winnr('$'))
1569-
call assert_equal('', getcmdwintype())
1570-
endfunc
1571-
1572-
" Tests for the issues fixed in 7.4.441.
1573-
" When 'cedit' is set to Ctrl-C, opening the command window hangs Vim
1574-
func Test_cmdwin_cedit()
1575-
CheckFeature cmdwin
1576-
1577-
exe "set cedit=\<C-c>"
1578-
normal! :
1579-
call assert_equal(1, winnr('$'))
1580-
1581-
let g:cmd_wintype = ''
1582-
func CmdWinType()
1583-
let g:cmd_wintype = getcmdwintype()
1584-
let g:wintype = win_gettype()
1585-
return ''
1586-
endfunc
1587-
1588-
call feedkeys("\<C-c>a\<C-R>=CmdWinType()\<CR>\<CR>")
1589-
echo input('')
1590-
call assert_equal('@', g:cmd_wintype)
1591-
call assert_equal('command', g:wintype)
1592-
1593-
set cedit&vim
1594-
delfunc CmdWinType
1595-
endfunc
1596-
1597-
" Test for CmdwinEnter autocmd
1598-
func Test_cmdwin_autocmd()
1599-
CheckFeature cmdwin
1600-
1601-
augroup CmdWin
1602-
au!
1603-
autocmd BufLeave * if &buftype == '' | update | endif
1604-
autocmd CmdwinEnter * startinsert
1605-
augroup END
1606-
1607-
call assert_fails('call feedkeys("q:xyz\<CR>", "xt")', 'E492:')
1608-
call assert_equal('xyz', @:)
1609-
1610-
augroup CmdWin
1611-
au!
1612-
augroup END
1613-
augroup! CmdWin
1614-
endfunc
1615-
16161451
func Test_cmdlineclear_tabenter()
16171452
CheckScreendump
16181453

@@ -1649,57 +1484,6 @@ func Test_cmdline_expand_special()
16491484
call delete('Xfile.java')
16501485
endfunc
16511486

1652-
func Test_cmdwin_jump_to_win()
1653-
CheckFeature cmdwin
1654-
1655-
call assert_fails('call feedkeys("q:\<C-W>\<C-W>\<CR>", "xt")', 'E11:')
1656-
new
1657-
set modified
1658-
call assert_fails('call feedkeys("q/:qall\<CR>", "xt")', ['E37:', 'E162:'])
1659-
close!
1660-
call feedkeys("q/:close\<CR>", "xt")
1661-
call assert_equal(1, winnr('$'))
1662-
call feedkeys("q/:exit\<CR>", "xt")
1663-
call assert_equal(1, winnr('$'))
1664-
1665-
" opening command window twice should fail
1666-
call assert_beeps('call feedkeys("q:q:\<CR>\<CR>", "xt")')
1667-
call assert_equal(1, winnr('$'))
1668-
endfunc
1669-
1670-
func Test_cmdwin_tabpage()
1671-
tabedit
1672-
call assert_fails("silent norm q/g :I\<Esc>", 'E11:')
1673-
tabclose!
1674-
endfunc
1675-
1676-
func Test_cmdwin_interrupted()
1677-
CheckFeature cmdwin
1678-
CheckScreendump
1679-
1680-
" aborting the :smile output caused the cmdline window to use the current
1681-
" buffer.
1682-
let lines =<< trim [SCRIPT]
1683-
au WinNew * smile
1684-
[SCRIPT]
1685-
call writefile(lines, 'XTest_cmdwin')
1686-
1687-
let buf = RunVimInTerminal('-S XTest_cmdwin', {'rows': 18})
1688-
" open cmdwin
1689-
call term_sendkeys(buf, "q:")
1690-
call WaitForAssert({-> assert_match('-- More --', term_getline(buf, 18))})
1691-
" quit more prompt for :smile command
1692-
call term_sendkeys(buf, "q")
1693-
call WaitForAssert({-> assert_match('^$', term_getline(buf, 18))})
1694-
" execute a simple command
1695-
call term_sendkeys(buf, "aecho 'done'\<CR>")
1696-
call VerifyScreenDump(buf, 'Test_cmdwin_interrupted', {})
1697-
1698-
" clean up
1699-
call StopVimInTerminal(buf)
1700-
call delete('XTest_cmdwin')
1701-
endfunc
1702-
17031487
" Test for backtick expression in the command line
17041488
func Test_cmd_backtick()
17051489
%argd
@@ -2033,14 +1817,6 @@ func Test_cmdline_inputmethod()
20331817
%bwipe!
20341818
endfunc
20351819

2036-
" Test for recursively getting multiple command line inputs
2037-
func Test_cmdwin_multi_input()
2038-
CheckFeature cmdwin
2039-
2040-
call feedkeys(":\<C-R>=input('P: ')\<CR>\"cyan\<CR>\<CR>", 'xt')
2041-
call assert_equal('"cyan', @:)
2042-
endfunc
2043-
20441820
" Test for using CTRL-_ in the command line with 'allowrevins'
20451821
func Test_cmdline_revins()
20461822
CheckNotMSWindows
@@ -2059,58 +1835,6 @@ func Test_cmdline_composing_chars()
20591835
call assert_equal('"ゔ', @:)
20601836
endfunc
20611837

2062-
" Test for normal mode commands not supported in the cmd window
2063-
func Test_cmdwin_blocked_commands()
2064-
CheckFeature cmdwin
2065-
2066-
call assert_fails('call feedkeys("q:\<C-T>\<CR>", "xt")', 'E11:')
2067-
call assert_fails('call feedkeys("q:\<C-]>\<CR>", "xt")', 'E11:')
2068-
call assert_fails('call feedkeys("q:\<C-^>\<CR>", "xt")', 'E11:')
2069-
call assert_fails('call feedkeys("q:Q\<CR>", "xt")', 'E11:')
2070-
call assert_fails('call feedkeys("q:Z\<CR>", "xt")', 'E11:')
2071-
call assert_fails('call feedkeys("q:\<F1>\<CR>", "xt")', 'E11:')
2072-
call assert_fails('call feedkeys("q:\<C-W>s\<CR>", "xt")', 'E11:')
2073-
call assert_fails('call feedkeys("q:\<C-W>v\<CR>", "xt")', 'E11:')
2074-
call assert_fails('call feedkeys("q:\<C-W>^\<CR>", "xt")', 'E11:')
2075-
call assert_fails('call feedkeys("q:\<C-W>n\<CR>", "xt")', 'E11:')
2076-
call assert_fails('call feedkeys("q:\<C-W>z\<CR>", "xt")', 'E11:')
2077-
call assert_fails('call feedkeys("q:\<C-W>o\<CR>", "xt")', 'E11:')
2078-
call assert_fails('call feedkeys("q:\<C-W>w\<CR>", "xt")', 'E11:')
2079-
call assert_fails('call feedkeys("q:\<C-W>j\<CR>", "xt")', 'E11:')
2080-
call assert_fails('call feedkeys("q:\<C-W>k\<CR>", "xt")', 'E11:')
2081-
call assert_fails('call feedkeys("q:\<C-W>h\<CR>", "xt")', 'E11:')
2082-
call assert_fails('call feedkeys("q:\<C-W>l\<CR>", "xt")', 'E11:')
2083-
call assert_fails('call feedkeys("q:\<C-W>T\<CR>", "xt")', 'E11:')
2084-
call assert_fails('call feedkeys("q:\<C-W>x\<CR>", "xt")', 'E11:')
2085-
call assert_fails('call feedkeys("q:\<C-W>r\<CR>", "xt")', 'E11:')
2086-
call assert_fails('call feedkeys("q:\<C-W>R\<CR>", "xt")', 'E11:')
2087-
call assert_fails('call feedkeys("q:\<C-W>K\<CR>", "xt")', 'E11:')
2088-
call assert_fails('call feedkeys("q:\<C-W>}\<CR>", "xt")', 'E11:')
2089-
call assert_fails('call feedkeys("q:\<C-W>]\<CR>", "xt")', 'E11:')
2090-
call assert_fails('call feedkeys("q:\<C-W>f\<CR>", "xt")', 'E11:')
2091-
call assert_fails('call feedkeys("q:\<C-W>d\<CR>", "xt")', 'E11:')
2092-
call assert_fails('call feedkeys("q:\<C-W>g\<CR>", "xt")', 'E11:')
2093-
endfunc
2094-
2095-
" Close the Cmd-line window in insert mode using CTRL-C
2096-
func Test_cmdwin_insert_mode_close()
2097-
CheckFeature cmdwin
2098-
2099-
%bw!
2100-
let s = ''
2101-
exe "normal q:a\<C-C>let s='Hello'\<CR>"
2102-
call assert_equal('Hello', s)
2103-
call assert_equal(1, winnr('$'))
2104-
endfunc
2105-
2106-
func Test_cmdwin_ex_mode_with_modifier()
2107-
" this was accessing memory after allocated text in Ex mode
2108-
new
2109-
call setline(1, ['some', 'text', 'lines'])
2110-
silent! call feedkeys("gQnormal vq:atopleft\<C-V>\<CR>\<CR>", 'xt')
2111-
bwipe!
2112-
endfunc
2113-
21141838
" test that ";" works to find a match at the start of the first line
21151839
func Test_zero_line_search()
21161840
new

0 commit comments

Comments
 (0)