diff options
author | Marco Hinz <mh.codebro@gmail.com> | 2015-11-10 03:14:47 +0100 |
---|---|---|
committer | Marco Hinz <mh.codebro@gmail.com> | 2015-11-10 03:14:47 +0100 |
commit | 68255df9b93e1b69ac5402d193abfceca04ffb54 (patch) | |
tree | e178e7bc5a5069007d431812cf08c7721c4c3762 /test/functional/ex_cmds/oldfiles_spec.lua | |
parent | 971e5c22bfc51102d670549d3df1181adfc75c77 (diff) | |
parent | 3b12bb225adda2aac40a55f7009cae05311b2a43 (diff) | |
download | rneovim-68255df9b93e1b69ac5402d193abfceca04ffb54.tar.gz rneovim-68255df9b93e1b69ac5402d193abfceca04ffb54.tar.bz2 rneovim-68255df9b93e1b69ac5402d193abfceca04ffb54.zip |
Merge PR #3611 'Add file selection prompt on ":oldfiles!"'
Diffstat (limited to 'test/functional/ex_cmds/oldfiles_spec.lua')
-rw-r--r-- | test/functional/ex_cmds/oldfiles_spec.lua | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/test/functional/ex_cmds/oldfiles_spec.lua b/test/functional/ex_cmds/oldfiles_spec.lua new file mode 100644 index 0000000000..fedf5babe8 --- /dev/null +++ b/test/functional/ex_cmds/oldfiles_spec.lua @@ -0,0 +1,49 @@ +local h = require('test.functional.helpers') + +local buf = h.curbufmeths +local command = h.command +local eq = h.eq +local execute = h.execute +local feed = h.feed +local nvim = h.nvim + +local shada_file = 'test.shada' + +-- h.clear() uses "-i NONE", which is not useful for this test. +local function clear() + if session then + session:exit(0) + end + h.set_session(h.spawn({h.nvim_prog, + '-u', 'NONE', + '--cmd', 'set noswapfile undodir=. directory=. viewdir=. backupdir=.', + '--embed'})) +end + +describe(':oldfiles', function() + before_each(clear) + + it('shows most recently used files', function() + command('edit testfile1') + command('edit testfile2') + command('wshada ' .. shada_file) + command('rshada! ' .. shada_file) + assert(string.find(nvim('command_output', 'oldfiles'), 'testfile2')) + os.remove(shada_file) + end) +end) + +describe(':oldfiles!', function() + it('provides a file selection prompt and edits the chosen file', function() + command('edit testfile1') + command('edit testfile2') + local filename = buf.get_name() + command('wshada ' .. shada_file) + clear() + command('rshada! ' .. shada_file) + execute('oldfiles!') + feed('2<cr>') + eq(filename, buf.get_name()) + os.remove(shada_file) + end) +end) |