aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/testdir
diff options
context:
space:
mode:
authorJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2020-12-27 17:14:31 -0500
committerGitHub <noreply@github.com>2020-12-27 17:14:31 -0500
commita58c5509d94f01f4a4edd6b4784f8d00b70af5b3 (patch)
treeb3cadc41e6fd4c747de5635dc0fb7556ec5e6e13 /src/nvim/testdir
parentf2be59d8f80f2a1a68d5976b9cec3fa55da3700e (diff)
parentcff4cad25a1236bd869843f9578b7f276518d9b8 (diff)
downloadrneovim-a58c5509d94f01f4a4edd6b4784f8d00b70af5b3.tar.gz
rneovim-a58c5509d94f01f4a4edd6b4784f8d00b70af5b3.tar.bz2
rneovim-a58c5509d94f01f4a4edd6b4784f8d00b70af5b3.zip
Merge pull request #13607 from janlazo/vim-8.2.2221
vim-patch:8.1.2227,8.2.{315,928,1007,1052,1121,1580,2221,2229,2231,2232}
Diffstat (limited to 'src/nvim/testdir')
-rw-r--r--src/nvim/testdir/test_clientserver.vim9
-rw-r--r--src/nvim/testdir/test_cmdline.vim88
2 files changed, 97 insertions, 0 deletions
diff --git a/src/nvim/testdir/test_clientserver.vim b/src/nvim/testdir/test_clientserver.vim
index 3377f86126..53704bd094 100644
--- a/src/nvim/testdir/test_clientserver.vim
+++ b/src/nvim/testdir/test_clientserver.vim
@@ -61,6 +61,15 @@ func Test_client_server()
call assert_fails('call remote_send("XXX", ":let testvar = ''yes''\<CR>")', 'E241')
+ call writefile(['one'], 'Xclientfile')
+ let cmd = GetVimProg() .. ' --servername ' .. name .. ' --remote Xclientfile'
+ call system(cmd)
+ call WaitForAssert({-> assert_equal('Xclientfile', remote_expr(name, "bufname()", "", 2))})
+ call WaitForAssert({-> assert_equal('one', remote_expr(name, "getline(1)", "", 2))})
+ call writefile(['one', 'two'], 'Xclientfile')
+ call system(cmd)
+ call WaitForAssert({-> assert_equal('two', remote_expr(name, "getline(2)", "", 2))})
+
" Expression evaluated locally.
if v:servername == ''
call remote_startserver('MYSELF')
diff --git a/src/nvim/testdir/test_cmdline.vim b/src/nvim/testdir/test_cmdline.vim
index 8fc3361b79..bb0cae4819 100644
--- a/src/nvim/testdir/test_cmdline.vim
+++ b/src/nvim/testdir/test_cmdline.vim
@@ -51,6 +51,19 @@ func Test_complete_wildmenu()
call feedkeys(":e Xdir1/\<Tab>\<Down>\<Up>\<Right>\<CR>", 'tx')
call assert_equal('testfile1', getline(1))
+ + " <C-J>/<C-K> mappings to go up/down directories when 'wildcharm' is
+ " different than 'wildchar'.
+ set wildcharm=<C-Z>
+ cnoremap <C-J> <Down><C-Z>
+ cnoremap <C-K> <Up><C-Z>
+ call feedkeys(":e Xdir1/\<Tab>\<C-J>\<CR>", 'tx')
+ call assert_equal('testfile3', getline(1))
+ call feedkeys(":e Xdir1/\<Tab>\<C-J>\<C-K>\<CR>", 'tx')
+ call assert_equal('testfile1', getline(1))
+ set wildcharm=0
+ cunmap <C-J>
+ cunmap <C-K>
+
" cleanup
%bwipe
call delete('Xdir1/Xdir2/Xtestfile4')
@@ -62,6 +75,33 @@ func Test_complete_wildmenu()
set nowildmenu
endfunc
+func Test_wildmenu_screendump()
+ CheckScreendump
+
+ let lines =<< trim [SCRIPT]
+ set wildmenu hlsearch
+ [SCRIPT]
+ call writefile(lines, 'XTest_wildmenu')
+
+ let buf = RunVimInTerminal('-S XTest_wildmenu', {'rows': 8})
+ call term_sendkeys(buf, ":vim\<Tab>")
+ call VerifyScreenDump(buf, 'Test_wildmenu_1', {})
+
+ call term_sendkeys(buf, "\<Tab>")
+ call VerifyScreenDump(buf, 'Test_wildmenu_2', {})
+
+ call term_sendkeys(buf, "\<Tab>")
+ call VerifyScreenDump(buf, 'Test_wildmenu_3', {})
+
+ call term_sendkeys(buf, "\<Tab>")
+ call VerifyScreenDump(buf, 'Test_wildmenu_4', {})
+ call term_sendkeys(buf, "\<Esc>")
+
+ " clean up
+ call StopVimInTerminal(buf)
+ call delete('XTest_wildmenu')
+endfunc
+
func Test_map_completion()
if !has('cmdline_compl')
return
@@ -837,6 +877,36 @@ func Test_cmdwin_cedit()
delfunc CmdWinType
endfunc
+func Test_cmdwin_restore()
+ CheckScreendump
+
+ let lines =<< trim [SCRIPT]
+ call setline(1, range(30))
+ 2split
+ [SCRIPT]
+ call writefile(lines, 'XTest_restore')
+
+ let buf = RunVimInTerminal('-S XTest_restore', {'rows': 12})
+ call term_wait(buf, 100)
+ 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_buffers_lastused()
" check that buffers are sorted by time when wildmode has lastused
edit bufc " oldest
@@ -912,5 +982,23 @@ func Test_zero_line_search()
q!
endfunc
+func Test_read_shellcmd()
+ CheckUnix
+ if executable('ls')
+ " There should be ls in the $PATH
+ call feedkeys(":r! l\<c-a>\<c-b>\"\<cr>", 'tx')
+ call assert_match('^"r! .*\<ls\>', @:)
+ endif
+
+ if executable('rm')
+ call feedkeys(":r! ++enc=utf-8 r\<c-a>\<c-b>\"\<cr>", 'tx')
+ call assert_notmatch('^"r!.*\<runtest.vim\>', @:)
+ call assert_match('^"r!.*\<rm\>', @:)
+
+ call feedkeys(":r ++enc=utf-8 !rm\<c-a>\<c-b>\"\<cr>", 'tx')
+ call assert_notmatch('^"r.*\<runtest.vim\>', @:)
+ call assert_match('^"r ++enc\S\+ !.*\<rm\>', @:)
+ endif
+endfunc
" vim: shiftwidth=2 sts=2 expandtab " vim: shiftwidth=2 sts=2 expandtab