diff options
| author | James McCoy <jamessan@jamessan.com> | 2017-02-23 07:30:20 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-02-23 07:30:20 -0500 |
| commit | 9752a333c32c344eb0cd86b4a3bba4ce6cba3b23 (patch) | |
| tree | 8a34046b26b8ae39373005a29f6a72564e3ccf13 /test/functional/core | |
| parent | 4e21311f9cceabcfaa6c746518cb2628deb2bb40 (diff) | |
| parent | d4dd447ded5e0818fe3e49ebbe59fdafdaae7a1b (diff) | |
| download | rneovim-9752a333c32c344eb0cd86b4a3bba4ce6cba3b23.tar.gz rneovim-9752a333c32c344eb0cd86b4a3bba4ce6cba3b23.tar.bz2 rneovim-9752a333c32c344eb0cd86b4a3bba4ce6cba3b23.zip | |
Merge pull request #5771 from brcolow/lambda
Lambda Support
Diffstat (limited to 'test/functional/core')
| -rw-r--r-- | test/functional/core/job_spec.lua | 21 |
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..b551adb8db 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, Normalize(data), event)} + endfun + let g:job_opts = {'on_stdout': MkFun()} + call jobstart('echo "some text"', g:job_opts) + ]]) + eq({'notification', '1', {'foo', 'bar', {'some text', ''}, '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', Normalize(data), event)}} + call jobstart('echo "some text"', g:job_opts) + ]]) + eq({'notification', '1', {'foo', 'bar', {'some text', ''}, 'stdout'}}, next_msg()) + end) + describe('jobwait', function() it('returns a list of status codes', function() source([[ |