aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/testdir/test_functions.vim
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-07-19 22:27:36 +0800
committerGitHub <noreply@github.com>2022-07-19 22:27:36 +0800
commitb154d951e6c01919278bf77a4079396c2df471f4 (patch)
tree0cbf132a7edc4dc0b3a5bab76408f35c89536af1 /src/nvim/testdir/test_functions.vim
parent9e15bdde3ba8c84177d6d912eef3c0e056a76bb9 (diff)
parent358f9b776b48e854fdb714c76b24c5929bbd8544 (diff)
downloadrneovim-b154d951e6c01919278bf77a4079396c2df471f4.tar.gz
rneovim-b154d951e6c01919278bf77a4079396c2df471f4.tar.bz2
rneovim-b154d951e6c01919278bf77a4079396c2df471f4.zip
Merge pull request #19434 from zeertzjq/vim-8.2.0509
vim-patch:8.2.{0509,2632}: startup tests
Diffstat (limited to 'src/nvim/testdir/test_functions.vim')
-rw-r--r--src/nvim/testdir/test_functions.vim20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/nvim/testdir/test_functions.vim b/src/nvim/testdir/test_functions.vim
index 9b8d740efb..c11e7b4fea 100644
--- a/src/nvim/testdir/test_functions.vim
+++ b/src/nvim/testdir/test_functions.vim
@@ -547,6 +547,7 @@ func Save_mode()
return ''
endfunc
+" Test for the mode() function
func Test_mode()
new
call append(0, ["Blue Ball Black", "Brown Band Bowl", ""])
@@ -717,6 +718,8 @@ func Test_mode()
call assert_equal('c-c', g:current_modes)
call feedkeys("gQecho \<C-R>=Save_mode()\<CR>\<CR>vi\<CR>", 'xt')
call assert_equal('c-cv', g:current_modes)
+ " call feedkeys("Qcall Save_mode()\<CR>vi\<CR>", 'xt')
+ " call assert_equal('c-ce', g:current_modes)
" How to test Ex mode?
" Test mode in operatorfunc (it used to be Operator-pending).
@@ -1262,6 +1265,23 @@ func Test_inputlist()
call feedkeys(":let c = inputlist(['Select color:', '1. red', '2. green', '3. blue'])\<cr>5q", 'tx')
call assert_equal(0, c)
+ " Use backspace to delete characters in the prompt
+ call feedkeys(":let c = inputlist(['Select color:', '1. red', '2. green', '3. blue'])\<cr>1\<BS>3\<BS>2\<cr>", 'tx')
+ call assert_equal(2, c)
+
+ " Use mouse to make a selection
+ " call test_setmouse(&lines - 3, 2)
+ call nvim_input_mouse('left', 'press', '', 0, &lines - 4, 1) " set mouse position
+ call getchar() " discard mouse event but keep mouse position
+ call feedkeys(":let c = inputlist(['Select color:', '1. red', '2. green', '3. blue'])\<cr>\<LeftMouse>", 'tx')
+ call assert_equal(1, c)
+ " Mouse click outside of the list
+ " call test_setmouse(&lines - 6, 2)
+ call nvim_input_mouse('left', 'press', '', 0, &lines - 7, 1) " set mouse position
+ call getchar() " discard mouse event but keep mouse position
+ call feedkeys(":let c = inputlist(['Select color:', '1. red', '2. green', '3. blue'])\<cr>\<LeftMouse>", 'tx')
+ call assert_equal(-2, c)
+
call assert_fails('call inputlist("")', 'E686:')
endfunc