diff options
Diffstat (limited to 'test/functional/ex_cmds/oldfiles_spec.lua')
-rw-r--r-- | test/functional/ex_cmds/oldfiles_spec.lua | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/test/functional/ex_cmds/oldfiles_spec.lua b/test/functional/ex_cmds/oldfiles_spec.lua index 8d1469f343..927d780181 100644 --- a/test/functional/ex_cmds/oldfiles_spec.lua +++ b/test/functional/ex_cmds/oldfiles_spec.lua @@ -1,13 +1,14 @@ +local t = require('test.testutil') +local n = require('test.functional.testnvim')() local Screen = require('test.functional.ui.screen') -local helpers = require('test.functional.helpers')(after_each) -local clear = helpers.clear -local command = helpers.command -local expect_exit = helpers.expect_exit -local api, eq, feed_command = helpers.api, helpers.eq, helpers.feed_command -local feed, poke_eventloop = helpers.feed, helpers.poke_eventloop -local ok = helpers.ok -local eval = helpers.eval +local clear = n.clear +local command = n.command +local expect_exit = n.expect_exit +local api, eq, feed_command = n.api, t.eq, n.feed_command +local feed, poke_eventloop = n.feed, n.poke_eventloop +local ok = t.ok +local eval = n.eval local shada_file = 'Xtest.shada' @@ -38,6 +39,7 @@ describe(':oldfiles', function() it('shows most recently used files', function() local screen = Screen.new(100, 5) screen:attach() + screen._default_attr_ids = nil feed_command('edit testfile1') feed_command('edit testfile2') feed_command('wshada') @@ -65,12 +67,12 @@ describe(':oldfiles', function() feed_command('rshada!') local function get_oldfiles(cmd) - local t = eval([[split(execute(']] .. cmd .. [['), "\n")]]) - for i, _ in ipairs(t) do - t[i] = t[i]:gsub('^%d+:%s+', '') + local q = eval([[split(execute(']] .. cmd .. [['), "\n")]]) + for i, _ in ipairs(q) do + q[i] = q[i]:gsub('^%d+:%s+', '') end - table.sort(t) - return t + table.sort(q) + return q end local oldfiles = get_oldfiles('oldfiles') @@ -108,7 +110,7 @@ describe(':browse oldfiles', function() -- Ensure v:oldfiles isn't busted. Since things happen so fast, -- the ordering of v:oldfiles is unstable (it uses qsort() under-the-hood). -- Let's verify the contents and the length of v:oldfiles before moving on. - oldfiles = helpers.api.nvim_get_vvar('oldfiles') + oldfiles = n.api.nvim_get_vvar('oldfiles') eq(2, #oldfiles) ok(filename == oldfiles[1] or filename == oldfiles[2]) ok(filename2 == oldfiles[1] or filename2 == oldfiles[2]) |