aboutsummaryrefslogtreecommitdiff
path: root/test/functional/autocmd/autocmd_spec.lua
diff options
context:
space:
mode:
authorJosh Rahm <joshuarahm@gmail.com>2025-02-05 23:09:29 +0000
committerJosh Rahm <joshuarahm@gmail.com>2025-02-05 23:09:29 +0000
commitd5f194ce780c95821a855aca3c19426576d28ae0 (patch)
treed45f461b19f9118ad2bb1f440a7a08973ad18832 /test/functional/autocmd/autocmd_spec.lua
parentc5d770d311841ea5230426cc4c868e8db27300a8 (diff)
parent44740e561fc93afe3ebecfd3618bda2d2abeafb0 (diff)
downloadrneovim-rahm.tar.gz
rneovim-rahm.tar.bz2
rneovim-rahm.zip
Merge remote-tracking branch 'upstream/master' into mix_20240309HEADrahm
Diffstat (limited to 'test/functional/autocmd/autocmd_spec.lua')
-rw-r--r--test/functional/autocmd/autocmd_spec.lua24
1 files changed, 21 insertions, 3 deletions
diff --git a/test/functional/autocmd/autocmd_spec.lua b/test/functional/autocmd/autocmd_spec.lua
index c62e4752e0..1b7275ebf6 100644
--- a/test/functional/autocmd/autocmd_spec.lua
+++ b/test/functional/autocmd/autocmd_spec.lua
@@ -160,7 +160,7 @@ describe('autocmd', function()
it('++once', function() -- :help autocmd-once
--
- -- ":autocmd ... ++once" executes its handler once, then removes the handler.
+ -- ":autocmd … ++once" executes its handler once, then removes the handler.
--
local expected = {
'Many1',
@@ -206,7 +206,7 @@ describe('autocmd', function()
)
--
- -- ":autocmd ... ++once" handlers can be deleted.
+ -- ":autocmd … ++once" handlers can be deleted.
--
expected = {}
command('let g:foo = []')
@@ -216,7 +216,7 @@ describe('autocmd', function()
eq(expected, eval('g:foo'))
--
- -- ":autocmd ... <buffer> ++once ++nested"
+ -- ":autocmd … <buffer> ++once ++nested"
--
expected = {
'OptionSet-Once',
@@ -250,6 +250,24 @@ describe('autocmd', function()
--- Autocommands ---]]),
fn.execute('autocmd Tabnew')
)
+
+ --
+ -- :autocmd does not recursively call ++once Lua handlers.
+ --
+ exec_lua [[vim.g.count = 0]]
+ eq(0, eval('g:count'))
+ exec_lua [[
+ vim.api.nvim_create_autocmd('User', {
+ once = true,
+ pattern = nil,
+ callback = function()
+ vim.g.count = vim.g.count + 1
+ vim.api.nvim_exec_autocmds('User', { pattern = nil })
+ end,
+ })
+ vim.api.nvim_exec_autocmds('User', { pattern = nil })
+ ]]
+ eq(1, eval('g:count'))
end)
it('internal `aucmd_win` window', function()