diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2020-01-26 19:03:43 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-01-26 19:03:43 -0800 |
commit | b5daee7b8faaa00b83eb17ad231b8dbc417f628c (patch) | |
tree | 4f2150ee9703be7ed7c7ea4bd56d21f3eca80eaf /test | |
parent | 88f133c30d4b46e371f0cdb0797113cbbca9cc59 (diff) | |
parent | 1c3ca4f18fdc403813d8959b49626ac1c99e2c59 (diff) | |
download | rneovim-b5daee7b8faaa00b83eb17ad231b8dbc417f628c.tar.gz rneovim-b5daee7b8faaa00b83eb17ad231b8dbc417f628c.tar.bz2 rneovim-b5daee7b8faaa00b83eb17ad231b8dbc417f628c.zip |
Merge #7836 'session: restore same :terminal buf split windows'
Diffstat (limited to 'test')
-rw-r--r-- | test/functional/ex_cmds/mksession_spec.lua | 26 | ||||
-rw-r--r-- | test/functional/helpers.lua | 2 |
2 files changed, 25 insertions, 3 deletions
diff --git a/test/functional/ex_cmds/mksession_spec.lua b/test/functional/ex_cmds/mksession_spec.lua index 855f8105aa..949724bb53 100644 --- a/test/functional/ex_cmds/mksession_spec.lua +++ b/test/functional/ex_cmds/mksession_spec.lua @@ -26,6 +26,27 @@ describe(':mksession', function() rmdir(tab_dir) end) + it('restores same :terminal buf in splits', function() + -- If the same :terminal is displayed in multiple windows, :mksession + -- should restore it as such. + + -- Create two windows showing the same :terminal buffer. + command('terminal') + command('split') + command('terminal') + command('split') + command('mksession '..session_file) + + -- Create a new test instance of Nvim. + command('qall!') + clear() + -- Restore session. + command('source '..session_file) + + eq({3,3,2}, + {funcs.winbufnr(1), funcs.winbufnr(2), funcs.winbufnr(3)}) + end) + it('restores tab-local working directories', function() local tmpfile_base = file_prefix .. '-tmpfile' local cwd_dir = funcs.getcwd() @@ -75,7 +96,8 @@ describe(':mksession', function() it('restores CWD for :terminal buffers #11288', function() local cwd_dir = funcs.fnamemodify('.', ':p:~'):gsub([[[\/]*$]], '') - local session_path = cwd_dir..get_pathsep()..session_file + cwd_dir = cwd_dir:gsub([[\]], '/') -- :mksession always uses unix slashes. + local session_path = cwd_dir..'/'..session_file command('cd '..tab_dir) command('terminal echo $PWD') @@ -87,7 +109,7 @@ describe(':mksession', function() clear() command('silent source '..session_path) - local expected_cwd = cwd_dir..get_pathsep()..tab_dir + local expected_cwd = cwd_dir..'/'..tab_dir matches('^term://'..pesc(expected_cwd)..'//%d+:', funcs.expand('%')) command('qall!') end) diff --git a/test/functional/helpers.lua b/test/functional/helpers.lua index 3ffc6137d6..53c4d140b6 100644 --- a/test/functional/helpers.lua +++ b/test/functional/helpers.lua @@ -794,7 +794,7 @@ function module.alter_slashes(obj) end return ret else - assert(false, 'Could only alter slashes for tables of strings and strings') + assert(false, 'expected string or table of strings, got '..type(obj)) end end |