diff options
author | Josh Rahm <joshuarahm@gmail.com> | 2023-01-25 18:23:01 +0000 |
---|---|---|
committer | Josh Rahm <joshuarahm@gmail.com> | 2023-01-25 18:23:01 +0000 |
commit | 142d9041391780ac15b89886a54015fdc5c73995 (patch) | |
tree | 0f6b5cac1a60810a03f52826c9e67c9e2780b033 /test/functional/autocmd/autocmd_spec.lua | |
parent | ad86b5db74922285699ab2a1dbb2ff20e6268a33 (diff) | |
parent | 3c48d3c83fc21dbc0841f9210f04bdb073d73cd1 (diff) | |
download | rneovim-142d9041391780ac15b89886a54015fdc5c73995.tar.gz rneovim-142d9041391780ac15b89886a54015fdc5c73995.tar.bz2 rneovim-142d9041391780ac15b89886a54015fdc5c73995.zip |
Merge remote-tracking branch 'upstream/master' into userreg
Diffstat (limited to 'test/functional/autocmd/autocmd_spec.lua')
-rw-r--r-- | test/functional/autocmd/autocmd_spec.lua | 42 |
1 files changed, 38 insertions, 4 deletions
diff --git a/test/functional/autocmd/autocmd_spec.lua b/test/functional/autocmd/autocmd_spec.lua index 90254b7415..fb5bab445c 100644 --- a/test/functional/autocmd/autocmd_spec.lua +++ b/test/functional/autocmd/autocmd_spec.lua @@ -9,6 +9,7 @@ local neq = helpers.neq local eval = helpers.eval local feed = helpers.feed local clear = helpers.clear +local matches = helpers.matches local meths = helpers.meths local pcall_err = helpers.pcall_err local funcs = helpers.funcs @@ -424,17 +425,50 @@ describe('autocmd', function() end) it('gives E814 when there are no other floating windows', function() - eq('Vim(close):E814: Cannot close window, only autocmd window would remain', + eq('BufAdd Autocommands for "Xa.txt": Vim(close):E814: Cannot close window, only autocmd window would remain', pcall_err(command, 'doautoall BufAdd')) end) it('gives E814 when there are other floating windows', function() meths.open_win(0, true, {width = 10, height = 10, relative = 'editor', row = 10, col = 10}) - eq('Vim(close):E814: Cannot close window, only autocmd window would remain', + eq('BufAdd Autocommands for "Xa.txt": Vim(close):E814: Cannot close window, only autocmd window would remain', pcall_err(command, 'doautoall BufAdd')) end) end) + it('closing `aucmd_win` using API gives E813', function() + exec_lua([[ + vim.cmd('tabnew') + _G.buf = vim.api.nvim_create_buf(true, true) + ]]) + matches('Vim:E813: Cannot close autocmd window$', pcall_err(exec_lua, [[ + vim.api.nvim_buf_call(_G.buf, function() + local win = vim.api.nvim_get_current_win() + vim.api.nvim_win_close(win, true) + end) + ]])) + matches('Vim:E813: Cannot close autocmd window$', pcall_err(exec_lua, [[ + vim.api.nvim_buf_call(_G.buf, function() + local win = vim.api.nvim_get_current_win() + vim.cmd('tabnext') + vim.api.nvim_win_close(win, true) + end) + ]])) + matches('Vim:E813: Cannot close autocmd window$', pcall_err(exec_lua, [[ + vim.api.nvim_buf_call(_G.buf, function() + local win = vim.api.nvim_get_current_win() + vim.api.nvim_win_hide(win) + end) + ]])) + matches('Vim:E813: Cannot close autocmd window$', pcall_err(exec_lua, [[ + vim.api.nvim_buf_call(_G.buf, function() + local win = vim.api.nvim_get_current_win() + vim.cmd('tabnext') + vim.api.nvim_win_hide(win) + end) + ]])) + end) + it(':doautocmd does not warn "No matching autocommands" #10689', function() local screen = Screen.new(32, 3) screen:attach() @@ -476,14 +510,14 @@ describe('autocmd', function() it('during RecordingLeave event', function() command([[autocmd RecordingLeave * let v:event.regname = '']]) - eq('Vim(let):E46: Cannot change read-only variable "v:event.regname"', + eq('RecordingLeave Autocommands for "*": Vim(let):E46: Cannot change read-only variable "v:event.regname"', pcall_err(command, 'normal! qqq')) end) it('during TermClose event', function() command('autocmd TermClose * let v:event.status = 0') command('terminal') - eq('Vim(let):E46: Cannot change read-only variable "v:event.status"', + eq('TermClose Autocommands for "*": Vim(let):E46: Cannot change read-only variable "v:event.status"', pcall_err(command, 'bdelete!')) end) end) |