aboutsummaryrefslogtreecommitdiff
path: root/test/functional/ex_cmds
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/ex_cmds
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/ex_cmds')
-rw-r--r--test/functional/ex_cmds/arg_spec.lua8
-rw-r--r--test/functional/ex_cmds/bang_filter_spec.lua4
-rw-r--r--test/functional/ex_cmds/cd_spec.lua54
-rw-r--r--test/functional/ex_cmds/ctrl_c_spec.lua4
-rw-r--r--test/functional/ex_cmds/drop_spec.lua22
-rw-r--r--test/functional/ex_cmds/edit_spec.lua9
-rw-r--r--test/functional/ex_cmds/encoding_spec.lua6
-rw-r--r--test/functional/ex_cmds/grep_spec.lua10
-rw-r--r--test/functional/ex_cmds/menu_spec.lua16
-rw-r--r--test/functional/ex_cmds/oldfiles_spec.lua22
-rw-r--r--test/functional/ex_cmds/recover_spec.lua18
-rw-r--r--test/functional/ex_cmds/undojoin_spec.lua8
-rw-r--r--test/functional/ex_cmds/write_spec.lua15
-rw-r--r--test/functional/ex_cmds/wundo_spec.lua15
-rw-r--r--test/functional/ex_cmds/wviminfo_spec.lua12
15 files changed, 112 insertions, 111 deletions
diff --git a/test/functional/ex_cmds/arg_spec.lua b/test/functional/ex_cmds/arg_spec.lua
index e11b90532f..6d31f05c2a 100644
--- a/test/functional/ex_cmds/arg_spec.lua
+++ b/test/functional/ex_cmds/arg_spec.lua
@@ -1,5 +1,5 @@
local helpers = require("test.functional.helpers")(after_each)
-local eq, execute, funcs = helpers.eq, helpers.execute, helpers.funcs
+local eq, command, funcs = helpers.eq, helpers.command, helpers.funcs
local ok = helpers.ok
local clear = helpers.clear
@@ -9,15 +9,15 @@ describe(":argument", function()
end)
it("does not restart :terminal buffer", function()
- execute("terminal")
+ command("terminal")
helpers.feed([[<C-\><C-N>]])
- execute("argadd")
+ command("argadd")
helpers.feed([[<C-\><C-N>]])
local bufname_before = funcs.bufname("%")
local bufnr_before = funcs.bufnr("%")
helpers.ok(nil ~= string.find(bufname_before, "^term://")) -- sanity
- execute("argument 1")
+ command("argument 1")
helpers.feed([[<C-\><C-N>]])
local bufname_after = funcs.bufname("%")
diff --git a/test/functional/ex_cmds/bang_filter_spec.lua b/test/functional/ex_cmds/bang_filter_spec.lua
index a320e6d018..aaec983b73 100644
--- a/test/functional/ex_cmds/bang_filter_spec.lua
+++ b/test/functional/ex_cmds/bang_filter_spec.lua
@@ -1,7 +1,7 @@
-- Specs for bang/filter commands
local helpers = require('test.functional.helpers')(after_each)
-local feed, execute, clear = helpers.feed, helpers.execute, helpers.clear
+local feed, command, clear = helpers.feed, helpers.command, helpers.clear
local mkdir, write_file, rmdir = helpers.mkdir, helpers.write_file, helpers.rmdir
if helpers.pending_win32(pending) then return end
@@ -28,7 +28,7 @@ describe('issues', function()
end)
it('#3269 Last line of shell output is not truncated', function()
- execute([[nnoremap <silent>\l :!ls bang_filter_spec<cr>]])
+ command([[nnoremap <silent>\l :!ls bang_filter_spec<cr>]])
feed([[\l]])
screen:expect([[
~ |
diff --git a/test/functional/ex_cmds/cd_spec.lua b/test/functional/ex_cmds/cd_spec.lua
index 5bf4d22d0f..059cb26d5d 100644
--- a/test/functional/ex_cmds/cd_spec.lua
+++ b/test/functional/ex_cmds/cd_spec.lua
@@ -6,7 +6,7 @@ local helpers = require('test.functional.helpers')(after_each)
local eq = helpers.eq
local call = helpers.call
local clear = helpers.clear
-local execute = helpers.execute
+local command = helpers.command
local exc_exec = helpers.exc_exec
if helpers.pending_win32(pending) then return end
@@ -58,7 +58,7 @@ for _, cmd in ipairs {'cd', 'chdir'} do
eq(0, lwd(globalwin))
eq(0, lwd(globalwin, tabnr))
- execute('bot split')
+ command('bot split')
local localwin = call('winnr')
-- Initial window is still using globalDir
eq(globalDir, cwd(localwin))
@@ -66,7 +66,7 @@ for _, cmd in ipairs {'cd', 'chdir'} do
eq(0, lwd(globalwin))
eq(0, lwd(globalwin, tabnr))
- execute('silent l' .. cmd .. ' ' .. directories.window)
+ command('silent l' .. cmd .. ' ' .. directories.window)
-- From window with local dir, the original window
-- is still reporting the global dir
eq(globalDir, cwd(globalwin))
@@ -80,7 +80,7 @@ for _, cmd in ipairs {'cd', 'chdir'} do
eq(1, lwd(localwin))
eq(1, lwd(localwin, tabnr))
- execute('tabnew')
+ command('tabnew')
-- From new tab page, original window reports global dir
eq(globalDir, cwd(globalwin, tabnr))
eq(0, lwd(globalwin, tabnr))
@@ -100,8 +100,8 @@ for _, cmd in ipairs {'cd', 'chdir'} do
eq(0, lwd(-1, 0))
eq(0, lwd(-1, globaltab))
- execute('tabnew')
- execute('silent t' .. cmd .. ' ' .. directories.tab)
+ command('tabnew')
+ command('silent t' .. cmd .. ' ' .. directories.tab)
local localtab = call('tabpagenr')
-- From local tab page, original tab reports globalDir
@@ -114,7 +114,7 @@ for _, cmd in ipairs {'cd', 'chdir'} do
eq(1, lwd(-1, 0))
eq(1, lwd(-1, localtab))
- execute('tabnext')
+ command('tabnext')
-- From original tab page, local reports as such
eq(globalDir .. '/' .. directories.tab, cwd(-1, localtab))
eq(1, lwd(-1, localtab))
@@ -128,13 +128,13 @@ for _, cmd in ipairs {'cd', 'chdir'} do
end)
it('works with tab-local pwd', function()
- execute('silent t' .. cmd .. ' ' .. directories.tab)
+ command('silent t' .. cmd .. ' ' .. directories.tab)
eq(directories.start, cwd(-1, -1))
eq(0, lwd(-1, -1))
end)
it('works with window-local pwd', function()
- execute('silent l' .. cmd .. ' ' .. directories.window)
+ command('silent l' .. cmd .. ' ' .. directories.window)
eq(directories.start, cwd(-1, -1))
eq(0, lwd(-1, -1))
end)
@@ -145,18 +145,18 @@ for _, cmd in ipairs {'cd', 'chdir'} do
local globalDir = directories.start
-- Create a new tab and change directory
- execute('tabnew')
- execute('silent t' .. cmd .. ' ' .. directories.tab)
+ command('tabnew')
+ command('silent t' .. cmd .. ' ' .. directories.tab)
eq(globalDir .. '/' .. directories.tab, tcwd())
-- Create a new tab and verify it has inherited the directory
- execute('tabnew')
+ command('tabnew')
eq(globalDir .. '/' .. directories.tab, tcwd())
-- Change tab and change back, verify that directories are correct
- execute('tabnext')
+ command('tabnext')
eq(globalDir, tcwd())
- execute('tabprevious')
+ command('tabprevious')
eq(globalDir .. '/' .. directories.tab, tcwd())
end)
end)
@@ -164,7 +164,7 @@ for _, cmd in ipairs {'cd', 'chdir'} do
it('works', function()
local globalDir = directories.start
-- Create a new tab first and verify that is has the same working dir
- execute('tabnew')
+ command('tabnew')
eq(globalDir, cwd())
eq(globalDir, tcwd()) -- has no tab-local directory
eq(0, tlwd())
@@ -172,7 +172,7 @@ for _, cmd in ipairs {'cd', 'chdir'} do
eq(0, wlwd())
-- Change tab-local working directory and verify it is different
- execute('silent t' .. cmd .. ' ' .. directories.tab)
+ command('silent t' .. cmd .. ' ' .. directories.tab)
eq(globalDir .. '/' .. directories.tab, cwd())
eq(cwd(), tcwd()) -- working directory maches tab directory
eq(1, tlwd())
@@ -180,46 +180,46 @@ for _, cmd in ipairs {'cd', 'chdir'} do
eq(0, wlwd())
-- Create a new window in this tab to test `:lcd`
- execute('new')
+ command('new')
eq(1, tlwd()) -- Still tab-local working directory
eq(0, wlwd()) -- Still no window-local working directory
eq(globalDir .. '/' .. directories.tab, cwd())
- execute('silent l' .. cmd .. ' ../' .. directories.window)
+ command('silent l' .. cmd .. ' ../' .. directories.window)
eq(globalDir .. '/' .. directories.window, cwd())
eq(globalDir .. '/' .. directories.tab, tcwd())
eq(1, wlwd())
-- Verify the first window still has the tab local directory
- execute('wincmd w')
+ command('wincmd w')
eq(globalDir .. '/' .. directories.tab, cwd())
eq(globalDir .. '/' .. directories.tab, tcwd())
eq(0, wlwd()) -- No window-local directory
-- Change back to initial tab and verify working directory has stayed
- execute('tabnext')
+ command('tabnext')
eq(globalDir, cwd() )
eq(0, tlwd())
eq(0, wlwd())
-- Verify global changes don't affect local ones
- execute('silent ' .. cmd .. ' ' .. directories.global)
+ command('silent ' .. cmd .. ' ' .. directories.global)
eq(globalDir .. '/' .. directories.global, cwd())
- execute('tabnext')
+ command('tabnext')
eq(globalDir .. '/' .. directories.tab, cwd())
eq(globalDir .. '/' .. directories.tab, tcwd())
eq(0, wlwd()) -- Still no window-local directory in this window
-- Unless the global change happened in a tab with local directory
- execute('silent ' .. cmd .. ' ..')
+ command('silent ' .. cmd .. ' ..')
eq(globalDir, cwd() )
eq(0 , tlwd())
eq(0 , wlwd())
-- Which also affects the first tab
- execute('tabnext')
+ command('tabnext')
eq(globalDir, cwd())
-- But not in a window with its own local directory
- execute('tabnext | wincmd w')
+ command('tabnext | wincmd w')
eq(globalDir .. '/' .. directories.window, cwd() )
eq(0 , tlwd())
eq(globalDir .. '/' .. directories.window, wcwd())
@@ -280,8 +280,8 @@ describe("getcwd()", function ()
end)
it("returns empty string if working directory does not exist", function()
- execute("cd "..directories.global)
- execute("call delete('../"..directories.global.."', 'd')")
+ command("cd "..directories.global)
+ command("call delete('../"..directories.global.."', 'd')")
eq("", helpers.eval("getcwd()"))
end)
end)
diff --git a/test/functional/ex_cmds/ctrl_c_spec.lua b/test/functional/ex_cmds/ctrl_c_spec.lua
index 072fd2ad10..33affb26a5 100644
--- a/test/functional/ex_cmds/ctrl_c_spec.lua
+++ b/test/functional/ex_cmds/ctrl_c_spec.lua
@@ -1,7 +1,7 @@
local helpers = require('test.functional.helpers')(after_each)
local Screen = require('test.functional.ui.screen')
local clear, feed, source = helpers.clear, helpers.feed, helpers.source
-local execute = helpers.execute
+local command = helpers.command
describe("CTRL-C (mapped)", function()
before_each(function()
@@ -20,7 +20,7 @@ describe("CTRL-C (mapped)", function()
nnoremap <C-C> <NOP>
]])
- execute("silent edit! test/functional/fixtures/bigfile.txt")
+ command("silent edit! test/functional/fixtures/bigfile.txt")
local screen = Screen.new(52, 6)
screen:attach()
screen:set_default_attr_ids({
diff --git a/test/functional/ex_cmds/drop_spec.lua b/test/functional/ex_cmds/drop_spec.lua
index 99db5ea333..9105b84367 100644
--- a/test/functional/ex_cmds/drop_spec.lua
+++ b/test/functional/ex_cmds/drop_spec.lua
@@ -1,6 +1,6 @@
local helpers = require('test.functional.helpers')(after_each)
local Screen = require('test.functional.ui.screen')
-local clear, feed, execute = helpers.clear, helpers.feed, helpers.execute
+local clear, feed, feed_command = helpers.clear, helpers.feed, helpers.feed_command
describe(":drop", function()
local screen
@@ -15,7 +15,7 @@ describe(":drop", function()
[2] = {reverse = true},
[3] = {bold = true},
})
- execute("set laststatus=2")
+ feed_command("set laststatus=2")
end)
after_each(function()
@@ -23,7 +23,7 @@ describe(":drop", function()
end)
it("works like :e when called with only one window open", function()
- execute("drop tmp1.vim")
+ feed_command("drop tmp1.vim")
screen:expect([[
^ |
{0:~ }|
@@ -39,10 +39,10 @@ describe(":drop", function()
end)
it("switches to an open window showing the buffer", function()
- execute("edit tmp1")
- execute("vsplit")
- execute("edit tmp2")
- execute("drop tmp1")
+ feed_command("edit tmp1")
+ feed_command("vsplit")
+ feed_command("edit tmp2")
+ feed_command("drop tmp1")
screen:expect([[
{2:|}^ |
{0:~ }{2:|}{0:~ }|
@@ -58,11 +58,11 @@ describe(":drop", function()
end)
it("splits off a new window when a buffer can't be abandoned", function()
- execute("edit tmp1")
- execute("vsplit")
- execute("edit tmp2")
+ feed_command("edit tmp1")
+ feed_command("vsplit")
+ feed_command("edit tmp2")
feed("iABC<esc>")
- execute("drop tmp3")
+ feed_command("drop tmp3")
screen:expect([[
^ {2:|} |
{0:~ }{2:|}{0:~ }|
diff --git a/test/functional/ex_cmds/edit_spec.lua b/test/functional/ex_cmds/edit_spec.lua
index 3cc5f5fb95..6ed500a293 100644
--- a/test/functional/ex_cmds/edit_spec.lua
+++ b/test/functional/ex_cmds/edit_spec.lua
@@ -1,7 +1,8 @@
local helpers = require("test.functional.helpers")(after_each)
-local eq, execute, funcs = helpers.eq, helpers.execute, helpers.funcs
+local eq, command, funcs = helpers.eq, helpers.command, helpers.funcs
local ok = helpers.ok
local clear = helpers.clear
+local feed = helpers.feed
describe(":edit", function()
before_each(function()
@@ -9,13 +10,13 @@ describe(":edit", function()
end)
it("without arguments does not restart :terminal buffer", function()
- execute("terminal")
- helpers.feed([[<C-\><C-N>]])
+ command("terminal")
+ feed([[<C-\><C-N>]])
local bufname_before = funcs.bufname("%")
local bufnr_before = funcs.bufnr("%")
helpers.ok(nil ~= string.find(bufname_before, "^term://")) -- sanity
- execute("edit")
+ command("edit")
local bufname_after = funcs.bufname("%")
local bufnr_after = funcs.bufnr("%")
diff --git a/test/functional/ex_cmds/encoding_spec.lua b/test/functional/ex_cmds/encoding_spec.lua
index 87ed7a2d0a..0769259be4 100644
--- a/test/functional/ex_cmds/encoding_spec.lua
+++ b/test/functional/ex_cmds/encoding_spec.lua
@@ -1,5 +1,5 @@
local helpers = require('test.functional.helpers')(after_each)
-local clear, execute, feed = helpers.clear, helpers.execute, helpers.feed
+local clear, feed_command, feed = helpers.clear, helpers.feed_command, helpers.feed
local eq, neq, eval = helpers.eq, helpers.neq, helpers.eval
describe('&encoding', function()
@@ -12,7 +12,7 @@ describe('&encoding', function()
end)
it('cannot be changed after setup', function()
- execute('set encoding=latin1')
+ feed_command('set encoding=latin1')
-- error message expected
feed('<cr>')
neq(nil, string.find(eval('v:errmsg'), '^E474:'))
@@ -31,7 +31,7 @@ describe('&encoding', function()
end)
it('can be set to utf-8 without error', function()
- execute('set encoding=utf-8')
+ feed_command('set encoding=utf-8')
eq("", eval('v:errmsg'))
clear('--cmd', 'set enc=utf-8')
diff --git a/test/functional/ex_cmds/grep_spec.lua b/test/functional/ex_cmds/grep_spec.lua
index 13f88b7e03..43ef1bd424 100644
--- a/test/functional/ex_cmds/grep_spec.lua
+++ b/test/functional/ex_cmds/grep_spec.lua
@@ -1,6 +1,6 @@
local helpers = require('test.functional.helpers')(after_each)
-local clear, execute, feed, ok, eval =
- helpers.clear, helpers.execute, helpers.feed, helpers.ok, helpers.eval
+local clear, feed_command, feed, ok, eval =
+ helpers.clear, helpers.feed_command, helpers.feed, helpers.ok, helpers.eval
describe(':grep', function()
before_each(clear)
@@ -11,10 +11,10 @@ describe(':grep', function()
return
end
- execute([[set grepprg=grep\ -r]])
+ feed_command([[set grepprg=grep\ -r]])
-- Change to test directory so that the test does not run too long.
- execute('cd test')
- execute('grep a **/*')
+ feed_command('cd test')
+ feed_command('grep a **/*')
feed('<cr>') -- Press ENTER
ok(eval('len(getqflist())') > 9000) -- IT'S OVER 9000!!1
end)
diff --git a/test/functional/ex_cmds/menu_spec.lua b/test/functional/ex_cmds/menu_spec.lua
index 52df9e1592..8c249d6918 100644
--- a/test/functional/ex_cmds/menu_spec.lua
+++ b/test/functional/ex_cmds/menu_spec.lua
@@ -1,5 +1,5 @@
local helpers = require('test.functional.helpers')(after_each)
-local clear, execute, nvim = helpers.clear, helpers.execute, helpers.nvim
+local clear, command, nvim = helpers.clear, helpers.command, helpers.nvim
local expect, feed, command = helpers.expect, helpers.feed, helpers.command
local eq, eval = helpers.eq, helpers.eval
@@ -7,17 +7,17 @@ describe(':emenu', function()
before_each(function()
clear()
- execute('nnoremenu Test.Test inormal<ESC>')
- execute('inoremenu Test.Test insert')
- execute('vnoremenu Test.Test x')
- execute('cnoremenu Test.Test cmdmode')
+ command('nnoremenu Test.Test inormal<ESC>')
+ command('inoremenu Test.Test insert')
+ command('vnoremenu Test.Test x')
+ command('cnoremenu Test.Test cmdmode')
- execute('nnoremenu Edit.Paste p')
- execute('cnoremenu Edit.Paste <C-R>"')
+ command('nnoremenu Edit.Paste p')
+ command('cnoremenu Edit.Paste <C-R>"')
end)
it('executes correct bindings in normal mode without using API', function()
- execute('emenu Test.Test')
+ command('emenu Test.Test')
expect('normal')
end)
diff --git a/test/functional/ex_cmds/oldfiles_spec.lua b/test/functional/ex_cmds/oldfiles_spec.lua
index a161e49fc6..656b3f9bae 100644
--- a/test/functional/ex_cmds/oldfiles_spec.lua
+++ b/test/functional/ex_cmds/oldfiles_spec.lua
@@ -1,7 +1,7 @@
local Screen = require('test.functional.ui.screen')
local helpers = require('test.functional.helpers')(after_each)
-local buf, eq, execute = helpers.curbufmeths, helpers.eq, helpers.execute
+local buf, eq, feed_command = helpers.curbufmeths, helpers.eq, helpers.feed_command
local feed, nvim_prog, wait = helpers.feed, helpers.nvim_prog, helpers.wait
local ok, set_session, spawn = helpers.ok, helpers.set_session, helpers.spawn
@@ -27,12 +27,12 @@ describe(':oldfiles', function()
it('shows most recently used files', function()
local screen = Screen.new(100, 5)
screen:attach()
- execute('edit testfile1')
- execute('edit testfile2')
- execute('wshada ' .. shada_file)
- execute('rshada! ' .. shada_file)
+ feed_command('edit testfile1')
+ feed_command('edit testfile2')
+ feed_command('wshada ' .. shada_file)
+ feed_command('rshada! ' .. shada_file)
local oldfiles = helpers.meths.get_vvar('oldfiles')
- execute('oldfiles')
+ feed_command('oldfiles')
screen:expect([[
testfile2 |
1: ]].. add_padding(oldfiles[1]) ..[[ |
@@ -50,14 +50,14 @@ describe(':browse oldfiles', function()
before_each(function()
_clear()
- execute('edit testfile1')
+ feed_command('edit testfile1')
filename = buf.get_name()
- execute('edit testfile2')
+ feed_command('edit testfile2')
filename2 = buf.get_name()
- execute('wshada ' .. shada_file)
+ feed_command('wshada ' .. shada_file)
wait()
_clear()
- execute('rshada! ' .. shada_file)
+ feed_command('rshada! ' .. shada_file)
-- Ensure nvim is out of "Press ENTER..." prompt.
feed('<cr>')
@@ -70,7 +70,7 @@ describe(':browse oldfiles', function()
ok(filename == oldfiles[1] or filename == oldfiles[2])
ok(filename2 == oldfiles[1] or filename2 == oldfiles[2])
- execute('browse oldfiles')
+ feed_command('browse oldfiles')
end)
after_each(function()
diff --git a/test/functional/ex_cmds/recover_spec.lua b/test/functional/ex_cmds/recover_spec.lua
index af1296c94c..36bf85015a 100644
--- a/test/functional/ex_cmds/recover_spec.lua
+++ b/test/functional/ex_cmds/recover_spec.lua
@@ -2,8 +2,8 @@
local helpers = require('test.functional.helpers')(after_each)
local lfs = require('lfs')
-local execute, eq, clear, eval, feed, expect, source =
- helpers.execute, helpers.eq, helpers.clear, helpers.eval, helpers.feed,
+local feed_command, eq, clear, eval, feed, expect, source =
+ helpers.feed_command, helpers.eq, helpers.clear, helpers.eval, helpers.feed,
helpers.expect, helpers.source
if helpers.pending_win32(pending) then return end
@@ -13,7 +13,7 @@ describe(':recover', function()
it('fails if given a non-existent swapfile', function()
local swapname = 'bogus-swapfile'
- execute('recover '..swapname) -- This should not segfault. #2117
+ feed_command('recover '..swapname) -- This should not segfault. #2117
eq('E305: No swap file found for '..swapname, eval('v:errmsg'))
end)
@@ -40,12 +40,12 @@ describe(':preserve', function()
]]
source(init)
- execute('set swapfile fileformat=unix undolevels=-1')
+ feed_command('set swapfile fileformat=unix undolevels=-1')
-- Put swapdir at the start of the 'directory' list. #1836
- execute('set directory^='..swapdir..'//')
- execute('edit '..testfile)
+ feed_command('set directory^='..swapdir..'//')
+ feed_command('edit '..testfile)
feed('isometext<esc>')
- execute('preserve')
+ feed_command('preserve')
source('redir => g:swapname | swapname | redir END')
local swappath1 = eval('g:swapname')
@@ -59,8 +59,8 @@ describe(':preserve', function()
source(init)
-- Use the "SwapExists" event to choose the (R)ecover choice at the dialog.
- execute('autocmd SwapExists * let v:swapchoice = "r"')
- execute('silent edit '..testfile)
+ feed_command('autocmd SwapExists * let v:swapchoice = "r"')
+ feed_command('silent edit '..testfile)
source('redir => g:swapname | swapname | redir END')
local swappath2 = eval('g:swapname')
diff --git a/test/functional/ex_cmds/undojoin_spec.lua b/test/functional/ex_cmds/undojoin_spec.lua
index ba1e46ceb3..7803906619 100644
--- a/test/functional/ex_cmds/undojoin_spec.lua
+++ b/test/functional/ex_cmds/undojoin_spec.lua
@@ -5,7 +5,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 exc_exec = helpers.exc_exec
describe(':undojoin command', function()
@@ -14,10 +14,10 @@ describe(':undojoin command', function()
insert([[
Line of text 1
Line of text 2]])
- execute('goto 1')
+ feed_command('goto 1')
end)
it('joins changes in a buffer', function()
- execute('undojoin | delete')
+ feed_command('undojoin | delete')
expect([[
Line of text 2]])
feed('u')
@@ -26,7 +26,7 @@ describe(':undojoin command', function()
end)
it('does not corrupt undolist when connected with redo', function()
feed('ixx<esc>')
- execute('undojoin | redo')
+ feed_command('undojoin | redo')
expect([[
xxLine of text 1
Line of text 2]])
diff --git a/test/functional/ex_cmds/write_spec.lua b/test/functional/ex_cmds/write_spec.lua
index 9c2687971e..ea8b41a578 100644
--- a/test/functional/ex_cmds/write_spec.lua
+++ b/test/functional/ex_cmds/write_spec.lua
@@ -1,11 +1,12 @@
local helpers = require('test.functional.helpers')(after_each)
local lfs = require('lfs')
-local eq, eval, clear, write_file, execute, source, insert =
+local eq, eval, clear, write_file, command, source, insert =
helpers.eq, helpers.eval, helpers.clear, helpers.write_file,
- helpers.execute, helpers.source, helpers.insert
+ helpers.command, helpers.source, helpers.insert
local redir_exec = helpers.redir_exec
local exc_exec = helpers.exc_exec
local command = helpers.command
+local feed_command = helpers.feed_command
local funcs = helpers.funcs
local meths = helpers.meths
@@ -33,9 +34,9 @@ describe(':write', function()
end)
it('&backupcopy=auto preserves symlinks', function()
- execute('set backupcopy=auto')
+ command('set backupcopy=auto')
write_file('test_bkc_file.txt', 'content0')
- execute("silent !ln -s test_bkc_file.txt test_bkc_link.txt")
+ command("silent !ln -s test_bkc_file.txt test_bkc_link.txt")
source([[
edit test_bkc_link.txt
call setline(1, ['content1'])
@@ -46,9 +47,9 @@ describe(':write', function()
end)
it('&backupcopy=no replaces symlink with new file', function()
- execute('set backupcopy=no')
+ command('set backupcopy=no')
write_file('test_bkc_file.txt', 'content0')
- execute("silent !ln -s test_bkc_file.txt test_bkc_link.txt")
+ command("silent !ln -s test_bkc_file.txt test_bkc_link.txt")
source([[
edit test_bkc_link.txt
call setline(1, ['content1'])
@@ -69,7 +70,7 @@ describe(':write', function()
insert(text)
-- Blocks until a consumer reads the FIFO.
- execute("write >> test_fifo")
+ feed_command("write >> test_fifo")
-- Read the FIFO, this will unblock the :write above.
local fifo = assert(io.open("test_fifo"))
diff --git a/test/functional/ex_cmds/wundo_spec.lua b/test/functional/ex_cmds/wundo_spec.lua
index e1216fa5d4..b6fcae0cf4 100644
--- a/test/functional/ex_cmds/wundo_spec.lua
+++ b/test/functional/ex_cmds/wundo_spec.lua
@@ -1,20 +1,21 @@
-- Specs for :wundo and underlying functions
local helpers = require('test.functional.helpers')(after_each)
-local execute, clear, eval, feed, spawn, nvim_prog, set_session =
- helpers.execute, helpers.clear, helpers.eval, helpers.feed, helpers.spawn,
+local command, clear, eval, spawn, nvim_prog, set_session =
+ helpers.command, helpers.clear, helpers.eval, helpers.spawn,
helpers.nvim_prog, helpers.set_session
describe(':wundo', function()
before_each(clear)
+ after_each(function()
+ os.remove(eval('getcwd()') .. '/foo')
+ end)
it('safely fails on new, non-empty buffer', function()
- feed('iabc<esc>')
- execute('wundo foo') -- This should not segfault. #1027
+ command('normal! iabc')
+ command('wundo foo') -- This should not segfault. #1027
--TODO: check messages for error message
-
- os.remove(eval('getcwd()') .. '/foo') --cleanup
end)
end)
@@ -23,7 +24,7 @@ describe('u_* functions', function()
local session = spawn({nvim_prog, '-u', 'NONE', '-i', 'NONE', '--embed',
'-c', 'set undodir=. undofile'})
set_session(session)
- execute('echo "True"') -- Should not error out due to crashed Neovim
+ command('echo "True"') -- Should not error out due to crashed Neovim
session:close()
end)
end)
diff --git a/test/functional/ex_cmds/wviminfo_spec.lua b/test/functional/ex_cmds/wviminfo_spec.lua
index 37f45da2d4..eebbd70f2b 100644
--- a/test/functional/ex_cmds/wviminfo_spec.lua
+++ b/test/functional/ex_cmds/wviminfo_spec.lua
@@ -1,8 +1,8 @@
local helpers = require('test.functional.helpers')(after_each)
local lfs = require('lfs')
-local execute, eq, neq, spawn, nvim_prog, set_session, wait, write_file
- = helpers.execute, helpers.eq, helpers.neq, helpers.spawn,
- helpers.nvim_prog, helpers.set_session, helpers.wait, helpers.write_file
+local command, eq, neq, spawn, nvim_prog, set_session, write_file =
+ helpers.command, helpers.eq, helpers.neq, helpers.spawn,
+ helpers.nvim_prog, helpers.set_session, helpers.write_file
describe(':wshada', function()
local shada_file = 'wshada_test'
@@ -24,8 +24,7 @@ describe(':wshada', function()
it('creates a shada file', function()
-- file should _not_ exist
eq(nil, lfs.attributes(shada_file))
- execute('wsh! '..shada_file)
- wait()
+ command('wsh! '..shada_file)
-- file _should_ exist
neq(nil, lfs.attributes(shada_file))
end)
@@ -40,8 +39,7 @@ describe(':wshada', function()
eq(text, io.open(shada_file):read())
neq(nil, lfs.attributes(shada_file))
- execute('wsh! '..shada_file)
- wait()
+ command('wsh! '..shada_file)
-- File should have been overwritten with a shada file.
local fp = io.open(shada_file, 'r')