diff options
author | ZyX <kp-pav@yandex.ru> | 2017-12-03 16:49:30 +0300 |
---|---|---|
committer | ZyX <kp-pav@yandex.ru> | 2017-12-03 16:49:30 +0300 |
commit | c49e22d3964d6c7ae1c24e8ad01b5fec4ca40b57 (patch) | |
tree | b7e59c416d1435725c65f8952b6e55c70544d97e /test/functional/ex_cmds/mksession_spec.lua | |
parent | 62108c3b0be46936c83f6d4c98b44ceb5e6f77fd (diff) | |
parent | 27a577586eace687c47e7398845178208cae524a (diff) | |
download | rneovim-c49e22d3964d6c7ae1c24e8ad01b5fec4ca40b57.tar.gz rneovim-c49e22d3964d6c7ae1c24e8ad01b5fec4ca40b57.tar.bz2 rneovim-c49e22d3964d6c7ae1c24e8ad01b5fec4ca40b57.zip |
Merge branch 'master' into s-dash-stdin
Diffstat (limited to 'test/functional/ex_cmds/mksession_spec.lua')
-rw-r--r-- | test/functional/ex_cmds/mksession_spec.lua | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/test/functional/ex_cmds/mksession_spec.lua b/test/functional/ex_cmds/mksession_spec.lua new file mode 100644 index 0000000000..5d658f10bb --- /dev/null +++ b/test/functional/ex_cmds/mksession_spec.lua @@ -0,0 +1,49 @@ +local lfs = require('lfs') +local helpers = require('test.functional.helpers')(after_each) + +local clear = helpers.clear +local command = helpers.command +local get_pathsep = helpers.get_pathsep +local eq = helpers.eq +local funcs = helpers.funcs + +local file_prefix = 'Xtest-functional-ex_cmds-mksession_spec' + +describe(':mksession', function() + local session_file = file_prefix .. '.vim' + local tab_dir = file_prefix .. '.d' + + before_each(function() + clear() + lfs.mkdir(tab_dir) + end) + + after_each(function() + os.remove(session_file) + lfs.rmdir(tab_dir) + end) + + it('restores tab-local working directories', function() + local tmpfile_base = file_prefix .. '-tmpfile' + local cwd_dir = funcs.getcwd() + + -- :mksession does not save empty tabs, so create some buffers. + command('edit ' .. tmpfile_base .. '1') + command('tabnew') + command('edit ' .. tmpfile_base .. '2') + command('tcd ' .. tab_dir) + command('tabfirst') + command('mksession ' .. session_file) + + -- Create a new test instance of Nvim. + clear() + + command('source ' .. session_file) + -- First tab should have the original working directory. + command('tabnext 1') + eq(cwd_dir, funcs.getcwd()) + -- Second tab should have the tab-local working directory. + command('tabnext 2') + eq(cwd_dir .. get_pathsep() .. tab_dir, funcs.getcwd()) + end) +end) |