aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDaniel Hahler <git@thequod.de>2019-10-09 19:40:50 +0200
committerJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2021-03-30 21:55:50 -0400
commit4c76b1e981f072229944a22e5d5ee76fe42d994a (patch)
tree1db14e1ff707894bb8568d83efc0b77ba492d11e /test
parentc20ae3aadbcc1210faad4cd3cf6a8444f198b19d (diff)
downloadrneovim-4c76b1e981f072229944a22e5d5ee76fe42d994a.tar.gz
rneovim-4c76b1e981f072229944a22e5d5ee76fe42d994a.tar.bz2
rneovim-4c76b1e981f072229944a22e5d5ee76fe42d994a.zip
Test and initial fix for crash with dictwatcherdel
Fixes https://github.com/neovim/neovim/issues/11188.
Diffstat (limited to 'test')
-rw-r--r--test/functional/ex_cmds/dict_notifications_spec.lua20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/functional/ex_cmds/dict_notifications_spec.lua b/test/functional/ex_cmds/dict_notifications_spec.lua
index 5c67431221..3e6c248411 100644
--- a/test/functional/ex_cmds/dict_notifications_spec.lua
+++ b/test/functional/ex_cmds/dict_notifications_spec.lua
@@ -371,4 +371,24 @@ describe('VimL dictionary notifications', function()
eq(1, eval('g:called'))
end)
+ it('does not crash when using dictwatcherdel in callback', function()
+ source([[
+ let g:d = {}
+
+ function! W(...)
+ call dictwatcherdel(g:d, '*', function('W'))
+ try
+ call dictwatcherdel({}, 'meh', function('tr'))
+ catch
+ let g:exc = v:exception
+ endtry
+ endfunction
+
+ call dictwatcheradd(g:d, '*', function('W'))
+ let g:d.foo = 23
+ ]])
+ eq(23, eval('g:d.foo'))
+ eq("Vim(call):Couldn't find a watcher matching key and callback", eval('g:exc'))
+ end)
+
end)