aboutsummaryrefslogtreecommitdiff
path: root/test/functional/ex_cmds/dict_notifications_spec.lua
diff options
context:
space:
mode:
authorBjörn Linse <bjorn.linse@gmail.com>2016-11-01 10:54:32 +0100
committerJames McCoy <jamessan@jamessan.com>2016-12-12 10:17:35 -0500
commit0f681c80e1e9c9060394365dae12f8ebd5736176 (patch)
treeb5e2e6ddb9d45da26a14d78e09cd5f6ee56743fa /test/functional/ex_cmds/dict_notifications_spec.lua
parenta21c687661eac61702fe492264a3c9036bc62f41 (diff)
downloadrneovim-0f681c80e1e9c9060394365dae12f8ebd5736176.tar.gz
rneovim-0f681c80e1e9c9060394365dae12f8ebd5736176.tar.bz2
rneovim-0f681c80e1e9c9060394365dae12f8ebd5736176.zip
Make partials work with jobs, timers, and dictwatchers.
Diffstat (limited to 'test/functional/ex_cmds/dict_notifications_spec.lua')
-rw-r--r--test/functional/ex_cmds/dict_notifications_spec.lua20
1 files changed, 11 insertions, 9 deletions
diff --git a/test/functional/ex_cmds/dict_notifications_spec.lua b/test/functional/ex_cmds/dict_notifications_spec.lua
index dc87312911..e6dc0782fb 100644
--- a/test/functional/ex_cmds/dict_notifications_spec.lua
+++ b/test/functional/ex_cmds/dict_notifications_spec.lua
@@ -2,6 +2,7 @@ local helpers = require('test.functional.helpers')(after_each)
local clear, nvim, source = helpers.clear, helpers.nvim, helpers.source
local eq, next_msg = helpers.eq, helpers.next_message
local exc_exec = helpers.exc_exec
+local command = helpers.command
describe('dictionary change notifications', function()
@@ -229,11 +230,9 @@ describe('dictionary change notifications', function()
exc_exec('call dictwatcherdel(g:, "invalid_key", "g:Watcher2")'))
end)
- it("fails to add/remove if the callback doesn't exist", function()
- eq("Vim(call):Function g:InvalidCb doesn't exist",
- exc_exec('call dictwatcheradd(g:, "key", "g:InvalidCb")'))
- eq("Vim(call):Function g:InvalidCb doesn't exist",
- exc_exec('call dictwatcherdel(g:, "key", "g:InvalidCb")'))
+ it("does not fail to add/remove if the callback doesn't exist", function()
+ command('call dictwatcheradd(g:, "key", "g:InvalidCb")')
+ command('call dictwatcherdel(g:, "key", "g:InvalidCb")')
end)
it('fails with empty keys', function()
@@ -243,15 +242,18 @@ describe('dictionary change notifications', function()
exc_exec('call dictwatcherdel(g:, "", "g:Watcher1")'))
end)
- it('fails to replace a watcher function', function()
+ it('does not fail to replace a watcher function', function()
source([[
function! g:ReplaceWatcher2()
- function! g:Watcher2()
+ function! g:Watcher2(dict, key, value)
+ call rpcnotify(g:channel, '2b', a:key, a:value)
endfunction
endfunction
]])
- eq("Vim(function):E127: Cannot redefine function Watcher2: It is in use",
- exc_exec('call g:ReplaceWatcher2()'))
+ command('call g:ReplaceWatcher2()')
+ command('let g:key = "value"')
+ eq({'notification', '2b', {'key', {old = 'v2', new = 'value'}}}, next_msg())
+
end)
end)
end)