aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorThiago de Arruda <tpadilha84@gmail.com>2014-11-21 15:21:03 -0300
committerThiago de Arruda <tpadilha84@gmail.com>2014-11-21 15:39:04 -0300
commit230c935e73c0eb8359b18f0da9ce2238cd7830bc (patch)
treebca425890037645aafc77288ee77a8b504ee35d1 /test
parent179c51319df0bc6f75a1376a0ca337c34d0a0b87 (diff)
downloadrneovim-230c935e73c0eb8359b18f0da9ce2238cd7830bc.tar.gz
rneovim-230c935e73c0eb8359b18f0da9ce2238cd7830bc.tar.bz2
rneovim-230c935e73c0eb8359b18f0da9ce2238cd7830bc.zip
test: Fix problems in job_spec.lua
Nvim wasn't exiting cleanly in some job tests due to errors. This can't be noticed until the next commit, which will perform a refactoring to selectively process K_EVENT, so the `qa!` command executed at the end of each test blocks forever if there are errors which require the user to press ENTER(in that state Nvim no longer will process events).
Diffstat (limited to 'test')
-rw-r--r--test/functional/job/job_spec.lua11
1 files changed, 6 insertions, 5 deletions
diff --git a/test/functional/job/job_spec.lua b/test/functional/job/job_spec.lua
index 85a1e92e38..07ca0c0058 100644
--- a/test/functional/job/job_spec.lua
+++ b/test/functional/job/job_spec.lua
@@ -37,7 +37,7 @@ describe('jobs', function()
end)
it('allows interactive commands', function()
- nvim('command', notify_str('v:job_data[1]', 'v:job_data[2]'))
+ nvim('command', notify_str('v:job_data[1]', 'get(v:job_data, 2)'))
nvim('command', "let j = jobstart('xxx', 'cat', ['-'])")
neq(0, eval('j'))
nvim('command', 'call jobsend(j, "abc\\n")')
@@ -46,9 +46,8 @@ describe('jobs', function()
eq({'notification', 'stdout', {{'123', 'xyz'}}}, next_message())
nvim('command', 'call jobsend(j, [123, "xyz"])')
eq({'notification', 'stdout', {{'123', 'xyz'}}}, next_message())
- nvim('command', notify_str('v:job_data[1])'))
nvim('command', "call jobstop(j)")
- eq({'notification', 'exit', {}}, next_message())
+ eq({'notification', 'exit', {0}}, next_message())
end)
it('preserves NULs', function()
@@ -59,9 +58,10 @@ describe('jobs', function()
file:close()
-- v:job_data preserves NULs.
- nvim('command', notify_str('v:job_data[1]', 'v:job_data[2]'))
+ nvim('command', notify_str('v:job_data[1]', 'get(v:job_data, 2)'))
nvim('command', "let j = jobstart('xxx', 'cat', ['"..filename.."'])")
eq({'notification', 'stdout', {{'abc\ndef'}}}, next_message())
+ eq({'notification', 'exit', {0}}, next_message())
os.remove(filename)
-- jobsend() preserves NULs.
@@ -72,12 +72,13 @@ describe('jobs', function()
end)
it('will hold data if it does not end in a newline', function()
- nvim('command', notify_str('v:job_data[1]', 'v:job_data[2]'))
+ nvim('command', notify_str('v:job_data[1]', 'get(v:job_data, 2)'))
nvim('command', "let j = jobstart('xxx', 'cat', ['-'])")
nvim('command', 'call jobsend(j, "abc\\nxyz")')
eq({'notification', 'stdout', {{'abc'}}}, next_message())
nvim('command', "call jobstop(j)")
eq({'notification', 'stdout', {{'xyz'}}}, next_message())
+ eq({'notification', 'exit', {0}}, next_message())
end)
it('will not allow jobsend/stop on a non-existent job', function()