diff options
author | Thiago de Arruda <tpadilha84@gmail.com> | 2014-11-21 13:06:03 -0300 |
---|---|---|
committer | Thiago de Arruda <tpadilha84@gmail.com> | 2014-11-21 15:39:04 -0300 |
commit | 179c51319df0bc6f75a1376a0ca337c34d0a0b87 (patch) | |
tree | bdc2c0cfa0ba4c441185a4c9d32e659969d4cbd3 /test/functional/legacy | |
parent | e15485c5d659977d0a8f20f7f7f319dac2423a0e (diff) | |
download | rneovim-179c51319df0bc6f75a1376a0ca337c34d0a0b87.tar.gz rneovim-179c51319df0bc6f75a1376a0ca337c34d0a0b87.tar.bz2 rneovim-179c51319df0bc6f75a1376a0ca337c34d0a0b87.zip |
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.
Diffstat (limited to 'test/functional/legacy')
-rw-r--r-- | test/functional/legacy/004_bufenter_with_modelines_spec.lua | 4 | ||||
-rw-r--r-- | test/functional/legacy/101_hlsearch_spec.lua | 3 |
2 files changed, 4 insertions, 3 deletions
diff --git a/test/functional/legacy/004_bufenter_with_modelines_spec.lua b/test/functional/legacy/004_bufenter_with_modelines_spec.lua index f1222700a7..6f009b52dd 100644 --- a/test/functional/legacy/004_bufenter_with_modelines_spec.lua +++ b/test/functional/legacy/004_bufenter_with_modelines_spec.lua @@ -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') diff --git a/test/functional/legacy/101_hlsearch_spec.lua b/test/functional/legacy/101_hlsearch_spec.lua index 4a3abb19ce..3c44f02edb 100644 --- a/test/functional/legacy/101_hlsearch_spec.lua +++ b/test/functional/legacy/101_hlsearch_spec.lua @@ -3,6 +3,7 @@ local helpers = require('test.functional.helpers') local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert local execute, expect = helpers.execute, helpers.expect +local eval = helpers.eval describe('v:hlsearch', function() setup(clear) @@ -44,7 +45,7 @@ describe('v:hlsearch', function() execute('$put=r') execute('call garbagecollect(1)') execute('call getchar()') - execute('1d') + execute('1d', '1d') -- Assert buffer contents. expect([[ |