diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2017-06-21 23:56:00 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-06-21 23:56:00 +0200 |
commit | 144f584948a0183382411dd583df9b18cd95b473 (patch) | |
tree | 0ea38fa17b41f5e2871cf0259944f67310f6479d /test/functional/helpers.lua | |
parent | cb8e47c4f88f12e2a107698a250410561807395a (diff) | |
parent | 476c28f433ebd7e3c8dfc2d31c59b3fc4c1c02e5 (diff) | |
download | rneovim-144f584948a0183382411dd583df9b18cd95b473.tar.gz rneovim-144f584948a0183382411dd583df9b18cd95b473.tar.bz2 rneovim-144f584948a0183382411dd583df9b18cd95b473.zip |
Merge #6914 from ZyX-I/func-def-trailing-error
Allow multiple function definitions in one :execute
Diffstat (limited to 'test/functional/helpers.lua')
-rw-r--r-- | test/functional/helpers.lua | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/test/functional/helpers.lua b/test/functional/helpers.lua index b8512c0ad6..5b641b5054 100644 --- a/test/functional/helpers.lua +++ b/test/functional/helpers.lua @@ -492,17 +492,6 @@ local exc_exec = function(cmd) return ret end -local function redir_exec(cmd) - nvim_command(([[ - redir => g:__output - silent! execute "%s" - redir END - ]]):format(cmd:gsub('\n', '\\n'):gsub('[\\"]', '\\%0'))) - local ret = nvim_eval('get(g:, "__output", 0)') - nvim_command('unlet! g:__output') - return ret -end - local function create_callindex(func) local table = {} setmetatable(table, { @@ -562,6 +551,19 @@ local curbufmeths = create_callindex(curbuf) local curwinmeths = create_callindex(curwin) local curtabmeths = create_callindex(curtab) +local function redir_exec(cmd) + meths.set_var('__redir_exec_cmd', cmd) + nvim_command([[ + redir => g:__redir_exec_output + silent! execute g:__redir_exec_cmd + redir END + ]]) + local ret = meths.get_var('__redir_exec_output') + meths.del_var('__redir_exec_output') + meths.del_var('__redir_exec_cmd') + return ret +end + local function get_pathsep() return funcs.fnamemodify('.', ':p'):sub(-1) end |