functests: Move exc_exec to test.functional.helpers

This commit is contained in:
ZyX 2015-09-19 20:57:49 +03:00
parent 56a2549ff8
commit 7085ea07d8
6 changed files with 17 additions and 29 deletions

View File

@ -3,12 +3,12 @@ local helpers = require('test.functional.helpers')
local nvim, nvim_window, nvim_curwin, nvim_command, nvim_feed, nvim_eval, eq =
helpers.nvim, helpers.window, helpers.curwin, helpers.command, helpers.feed,
helpers.eval, helpers.eq
local exc_exec = helpers.exc_exec
local shada_helpers = require('test.functional.shada.helpers')
local reset, set_additional_cmd, clear, exc_exec, get_shada_rw =
local reset, set_additional_cmd, clear, get_shada_rw =
shada_helpers.reset, shada_helpers.set_additional_cmd,
shada_helpers.clear, shada_helpers.exc_exec,
shada_helpers.get_shada_rw
shada_helpers.clear, shada_helpers.get_shada_rw
local read_shada_file = shada_helpers.read_shada_file
local wshada, sdrcmd, shada_fname = get_shada_rw('Xtest-functional-shada-compatibility.shada')

View File

@ -3,12 +3,12 @@ local helpers = require('test.functional.helpers')
local nvim, nvim_window, nvim_curwin, nvim_command, nvim_feed, nvim_eval, eq =
helpers.nvim, helpers.window, helpers.curwin, helpers.command, helpers.feed,
helpers.eval, helpers.eq
local exc_exec = helpers.exc_exec
local shada_helpers = require('test.functional.shada.helpers')
local reset, set_additional_cmd, clear, exc_exec, get_shada_rw =
local reset, set_additional_cmd, clear, get_shada_rw =
shada_helpers.reset, shada_helpers.set_additional_cmd,
shada_helpers.clear, shada_helpers.exc_exec,
shada_helpers.get_shada_rw
shada_helpers.clear, shada_helpers.get_shada_rw
local wshada, sdrcmd, shada_fname, clean =
get_shada_rw('Xtest-functional-shada-errors.shada')

View File

@ -42,19 +42,6 @@ local clear = function()
set_additional_cmd('')
end
local exc_exec = function(cmd)
nvim_command(([[
try
execute "%s"
catch
let g:__exception = v:exception
endtry
]]):format(cmd:gsub('\n', '\\n'):gsub('[\\"]', '\\%0')))
local ret = nvim_eval('get(g:, "__exception", 0)')
nvim_command('unlet! g:__exception')
return ret
end
local get_shada_rw = function(fname)
local wshada = function(text)
write_file(fname, text, true)

View File

@ -3,11 +3,12 @@ local helpers = require('test.functional.helpers')
local nvim, nvim_window, nvim_curwin, nvim_command, nvim_feed, nvim_eval, eq =
helpers.nvim, helpers.window, helpers.curwin, helpers.command, helpers.feed,
helpers.eval, helpers.eq
local exc_exec = helpers.exc_exec
local shada_helpers = require('test.functional.shada.helpers')
local reset, set_additional_cmd, clear, exc_exec =
local reset, set_additional_cmd, clear =
shada_helpers.reset, shada_helpers.set_additional_cmd,
shada_helpers.clear, shada_helpers.exc_exec
shada_helpers.clear
local nvim_current_line = function()
return nvim_window('get_cursor', nvim_curwin())[1]

View File

@ -3,12 +3,12 @@ local helpers = require('test.functional.helpers')
local nvim, nvim_window, nvim_curwin, nvim_command, nvim_feed, nvim_eval, eq =
helpers.nvim, helpers.window, helpers.curwin, helpers.command, helpers.feed,
helpers.eval, helpers.eq
local exc_exec = helpers.exc_exec
local shada_helpers = require('test.functional.shada.helpers')
local reset, set_additional_cmd, clear, exc_exec, get_shada_rw =
local reset, set_additional_cmd, clear, get_shada_rw =
shada_helpers.reset, shada_helpers.set_additional_cmd,
shada_helpers.clear, shada_helpers.exc_exec,
shada_helpers.get_shada_rw
shada_helpers.clear, shada_helpers.get_shada_rw
local read_shada_file = shada_helpers.read_shada_file
local wshada, sdrcmd, shada_fname =

View File

@ -3,17 +3,17 @@ local helpers = require('test.functional.helpers')
local nvim, nvim_window, nvim_curwin, nvim_command, nvim_feed, nvim_eval, eq =
helpers.nvim, helpers.window, helpers.curwin, helpers.command, helpers.feed,
helpers.eval, helpers.eq
local write_file, spawn, set_session, nvim_prog =
helpers.write_file, helpers.spawn, helpers.set_session, helpers.nvim_prog
local write_file, spawn, set_session, nvim_prog, exc_exec =
helpers.write_file, helpers.spawn, helpers.set_session, helpers.nvim_prog,
helpers.exc_exec
local lfs = require('lfs')
local msgpack = require('MessagePack')
local shada_helpers = require('test.functional.shada.helpers')
local reset, set_additional_cmd, clear, exc_exec, get_shada_rw =
local reset, set_additional_cmd, clear, get_shada_rw =
shada_helpers.reset, shada_helpers.set_additional_cmd,
shada_helpers.clear, shada_helpers.exc_exec,
shada_helpers.get_shada_rw
shada_helpers.clear, shada_helpers.get_shada_rw
local read_shada_file = shada_helpers.read_shada_file
local wshada, sdrcmd, shada_fname, clean = get_shada_rw('Xtest-functional-shada-shada.shada')