Skip to content

Commit f4fcedc

Browse files
committed
patch 8.2.2608: character input not fully tested
Problem: Character input not fully tested. Solution: Add more tests. (Yegappan Lakshmanan, closes #7963)
1 parent 02b4d9b commit f4fcedc

6 files changed

Lines changed: 59 additions & 0 deletions

File tree

src/testdir/test_functions.vim

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1430,6 +1430,14 @@ func Test_input_func()
14301430
delfunc Tcomplete
14311431
call assert_equal('item1 item2 item3', c)
14321432

1433+
" Test for using special characters as default input
1434+
call feedkeys(":let c = input('name? ', \"x\<BS>y\")\<CR>\<CR>", 'xt')
1435+
call assert_equal('y', c)
1436+
1437+
" Test for using <CR> as default input
1438+
call feedkeys(":let c = input('name? ', \"\\<CR>\")\<CR>x\<CR>", 'xt')
1439+
call assert_equal(' x', c)
1440+
14331441
call assert_fails("call input('F:', '', 'invalid')", 'E180:')
14341442
call assert_fails("call input('F:', '', [])", 'E730:')
14351443
endfunc

src/testdir/test_messages.vim

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,17 @@ func Test_message_more()
259259
call term_sendkeys(buf, 'q')
260260
call WaitForAssert({-> assert_equal('100', term_getline(buf, 5))})
261261

262+
" Execute a : command from the more prompt
263+
call term_sendkeys(buf, ":%p#\n")
264+
call term_wait(buf)
265+
call WaitForAssert({-> assert_equal('-- More --', term_getline(buf, 6))})
266+
call term_sendkeys(buf, ":")
267+
call term_wait(buf)
268+
call WaitForAssert({-> assert_equal(':', term_getline(buf, 6))})
269+
call term_sendkeys(buf, "echo 'Hello'\n")
270+
call term_wait(buf)
271+
call WaitForAssert({-> assert_equal('Hello ', term_getline(buf, 5))})
272+
262273
call StopVimInTerminal(buf)
263274
endfunc
264275

src/testdir/test_paste.vim

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,4 +149,18 @@ func Test_xrestore()
149149
bwipe!
150150
endfunc
151151

152+
" Test for 'pastetoggle'
153+
func Test_pastetoggle()
154+
new
155+
set pastetoggle=<F4>
156+
set nopaste
157+
call feedkeys("iHello\<F4>", 'xt')
158+
call assert_true(&paste)
159+
call feedkeys("i\<F4>", 'xt')
160+
call assert_false(&paste)
161+
call assert_equal('Hello', getline(1))
162+
set pastetoggle&
163+
bwipe!
164+
endfunc
165+
152166
" vim: shiftwidth=2 sts=2 expandtab

src/testdir/test_registers.vim

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -709,4 +709,14 @@ func Test_insert_small_delete()
709709
bwipe!
710710
endfunc
711711

712+
" Record in insert mode using CTRL-O
713+
func Test_record_in_insert_mode()
714+
new
715+
let @r = ''
716+
call setline(1, ['foo'])
717+
call feedkeys("i\<C-O>qrbaz\<C-O>q", 'xt')
718+
call assert_equal('baz', @r)
719+
bwipe!
720+
endfunc
721+
712722
" vim: shiftwidth=2 sts=2 expandtab

src/testdir/test_undo.vim

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -733,4 +733,18 @@ func Test_undofile_cryptmethod_blowfish2()
733733
set undofile& undolevels& cryptmethod&
734734
endfunc
735735

736+
" Test for redoing with incrementing numbered registers
737+
func Test_redo_repeat_numbered_register()
738+
new
739+
for [i, v] in [[1, 'one'], [2, 'two'], [3, 'three'],
740+
\ [4, 'four'], [5, 'five'], [6, 'six'],
741+
\ [7, 'seven'], [8, 'eight'], [9, 'nine']]
742+
exe 'let @' .. i .. '="' .. v .. '\n"'
743+
endfor
744+
call feedkeys('"1p.........', 'xt')
745+
call assert_equal(['', 'one', 'two', 'three', 'four', 'five', 'six',
746+
\ 'seven', 'eight', 'nine', 'nine'], getline(1, '$'))
747+
bwipe!
748+
endfunc
749+
736750
" vim: shiftwidth=2 sts=2 expandtab

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -750,6 +750,8 @@ static char *(features[]) =
750750

751751
static int included_patches[] =
752752
{ /* Add new patch number below this line */
753+
/**/
754+
2608,
753755
/**/
754756
2607,
755757
/**/

0 commit comments

Comments
 (0)