aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/functional/core/job_spec.lua39
-rw-r--r--test/functional/ex_cmds/dict_notifications_spec.lua20
2 files changed, 32 insertions, 27 deletions
diff --git a/test/functional/core/job_spec.lua b/test/functional/core/job_spec.lua
index 79cc877cac..34085fa522 100644
--- a/test/functional/core/job_spec.lua
+++ b/test/functional/core/job_spec.lua
@@ -18,7 +18,7 @@ describe('jobs', function()
channel = nvim('get_api_info')[1]
nvim('set_var', 'channel', channel)
source([[
- function! s:OnEvent(id, data, event)
+ function! s:OnEvent(id, data, event) dict
let userdata = get(self, 'user')
call rpcnotify(g:channel, a:event, userdata, a:data)
endfunction
@@ -265,9 +265,12 @@ describe('jobs', function()
eq({'notification', 'exit', {45, 10}}, next_msg())
end)
- it('cannot redefine callbacks being used by a job', function()
+ it('can redefine callbacks being used by a job', function()
local screen = Screen.new()
screen:attach()
+ screen:set_default_attr_ids({
+ [1] = {bold=true, foreground=Screen.colors.Blue},
+ })
local script = [[
function! g:JobHandler(job_id, data, event)
endfunction
@@ -283,20 +286,20 @@ describe('jobs', function()
feed(':function! g:JobHandler(job_id, data, event)<cr>')
feed(':endfunction<cr>')
screen:expect([[
- ~ |
- ~ |
- ~ |
- ~ |
- ~ |
- ~ |
- ~ |
- ~ |
- ~ |
- :function! g:JobHandler(job_id, data, event) |
- : :endfunction |
- E127: Cannot redefine function JobHandler: It is in u|
- se |
- Press ENTER or type command to continue^ |
+ ^ |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ |
]])
end)
@@ -317,7 +320,7 @@ describe('jobs', function()
source([[
let g:dict = {'id': 10}
let g:exits = 0
- function g:dict.on_exit(id, code)
+ function g:dict.on_exit(id, code, event)
if a:code != 5
throw 'Error!'
endif
@@ -365,7 +368,7 @@ describe('jobs', function()
eq({'notification', 'wait', {{-2}}}, next_msg())
end)
- it('can be called recursively', function()
+ pending('can be called recursively', function()
source([[
let g:opts = {}
let g:counter = 0
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)