]> granicus.if.org Git - vim/commitdiff
patch 8.2.2608: character input not fully tested v8.2.2608
authorBram Moolenaar <Bram@vim.org>
Mon, 15 Mar 2021 17:36:20 +0000 (18:36 +0100)
committerBram Moolenaar <Bram@vim.org>
Mon, 15 Mar 2021 17:36:20 +0000 (18:36 +0100)
Problem:    Character input not fully tested.
Solution:   Add more tests. (Yegappan Lakshmanan, closes #7963)

src/testdir/test_functions.vim
src/testdir/test_messages.vim
src/testdir/test_paste.vim
src/testdir/test_registers.vim
src/testdir/test_undo.vim
src/version.c

index 64afe548178417a1d972e6576849cf5c24d2a4e6..ca57c3086b7913ab281f0215cfa0be2b0eecd39c 100644 (file)
@@ -1430,6 +1430,14 @@ func Test_input_func()
   delfunc Tcomplete
   call assert_equal('item1 item2 item3', c)
 
+  " Test for using special characters as default input
+  call feedkeys(":let c = input('name? ', \"x\<BS>y\")\<CR>\<CR>", 'xt')
+  call assert_equal('y', c)
+
+  " Test for using <CR> as default input
+  call feedkeys(":let c = input('name? ', \"\\<CR>\")\<CR>x\<CR>", 'xt')
+  call assert_equal(' x', c)
+
   call assert_fails("call input('F:', '', 'invalid')", 'E180:')
   call assert_fails("call input('F:', '', [])", 'E730:')
 endfunc
index 4f8c75112fda96d47522396ca0a4abc84906b4ba..375cb014611b97ec0eb08c51478e981bae4f5046 100644 (file)
@@ -259,6 +259,17 @@ func Test_message_more()
   call term_sendkeys(buf, 'q')
   call WaitForAssert({-> assert_equal('100', term_getline(buf, 5))})
 
+  " Execute a : command from the more prompt
+  call term_sendkeys(buf, ":%p#\n")
+  call term_wait(buf)
+  call WaitForAssert({-> assert_equal('-- More --', term_getline(buf, 6))})
+  call term_sendkeys(buf, ":")
+  call term_wait(buf)
+  call WaitForAssert({-> assert_equal(':', term_getline(buf, 6))})
+  call term_sendkeys(buf, "echo 'Hello'\n")
+  call term_wait(buf)
+  call WaitForAssert({-> assert_equal('Hello ', term_getline(buf, 5))})
+
   call StopVimInTerminal(buf)
 endfunc
 
index 8995b971ac702c0f6da24a2da1103801b092fb8d..df732f156fb5d4e99e97ea63bbb23f55e33cad87 100644 (file)
@@ -149,4 +149,18 @@ func Test_xrestore()
   bwipe!
 endfunc
 
+" Test for 'pastetoggle'
+func Test_pastetoggle()
+  new
+  set pastetoggle=<F4>
+  set nopaste
+  call feedkeys("iHello\<F4>", 'xt')
+  call assert_true(&paste)
+  call feedkeys("i\<F4>", 'xt')
+  call assert_false(&paste)
+  call assert_equal('Hello', getline(1))
+  set pastetoggle&
+  bwipe!
+endfunc
+
 " vim: shiftwidth=2 sts=2 expandtab
index b2916f4d06fab2defe394d02be8e5ffdd4be7b93..c10af294669ef8930f818e2e4141dc07c92f0933 100644 (file)
@@ -709,4 +709,14 @@ func Test_insert_small_delete()
   bwipe!
 endfunc
 
+" Record in insert mode using CTRL-O
+func Test_record_in_insert_mode()
+  new
+  let @r = ''
+  call setline(1, ['foo'])
+  call feedkeys("i\<C-O>qrbaz\<C-O>q", 'xt')
+  call assert_equal('baz', @r)
+  bwipe!
+endfunc
+
 " vim: shiftwidth=2 sts=2 expandtab
index dd4b902b93b9d584175e3494461b92b0e7b1b071..f12e1525c47dc9b2a8a8c5e9aa73af14a6dd4af9 100644 (file)
@@ -733,4 +733,18 @@ func Test_undofile_cryptmethod_blowfish2()
   set undofile& undolevels& cryptmethod&
 endfunc
 
+" Test for redoing with incrementing numbered registers
+func Test_redo_repeat_numbered_register()
+  new
+  for [i, v] in [[1, 'one'], [2, 'two'], [3, 'three'],
+        \ [4, 'four'], [5, 'five'], [6, 'six'],
+        \ [7, 'seven'], [8, 'eight'], [9, 'nine']]
+    exe 'let @' .. i .. '="' .. v .. '\n"'
+  endfor
+  call feedkeys('"1p.........', 'xt')
+  call assert_equal(['', 'one', 'two', 'three', 'four', 'five', 'six',
+        \ 'seven', 'eight', 'nine', 'nine'], getline(1, '$'))
+  bwipe!
+endfunc
+
 " vim: shiftwidth=2 sts=2 expandtab
index 0b1ece6a6417f6dd0b018267006ba11817e777ed..9d46da68ccdd5315efa2c79eab8448856dd30de4 100644 (file)
@@ -750,6 +750,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    2608,
 /**/
     2607,
 /**/