diff options
-rw-r--r-- | test/functional/shada/compatibility_spec.lua | 14 | ||||
-rw-r--r-- | test/functional/shada/errors_spec.lua | 16 | ||||
-rw-r--r-- | test/functional/shada/helpers.lua | 12 |
3 files changed, 21 insertions, 21 deletions
diff --git a/test/functional/shada/compatibility_spec.lua b/test/functional/shada/compatibility_spec.lua index 5c48d82f4a..fba6f54feb 100644 --- a/test/functional/shada/compatibility_spec.lua +++ b/test/functional/shada/compatibility_spec.lua @@ -3,20 +3,14 @@ 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 = helpers.write_file local shada_helpers = require('test.functional.shada.helpers') -local reset, set_additional_cmd, clear, exc_exec = +local reset, set_additional_cmd, clear, exc_exec, get_shada_rw = shada_helpers.reset, shada_helpers.set_additional_cmd, - shada_helpers.clear, shada_helpers.exc_exec + shada_helpers.clear, shada_helpers.exc_exec, + shada_helpers.get_shada_rw -local shada_fname = 'Xtest-functional-shada-additional.shada' -local wshada = function(text) - write_file(shada_fname, text, true) -end -local sdrcmd = function(bang) - return 'rshada' .. (bang and '!' or '') .. ' ' .. shada_fname -end +local wshada, sdrcmd, shada_fname = get_shada_rw('Xtest-functional-shada-compatibility.shada') local msgpack = require('MessagePack') local mpack_keys = {'type', 'timestamp', 'length', 'value'} diff --git a/test/functional/shada/errors_spec.lua b/test/functional/shada/errors_spec.lua index 0dfb204b35..a53b5cee2b 100644 --- a/test/functional/shada/errors_spec.lua +++ b/test/functional/shada/errors_spec.lua @@ -3,20 +3,14 @@ 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 = helpers.write_file local shada_helpers = require('test.functional.shada.helpers') -local reset, set_additional_cmd, clear, exc_exec = +local reset, set_additional_cmd, clear, exc_exec, get_shada_rw = shada_helpers.reset, shada_helpers.set_additional_cmd, - shada_helpers.clear, shada_helpers.exc_exec - -local shada_fname = 'Xtest-functional-shada-errors.shada' -local wshada = function(text) - write_file(shada_fname, text, true) -end -local sdrcmd = function(bang) - return 'rshada' .. (bang and '!' or '') .. ' ' .. shada_fname -end + shada_helpers.clear, shada_helpers.exc_exec, + shada_helpers.get_shada_rw + +local wshada, sdrcmd, shada_fname = get_shada_rw('Xtest-functional-shada-errors.shada') describe('ShaDa error handling', function() before_each(reset) diff --git a/test/functional/shada/helpers.lua b/test/functional/shada/helpers.lua index 909fcd62e6..180b6f8c44 100644 --- a/test/functional/shada/helpers.lua +++ b/test/functional/shada/helpers.lua @@ -2,6 +2,7 @@ local helpers = require('test.functional.helpers') local spawn, set_session, nvim, nvim_prog, nvim_command, nvim_eval = helpers.spawn, helpers.set_session, helpers.nvim, helpers.nvim_prog, helpers.command, helpers.eval +local write_file = helpers.write_file local tmpname = os.tmpname() local additional_cmd = '' @@ -60,9 +61,20 @@ local exc_exec = function(cmd) return ret end +local get_shada_rw = function(fname) + local wshada = function(text) + write_file(fname, text, true) + end + local sdrcmd = function(bang) + return 'rshada' .. (bang and '!' or '') .. ' ' .. fname + end + return wshada, sdrcmd, fname +end + return { reset=reset, set_additional_cmd=set_additional_cmd, clear=clear, exc_exec=exc_exec, + get_shada_rw=get_shada_rw, } |