aboutsummaryrefslogtreecommitdiff
path: root/test/functional/ex_cmds/dict_notifications_spec.lua
diff options
context:
space:
mode:
authorJames McCoy <jamessan@jamessan.com>2016-12-12 10:53:33 -0500
committerGitHub <noreply@github.com>2016-12-12 10:53:32 -0500
commit988ab5804a16beafff26b487b0612cb7cf97ea09 (patch)
treee31b25acaf30023616d4f469af5d067befd30556 /test/functional/ex_cmds/dict_notifications_spec.lua
parent75c18b6aaa8430596fa10466dc7918047b13ff2b (diff)
parent5e4eb18eb0242794c0b3a622f7acf0d3e6856c05 (diff)
downloadrneovim-988ab5804a16beafff26b487b0612cb7cf97ea09.tar.gz
rneovim-988ab5804a16beafff26b487b0612cb7cf97ea09.tar.bz2
rneovim-988ab5804a16beafff26b487b0612cb7cf97ea09.zip
Merge pull request #5529 from brcolow/vim-7.4.1559
Port partial patches from vim
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..e6f7609016 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)