aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/functional/api/window_spec.lua40
-rw-r--r--test/functional/ex_cmds/excmd_spec.lua2
-rw-r--r--test/functional/viml/errorlist_spec.lua13
3 files changed, 53 insertions, 2 deletions
diff --git a/test/functional/api/window_spec.lua b/test/functional/api/window_spec.lua
index 7471f50dbd..ceeb84cec9 100644
--- a/test/functional/api/window_spec.lua
+++ b/test/functional/api/window_spec.lua
@@ -347,4 +347,44 @@ describe('API/win', function()
eq('', funcs.getcmdwintype())
end)
end)
+
+ describe('hide', function()
+ it('can hide current window', function()
+ local oldwin = meths.get_current_win()
+ command('split')
+ local newwin = meths.get_current_win()
+ meths.win_hide(newwin)
+ eq({oldwin}, meths.list_wins())
+ end)
+ it('can hide noncurrent window', function()
+ local oldwin = meths.get_current_win()
+ command('split')
+ local newwin = meths.get_current_win()
+ meths.win_hide(oldwin)
+ eq({newwin}, meths.list_wins())
+ end)
+ it('does not close the buffer', function()
+ local oldwin = meths.get_current_win()
+ local oldbuf = meths.get_current_buf()
+ local buf = meths.create_buf(true, false)
+ local newwin = meths.open_win(buf, true, {
+ relative='win', row=3, col=3, width=12, height=3
+ })
+ meths.win_hide(newwin)
+ eq({oldwin}, meths.list_wins())
+ eq({oldbuf, buf}, meths.list_bufs())
+ end)
+ it('deletes the buffer when bufhidden=wipe', function()
+ local oldwin = meths.get_current_win()
+ local oldbuf = meths.get_current_buf()
+ local buf = meths.create_buf(true, false)
+ local newwin = meths.open_win(buf, true, {
+ relative='win', row=3, col=3, width=12, height=3
+ })
+ meths.buf_set_option(buf, 'bufhidden', 'wipe')
+ meths.win_hide(newwin)
+ eq({oldwin}, meths.list_wins())
+ eq({oldbuf}, meths.list_bufs())
+ end)
+ end)
end)
diff --git a/test/functional/ex_cmds/excmd_spec.lua b/test/functional/ex_cmds/excmd_spec.lua
index aac2a9f469..33794eb50d 100644
--- a/test/functional/ex_cmds/excmd_spec.lua
+++ b/test/functional/ex_cmds/excmd_spec.lua
@@ -24,8 +24,6 @@ describe('Ex cmds', function()
pcall_err(command, ':menu 9999999999999999999999999999999999999999'))
eq('Vim(bdelete):E939: Positive count required',
pcall_err(command, ':bdelete 9999999999999999999999999999999999999999'))
- eq('Vim(retab):E487: Argument must be positive',
- pcall_err(command, ':retab 9999999999999999999999999999999999999999'))
assert_alive()
end)
end)
diff --git a/test/functional/viml/errorlist_spec.lua b/test/functional/viml/errorlist_spec.lua
index 9acc61e398..077d816903 100644
--- a/test/functional/viml/errorlist_spec.lua
+++ b/test/functional/viml/errorlist_spec.lua
@@ -68,4 +68,17 @@ describe('setloclist()', function()
command('lclose | wincmd w | lopen')
eq('foo', get_cur_win_var('quickfix_title'))
end)
+
+ it("doesn't crash when when window is closed in the middle #13721", function()
+ helpers.insert([[
+ hello world]])
+
+ command("vsplit")
+ command("autocmd WinLeave * :call nvim_win_close(0, v:true)")
+
+ command("call setloclist(0, [])")
+ command("lopen")
+
+ helpers.assert_alive()
+ end)
end)