aboutsummaryrefslogtreecommitdiff
path: root/test/functional/core
diff options
context:
space:
mode:
authorMichael Ennen <mike.ennen@gmail.com>2016-12-19 20:09:07 -0700
committerMichael Ennen <mike.ennen@gmail.com>2017-02-14 17:38:19 -0700
commitef8701610baa18ecf2568990eab4ecf02ca8f6c1 (patch)
tree778d37810fc23bac397f2a426de746119dad4450 /test/functional/core
parentbae8a19c63381c3f6c860bae75af3580d68bf3b3 (diff)
downloadrneovim-ef8701610baa18ecf2568990eab4ecf02ca8f6c1.tar.gz
rneovim-ef8701610baa18ecf2568990eab4ecf02ca8f6c1.tar.bz2
rneovim-ef8701610baa18ecf2568990eab4ecf02ca8f6c1.zip
Allow lambdas to be used with jobs, timers and dictwatchers.
Diffstat (limited to 'test/functional/core')
-rw-r--r--test/functional/core/job_spec.lua21
1 files changed, 21 insertions, 0 deletions
diff --git a/test/functional/core/job_spec.lua b/test/functional/core/job_spec.lua
index 6e9633465f..b15af6b9ee 100644
--- a/test/functional/core/job_spec.lua
+++ b/test/functional/core/job_spec.lua
@@ -391,6 +391,27 @@ describe('jobs', function()
eq({'notification', '1', {'foo', 'bar', {'some text', ''}, 'stdout'}}, next_msg())
end)
+ it('jobstart() works with closures', function()
+ source([[
+ fun! MkFun()
+ let a1 = 'foo'
+ let a2 = 'bar'
+ return {id, data, event -> rpcnotify(g:channel, '1', a1, a2, data, event)}
+ endfun
+ let g:job_opts = {'on_stdout': MkFun()}
+ call jobstart(['echo'], g:job_opts)
+ ]])
+ eq({'notification', '1', {'foo', 'bar', {'', ''}, 'stdout'}}, next_msg())
+ end)
+
+ it('jobstart() works when closure passed directly to `jobstart`', function()
+ source([[
+ let g:job_opts = {'on_stdout': {id, data, event -> rpcnotify(g:channel, '1', 'foo', 'bar', data, event)}}
+ call jobstart(['echo'], g:job_opts)
+ ]])
+ eq({'notification', '1', {'foo', 'bar', {'', ''}, 'stdout'}}, next_msg())
+ end)
+
describe('jobwait', function()
it('returns a list of status codes', function()
source([[