aboutsummaryrefslogtreecommitdiff
path: root/test/functional/legacy/101_hlsearch_spec.lua
diff options
context:
space:
mode:
authorZyX <kp-pav@yandex.ru>2017-04-09 00:12:26 +0300
committerZyX <kp-pav@yandex.ru>2017-04-09 03:24:08 +0300
commit65fb622000af8e3dbb65480e1581758ecf4ba3e2 (patch)
tree7d83429d3762b1f0a44d04eb8fc780eedc0ec049 /test/functional/legacy/101_hlsearch_spec.lua
parent9158cc171f46ebae0a0d3d1721aa5b7d829bcba5 (diff)
downloadrneovim-65fb622000af8e3dbb65480e1581758ecf4ba3e2.tar.gz
rneovim-65fb622000af8e3dbb65480e1581758ecf4ba3e2.tar.bz2
rneovim-65fb622000af8e3dbb65480e1581758ecf4ba3e2.zip
functests: Replace execute with either command or feed_command
Hope this will make people using feed_command less likely: this hides bugs. Already found at least two: 1. msgpackparse() will show internal error: hash_add() in case of duplicate keys, though it will still work correctly. Currently silenced. 2. ttimeoutlen was spelled incorrectly, resulting in option not being set when expected. Test was still functioning somehow though. Currently fixed.
Diffstat (limited to 'test/functional/legacy/101_hlsearch_spec.lua')
-rw-r--r--test/functional/legacy/101_hlsearch_spec.lua74
1 files changed, 37 insertions, 37 deletions
diff --git a/test/functional/legacy/101_hlsearch_spec.lua b/test/functional/legacy/101_hlsearch_spec.lua
index fa29e5fbe8..eff755221c 100644
--- a/test/functional/legacy/101_hlsearch_spec.lua
+++ b/test/functional/legacy/101_hlsearch_spec.lua
@@ -2,52 +2,52 @@
local helpers = require('test.functional.helpers')(after_each)
local clear, feed = helpers.clear, helpers.feed
-local execute, expect = helpers.execute, helpers.expect
+local feed_command, expect = helpers.feed_command, helpers.expect
describe('v:hlsearch', function()
setup(clear)
it('is working', function()
-- Last abc: Q
- execute('new')
- execute([[call setline(1, repeat(['aaa'], 10))]])
- execute('set hlsearch nolazyredraw')
- execute('let r=[]')
- execute('command -nargs=0 -bar AddR :call add(r, [screenattr(1, 1), v:hlsearch])')
- execute('/aaa')
- execute('AddR')
- execute('nohlsearch')
- execute('AddR')
- execute('let v:hlsearch=1')
- execute('AddR')
- execute('let v:hlsearch=0')
- execute('AddR')
- execute('set hlsearch')
- execute('AddR')
- execute('let v:hlsearch=0')
- execute('AddR')
+ feed_command('new')
+ feed_command([[call setline(1, repeat(['aaa'], 10))]])
+ feed_command('set hlsearch nolazyredraw')
+ feed_command('let r=[]')
+ feed_command('command -nargs=0 -bar AddR :call add(r, [screenattr(1, 1), v:hlsearch])')
+ feed_command('/aaa')
+ feed_command('AddR')
+ feed_command('nohlsearch')
+ feed_command('AddR')
+ feed_command('let v:hlsearch=1')
+ feed_command('AddR')
+ feed_command('let v:hlsearch=0')
+ feed_command('AddR')
+ feed_command('set hlsearch')
+ feed_command('AddR')
+ feed_command('let v:hlsearch=0')
+ feed_command('AddR')
feed('n:AddR<cr>')
- execute('let v:hlsearch=0')
- execute('AddR')
- execute('/')
- execute('AddR')
- execute('set nohls')
- execute('/')
- execute('AddR')
- execute('let r1=r[0][0]')
+ feed_command('let v:hlsearch=0')
+ feed_command('AddR')
+ feed_command('/')
+ feed_command('AddR')
+ feed_command('set nohls')
+ feed_command('/')
+ feed_command('AddR')
+ feed_command('let r1=r[0][0]')
-- I guess it is not guaranteed that screenattr outputs always the same character
- execute([[call map(r, 'v:val[1].":".(v:val[0]==r1?"highlighted":"not highlighted")')]])
- execute('try')
- execute(' let v:hlsearch=[]')
- execute('catch')
- execute([[ call add(r, matchstr(v:exception,'^Vim(let):E\d\+:'))]])
- execute('endtry')
- execute('bwipeout!')
- execute('$put=r')
- execute('call garbagecollect(1)')
- execute('call getchar()')
- execute('1d', '1d')
+ feed_command([[call map(r, 'v:val[1].":".(v:val[0]==r1?"highlighted":"not highlighted")')]])
+ feed_command('try')
+ feed_command(' let v:hlsearch=[]')
+ feed_command('catch')
+ feed_command([[ call add(r, matchstr(v:exception,'^Vim(let):E\d\+:'))]])
+ feed_command('endtry')
+ feed_command('bwipeout!')
+ feed_command('$put=r')
+ feed_command('call garbagecollect(1)')
+ feed_command('call getchar()')
+ feed_command('1d', '1d')
-- Assert buffer contents.
expect([[