mirror of
https://github.com/vim/vim.git
synced 2025-09-26 04:04:07 -04:00
patch 8.2.0509: various code is not properly tested.
Problem: various code is not properly tested. Solution: Add more tests. (Yegappan Lakshmanan, closes #5871)
This commit is contained in:
@@ -659,6 +659,7 @@ func Save_mode()
|
||||
return ''
|
||||
endfunc
|
||||
|
||||
" Test for the mode() function
|
||||
func Test_mode()
|
||||
new
|
||||
call append(0, ["Blue Ball Black", "Brown Band Bowl", ""])
|
||||
@@ -782,6 +783,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?
|
||||
|
||||
bwipe!
|
||||
@@ -1284,6 +1287,19 @@ func Test_inputlist()
|
||||
call feedkeys(":let c = inputlist(['Select color:', '1. red', '2. green', '3. blue'])\<cr>3\<cr>", 'tx')
|
||||
call assert_equal(3, 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 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 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
|
||||
|
||||
|
Reference in New Issue
Block a user