aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/testdir
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2019-09-03 04:49:30 -0700
committerGitHub <noreply@github.com>2019-09-03 04:49:30 -0700
commit03be64ce2ac1bd941996024a5bd0e3f9fa974445 (patch)
tree04dd2584d0eecdf8ffa9e675a8a5c7f24c6fc89a /src/nvim/testdir
parentdcc8fcf0b9d819357d5ec9beb36cf698e600e809 (diff)
parent7199f0b3b3e31c1c3b96d17d6f1f959d1db5ce76 (diff)
downloadrneovim-03be64ce2ac1bd941996024a5bd0e3f9fa974445.tar.gz
rneovim-03be64ce2ac1bd941996024a5bd0e3f9fa974445.tar.bz2
rneovim-03be64ce2ac1bd941996024a5bd0e3f9fa974445.zip
Merge #10921 from janlazo/vim-8.0.1768
vim-patch:8.0.{1768,1806},8.1.{46,1063}
Diffstat (limited to 'src/nvim/testdir')
-rw-r--r--src/nvim/testdir/test_cmdline.vim44
-rw-r--r--src/nvim/testdir/test_mksession.vim11
-rw-r--r--src/nvim/testdir/test_popup.vim30
3 files changed, 79 insertions, 6 deletions
diff --git a/src/nvim/testdir/test_cmdline.vim b/src/nvim/testdir/test_cmdline.vim
index f43ea0e923..e6aafd964b 100644
--- a/src/nvim/testdir/test_cmdline.vim
+++ b/src/nvim/testdir/test_cmdline.vim
@@ -15,14 +15,48 @@ func Test_complete_list()
endfunc
func Test_complete_wildmenu()
- call writefile(['testfile1'], 'Xtestfile1')
- call writefile(['testfile2'], 'Xtestfile2')
+ call mkdir('Xdir1/Xdir2', 'p')
+ call writefile(['testfile1'], 'Xdir1/Xtestfile1')
+ call writefile(['testfile2'], 'Xdir1/Xtestfile2')
+ call writefile(['testfile3'], 'Xdir1/Xdir2/Xtestfile3')
+ call writefile(['testfile3'], 'Xdir1/Xdir2/Xtestfile4')
set wildmenu
- call feedkeys(":e Xtestf\t\t\r", "tx")
+
+ " Pressing <Tab> completes, and moves to next files when pressing again.
+ call feedkeys(":e Xdir1/\<Tab>\<Tab>\<CR>", 'tx')
+ call assert_equal('testfile1', getline(1))
+ call feedkeys(":e Xdir1/\<Tab>\<Tab>\<Tab>\<CR>", 'tx')
+ call assert_equal('testfile2', getline(1))
+
+ " <S-Tab> is like <Tab> but begin with the last match and then go to
+ " previous.
+ call feedkeys(":e Xdir1/Xtest\<S-Tab>\<CR>", 'tx')
call assert_equal('testfile2', getline(1))
+ call feedkeys(":e Xdir1/Xtest\<S-Tab>\<S-Tab>\<CR>", 'tx')
+ call assert_equal('testfile1', getline(1))
- call delete('Xtestfile1')
- call delete('Xtestfile2')
+ " <Left>/<Right> to move to previous/next file.
+ call feedkeys(":e Xdir1/\<Tab>\<Right>\<CR>", 'tx')
+ call assert_equal('testfile1', getline(1))
+ call feedkeys(":e Xdir1/\<Tab>\<Right>\<Right>\<CR>", 'tx')
+ call assert_equal('testfile2', getline(1))
+ call feedkeys(":e Xdir1/\<Tab>\<Right>\<Right>\<Left>\<CR>", 'tx')
+ call assert_equal('testfile1', getline(1))
+
+ " <Up>/<Down> to go up/down directories.
+ call feedkeys(":e Xdir1/\<Tab>\<Down>\<CR>", 'tx')
+ call assert_equal('testfile3', getline(1))
+ call feedkeys(":e Xdir1/\<Tab>\<Down>\<Up>\<Right>\<CR>", 'tx')
+ call assert_equal('testfile1', getline(1))
+
+ " cleanup
+ %bwipe
+ call delete('Xdir1/Xdir2/Xtestfile4')
+ call delete('Xdir1/Xdir2/Xtestfile3')
+ call delete('Xdir1/Xtestfile2')
+ call delete('Xdir1/Xtestfile1')
+ call delete('Xdir1/Xdir2', 'd')
+ call delete('Xdir1', 'd')
set nowildmenu
endfunc
diff --git a/src/nvim/testdir/test_mksession.vim b/src/nvim/testdir/test_mksession.vim
index 0e56ed2ff3..b7169444d1 100644
--- a/src/nvim/testdir/test_mksession.vim
+++ b/src/nvim/testdir/test_mksession.vim
@@ -106,13 +106,22 @@ endfunc
func Test_mksession_winheight()
new
- set winheight=10 winminheight=2
+ set winheight=10
+ set winminheight=2
mksession! Xtest_mks.out
source Xtest_mks.out
call delete('Xtest_mks.out')
endfunc
+func Test_mksession_large_winheight()
+ set winheight=999
+ mksession! Xtest_mks_winheight.out
+ set winheight&
+ source Xtest_mks_winheight.out
+ call delete('Xtest_mks_winheight.out')
+endfunc
+
" Verify that arglist is stored correctly to the session file.
func Test_mksession_arglist()
argdel *
diff --git a/src/nvim/testdir/test_popup.vim b/src/nvim/testdir/test_popup.vim
index 162df4b76e..53df30bb19 100644
--- a/src/nvim/testdir/test_popup.vim
+++ b/src/nvim/testdir/test_popup.vim
@@ -746,6 +746,36 @@ func Test_popup_complete_backwards()
bwipe!
endfunc
+fun! Test_complete_o_tab()
+ throw 'skipped: Nvim does not support test_override()'
+ let s:o_char_pressed = 0
+
+ fun! s:act_on_text_changed()
+ if s:o_char_pressed
+ let s:o_char_pressed = 0
+ call feedkeys("\<c-x>\<c-n>", 'i')
+ endif
+ endf
+
+ set completeopt=menu,noselect
+ new
+ imap <expr> <buffer> <tab> pumvisible() ? "\<c-p>" : "X"
+ autocmd! InsertCharPre <buffer> let s:o_char_pressed = (v:char ==# 'o')
+ autocmd! TextChangedI <buffer> call <sid>act_on_text_changed()
+ call setline(1, ['hoard', 'hoax', 'hoarse', ''])
+ let l:expected = ['hoard', 'hoax', 'hoarse', 'hoax', 'hoax']
+ call cursor(4,1)
+ call test_override("char_avail", 1)
+ call feedkeys("Ahoa\<tab>\<tab>\<c-y>\<esc>", 'tx')
+ call feedkeys("oho\<tab>\<tab>\<c-y>\<esc>", 'tx')
+ call assert_equal(l:expected, getline(1,'$'))
+
+ call test_override("char_avail", 0)
+ bwipe!
+ set completeopt&
+ delfunc s:act_on_text_changed
+endf
+
func Test_popup_complete_info_01()
new
inoremap <buffer><F5> <C-R>=complete_info().mode<CR>