aboutsummaryrefslogtreecommitdiff
path: root/test/functional/core
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/core
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/core')
-rw-r--r--test/functional/core/job_partial_spec.lua27
-rw-r--r--test/functional/core/job_spec.lua39
2 files changed, 48 insertions, 18 deletions
diff --git a/test/functional/core/job_partial_spec.lua b/test/functional/core/job_partial_spec.lua
new file mode 100644
index 0000000000..b60f239db9
--- /dev/null
+++ b/test/functional/core/job_partial_spec.lua
@@ -0,0 +1,27 @@
+local helpers = require('test.functional.helpers')(after_each)
+local clear, eq, next_msg, nvim, source = helpers.clear, helpers.eq,
+ helpers.next_message, helpers.nvim, helpers.source
+
+if helpers.pending_win32(pending) then return end
+
+describe('jobs with partials', function()
+ local channel
+
+ before_each(function()
+ clear()
+ channel = nvim('get_api_info')[1]
+ nvim('set_var', 'channel', channel)
+ end)
+
+ it('works correctly', function()
+ source([[
+ function PrintArgs(a1, a2, id, data, event)
+ call rpcnotify(g:channel, '1', a:a1, a:a2, a:data, a:event)
+ endfunction
+ let Callback = function('PrintArgs', ["foo", "bar"])
+ let g:job_opts = {'on_stdout': Callback}
+ call jobstart(['echo'], g:job_opts)
+ ]])
+ eq({'notification', '1', {'foo', 'bar', {'', ''}, 'stdout'}}, next_msg())
+ end)
+end)
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