aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/functional/job/job_spec.lua36
1 files changed, 36 insertions, 0 deletions
diff --git a/test/functional/job/job_spec.lua b/test/functional/job/job_spec.lua
index 7085d61cc7..bdaf2a7ec6 100644
--- a/test/functional/job/job_spec.lua
+++ b/test/functional/job/job_spec.lua
@@ -6,6 +6,7 @@ local clear, eq, eval, execute, expect, feed, insert, neq, next_msg, nvim,
helpers.insert, helpers.neq, helpers.next_message, helpers.nvim,
helpers.nvim_dir, helpers.ok, helpers.run, helpers.session, helpers.source,
helpers.stop, helpers.wait, helpers.write_file
+local Screen = require('test.functional.ui.screen')
describe('jobs', function()
@@ -188,6 +189,41 @@ describe('jobs', function()
eq({'notification', 'exit', {45, 10}}, next_msg())
end)
+ it('cant redefine callbacks being used by a job', function()
+ local screen = Screen.new()
+ screen:attach()
+ local script = [[
+ function! g:JobHandler(job_id, data, event)
+ endfunction
+
+ let g:callbacks = {
+ \ 'on_stdout': function('g:JobHandler'),
+ \ 'on_stderr': function('g:JobHandler'),
+ \ 'on_exit': function('g:JobHandler')
+ \ }
+ let job = jobstart('cat -', g:callbacks)
+ ]]
+ source(script)
+ 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^ |
+ ]])
+ end)
+
describe('jobwait', function()
it('returns a list of status codes', function()
source([[