test: Refactor functional helpers to use vim_input

The vim_input function accepts raw terminal input and so is better to emulate
real user, especially because it is not deferred as vim_feedkeys.

Using this function required a number of changes:

- expect() was refactored to use curbuf_contents()
- The vim_eval function in request() was moved to curbuf_contents(). For most
  cases this is enough(we only care for synchronizing api calls with user input
  when verifying buffer contents).
- <C-@>(NUL) is preprocessed before being passed to replace_termcodes.
- Legacy test 4 had a bug that only became visible when using vim_input, it is
  fixed now.
- An extra blank line deletion was required for test 101

The last two items show that vim_feedkeys because it is not 100% equivalent to
receiving terminal input.
This commit is contained in:
Thiago de Arruda
2014-11-21 13:06:03 -03:00
parent e15485c5d6
commit 179c51319d
4 changed files with 29 additions and 29 deletions

View File

@@ -31,7 +31,7 @@ describe('BufEnter with modelines', function()
execute('sp Xxx')
-- Append text with autoindent to this file
feed('G?this is a<Esc>')
feed('G?this is a<CR>')
feed('othis should be auto-indented<Esc>')
-- Go to Xxx, no autocmd anymore
@@ -39,7 +39,7 @@ describe('BufEnter with modelines', function()
execute('buf Xxx')
-- Append text without autoindent to Xxx
feed('G?this is a<Esc>')
feed('G?this is a<CR>')
feed('othis should be in column 1<Esc>')
execute('wq')