aboutsummaryrefslogtreecommitdiff
path: root/test/functional/normal
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/normal
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/normal')
-rw-r--r--test/functional/normal/count_spec.lua4
-rw-r--r--test/functional/normal/fold_spec.lua34
-rw-r--r--test/functional/normal/put_spec.lua24
-rw-r--r--test/functional/normal/undo_spec.lua4
4 files changed, 33 insertions, 33 deletions
diff --git a/test/functional/normal/count_spec.lua b/test/functional/normal/count_spec.lua
index 700e1f3e81..94f741250a 100644
--- a/test/functional/normal/count_spec.lua
+++ b/test/functional/normal/count_spec.lua
@@ -4,13 +4,13 @@ local eq = helpers.eq
local eval = helpers.eval
local feed = helpers.feed
local clear = helpers.clear
-local execute = helpers.execute
+local command = helpers.command
describe('v:count/v:count1', function()
before_each(function()
clear()
- execute('map <silent> _x :<C-u>let g:count = "v:count=". v:count .", v:count1=". v:count1<CR>')
+ command('map <silent> _x :<C-u>let g:count = "v:count=". v:count .", v:count1=". v:count1<CR>')
end)
describe('in cmdwin', function()
diff --git a/test/functional/normal/fold_spec.lua b/test/functional/normal/fold_spec.lua
index fc055c4e7a..85e4631b61 100644
--- a/test/functional/normal/fold_spec.lua
+++ b/test/functional/normal/fold_spec.lua
@@ -4,7 +4,7 @@ local clear = helpers.clear
local insert = helpers.insert
local feed = helpers.feed
local expect = helpers.expect
-local execute = helpers.execute
+local feed_command = helpers.feed_command
local funcs = helpers.funcs
local foldlevel = funcs.foldlevel
local foldclosedend = funcs.foldclosedend
@@ -13,7 +13,7 @@ local eq = helpers.eq
describe('Folds', function()
local tempfname = 'Xtest-fold.txt'
clear()
- before_each(function() execute('enew!') end)
+ before_each(function() feed_command('enew!') end)
after_each(function() os.remove(tempfname) end)
it('manual folding adjusts with filter', function()
insert([[
@@ -37,8 +37,8 @@ describe('Folds', function()
18
19
20]])
- execute('4,$fold', '%foldopen', '10,$fold', '%foldopen')
- execute('1,8! cat')
+ feed_command('4,$fold', '%foldopen', '10,$fold', '%foldopen')
+ feed_command('1,8! cat')
feed('5ggzdzMGdd')
expect([[
1
@@ -54,13 +54,13 @@ describe('Folds', function()
describe('adjusting folds after :move', function()
local function manually_fold_indent()
-- setting foldmethod twice is a trick to get vim to set the folds for me
- execute('set foldmethod=indent', 'set foldmethod=manual')
+ feed_command('set foldmethod=indent', 'set foldmethod=manual')
-- Ensure that all folds will get closed (makes it easier to test the
-- length of folds).
- execute('set foldminlines=0')
+ feed_command('set foldminlines=0')
-- Start with all folds open (so :move ranges aren't affected by closed
-- folds).
- execute('%foldopen!')
+ feed_command('%foldopen!')
end
local function get_folds()
@@ -75,16 +75,16 @@ describe('Folds', function()
-- This test is easy because we just need to ensure that the resulting
-- fold is the same as calculated when creating folds from scratch.
insert(insert_string)
- execute(move_command)
+ feed_command(move_command)
local after_move_folds = get_folds()
-- Doesn't change anything, but does call foldUpdateAll()
- execute('set foldminlines=0')
+ feed_command('set foldminlines=0')
eq(after_move_folds, get_folds())
-- Set up the buffer with insert_string for the manual fold testing.
- execute('enew!')
+ feed_command('enew!')
insert(insert_string)
manually_fold_indent()
- execute(move_command)
+ feed_command(move_command)
end
it('neither closes nor corrupts folds', function()
@@ -246,8 +246,8 @@ a]], '2,3m0')
a
a
]])
- execute('set foldmethod=indent', '2', '%foldopen')
- execute('read ' .. tempfname)
+ feed_command('set foldmethod=indent', '2', '%foldopen')
+ feed_command('read ' .. tempfname)
-- Just to check we have the correct file text.
expect([[
a
@@ -281,7 +281,7 @@ a]], '2,3m0')
a
a
]])
- execute('set foldmethod=indent', '3,5d')
+ feed_command('set foldmethod=indent', '3,5d')
eq(5, funcs.foldclosedend(1))
end)
it("doesn't combine folds that have a specified end", function()
@@ -295,7 +295,7 @@ a]], '2,3m0')
}}}
]])
- execute('set foldmethod=marker', '3,5d', '%foldclose')
+ feed_command('set foldmethod=marker', '3,5d', '%foldclose')
eq(2, funcs.foldclosedend(1))
end)
it('splits folds according to >N and <N with foldexpr', function()
@@ -331,8 +331,8 @@ a]], '2,3m0')
a
a
]])
- execute('set foldmethod=expr', 'set foldexpr=TestFoldExpr(v:lnum)', '2', 'foldopen')
- execute('read ' .. tempfname, '%foldclose')
+ feed_command('set foldmethod=expr', 'set foldexpr=TestFoldExpr(v:lnum)', '2', 'foldopen')
+ feed_command('read ' .. tempfname, '%foldclose')
eq(2, funcs.foldclosedend(1))
eq(0, funcs.foldlevel(3))
eq(0, funcs.foldlevel(4))
diff --git a/test/functional/normal/put_spec.lua b/test/functional/normal/put_spec.lua
index b3162364a6..148a35ec6b 100644
--- a/test/functional/normal/put_spec.lua
+++ b/test/functional/normal/put_spec.lua
@@ -8,23 +8,23 @@ local expect = helpers.expect
local eq = helpers.eq
local map = helpers.map
local filter = helpers.filter
-local execute = helpers.execute
+local feed_command = helpers.feed_command
local curbuf_contents = helpers.curbuf_contents
local funcs = helpers.funcs
local dedent = helpers.dedent
local getreg = funcs.getreg
local function reset()
- execute('enew!')
+ feed_command('enew!')
insert([[
Line of words 1
Line of words 2]])
- execute('goto 1')
+ feed_command('goto 1')
feed('itest_string.<esc>u')
funcs.setreg('a', 'test_stringa', 'V')
funcs.setreg('b', 'test_stringb\ntest_stringb\ntest_stringb', 'b')
funcs.setreg('"', 'test_string"', 'v')
- execute('set virtualedit=')
+ feed_command('set virtualedit=')
end
-- We check the last inserted register ". in each of these tests because it is
@@ -164,7 +164,7 @@ describe('put command', function()
local function create_put_action(command_base, substitution)
local temp_val = command_base:gsub('put', substitution)
return function()
- execute(temp_val)
+ feed_command(temp_val)
return true
end
end
@@ -642,7 +642,7 @@ describe('put command', function()
-- Set curswant to '8' to be at the end of the tab character
-- This is where the cursor is put back after the 'u' command.
funcs.setpos('.', {0, 2, 1, 0, 8})
- execute('set autoindent')
+ feed_command('set autoindent')
end
)
end)
@@ -653,7 +653,7 @@ describe('put command', function()
test_stringx" Line of words 2]]
run_normal_mode_tests(test_string, 'p', function()
funcs.setline('$', ' Line of words 2')
- execute('set virtualedit=all')
+ feed_command('set virtualedit=all')
funcs.setpos('.', {0, 2, 1, 2, 3})
end)
end)
@@ -664,7 +664,7 @@ describe('put command', function()
Line of words 2]]
run_normal_mode_tests(test_string, 'p', function()
funcs.setline('$', ' Line of words 2')
- execute('set virtualedit=all')
+ feed_command('set virtualedit=all')
funcs.setpos('.', {0, 1, 16, 1, 17})
end, true)
end)
@@ -829,7 +829,7 @@ describe('put command', function()
'vp',
function()
funcs.setline('$', ' Line of words 2')
- execute('set virtualedit=all')
+ feed_command('set virtualedit=all')
funcs.setpos('.', {0, 2, 1, 2, 3})
end,
nil,
@@ -844,7 +844,7 @@ describe('put command', function()
base_expect_string,
'vp',
function()
- execute('set virtualedit=all')
+ feed_command('set virtualedit=all')
funcs.setpos('.', {0, 1, 16, 2, 18})
end,
true,
@@ -906,7 +906,7 @@ describe('put command', function()
end)
it('should ring the bell when deleting if not appropriate', function()
- execute('goto 2')
+ feed_command('goto 2')
feed('i<bs><esc>')
expect([[
ine of words 1
@@ -921,7 +921,7 @@ describe('put command', function()
end)
it("should be unaffected by 'autoindent' with V\".2p", function()
- execute('set autoindent')
+ feed_command('set autoindent')
feed('i test_string.<esc>u')
feed('V".2p')
expect([[
diff --git a/test/functional/normal/undo_spec.lua b/test/functional/normal/undo_spec.lua
index 55429f2e1e..a023ca3d90 100644
--- a/test/functional/normal/undo_spec.lua
+++ b/test/functional/normal/undo_spec.lua
@@ -1,7 +1,7 @@
local helpers = require('test.functional.helpers')(after_each)
local clear = helpers.clear
-local execute = helpers.execute
+local command = helpers.command
local expect = helpers.expect
local feed = helpers.feed
local insert = helpers.insert
@@ -23,7 +23,7 @@ describe('u CTRL-R g- g+', function()
end
local function undo_and_redo(hist_pos, undo, redo, expect_str)
- execute('enew!')
+ command('enew!')
create_history(hist_pos)
local cur_contents = helpers.curbuf_contents()
feed(undo)