view src/testdir/test_feedkeys.vim @ 29234:96ff6c230a66 v8.2.5136

patch 8.2.5136: debugger test fails when run with valgrind Commit: https://github.com/vim/vim/commit/e366ed4f2c6fa8cb663f1b9599b39d57ddbd8a2a Author: Bram Moolenaar <Bram@vim.org> Date: Sun Jun 19 20:13:56 2022 +0100 patch 8.2.5136: debugger test fails when run with valgrind Problem: Debugger test fails when run with valgrind. Solution: Wait longer when using valgrind.
author Bram Moolenaar <Bram@vim.org>
date Sun, 19 Jun 2022 21:15:03 +0200
parents 53c608c7ea9e
children
line wrap: on
line source

" Test feedkeys() function.

func Test_feedkeys_x_with_empty_string()
  new
  call feedkeys("ifoo\<Esc>")
  call assert_equal('', getline('.'))
  call feedkeys('', 'x')
  call assert_equal('foo', getline('.'))

  " check it goes back to normal mode immediately.
  call feedkeys('i', 'x')
  call assert_equal('foo', getline('.'))
  quit!
endfunc

func Test_feedkeys_with_abbreviation()
  new
  inoreabbrev trigger value
  call feedkeys("atrigger ", 'x')
  call feedkeys("atrigger ", 'x')
  call assert_equal('value value ', getline(1))
  bwipe!
  iunabbrev trigger
endfunc

func Test_feedkeys_escape_special()
  nnoremap … <Cmd>let g:got_ellipsis += 1<CR>
  call feedkeys('…', 't')
  call assert_equal('…', getcharstr())
  let g:got_ellipsis = 0
  call feedkeys('…', 'xt')
  call assert_equal(1, g:got_ellipsis)
  unlet g:got_ellipsis
  nunmap …
endfunc

" vim: shiftwidth=2 sts=2 expandtab