aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2020-01-26 02:43:12 -0800
committerJustin M. Keyes <justinkz@gmail.com>2020-01-26 17:13:00 -0800
commit1e103b3c12597a9dd2f20d45686822ab6ee089b0 (patch)
treed3122d76dcc7f676f3faaa7a74a8afed2c7da5d3 /test
parentcf67f19ac2104ece76d040c8184bc287428299b3 (diff)
downloadrneovim-1e103b3c12597a9dd2f20d45686822ab6ee089b0.tar.gz
rneovim-1e103b3c12597a9dd2f20d45686822ab6ee089b0.tar.bz2
rneovim-1e103b3c12597a9dd2f20d45686822ab6ee089b0.zip
mksession: simplify generated commands
Doing ":file …" immediately after is enough to fixup the :terminal buffer name. ref #5250
Diffstat (limited to 'test')
-rw-r--r--test/functional/ex_cmds/mksession_spec.lua40
1 files changed, 21 insertions, 19 deletions
diff --git a/test/functional/ex_cmds/mksession_spec.lua b/test/functional/ex_cmds/mksession_spec.lua
index 726cfe7fe5..305850a09e 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()
@@ -91,23 +112,4 @@ describe(':mksession', function()
matches('^term://'..pesc(expected_cwd)..'//%d+:', funcs.expand('%'))
command('qall!')
end)
-
- it('restores multiple windows with same terminal instances', function()
- -- Create a view with two buffers referencing the same terminal instance
- command('terminal')
- command('split')
- command('mksession ' .. session_file)
-
- clear()
-
- command('source ' .. session_file)
- -- Getting the name of the buffer shown to compare with the other window
- local eval = helpers.eval
-
- command('exe 1 . "wincmd w"')
- local expected_pid = eval('b:terminal_job_pid')
-
- command('exe 2 . "wincmd w"')
- eq(expected_pid, eval('b:terminal_job_pid'))
- end)
end)