mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
test: system([...]): v:shell_error
This commit is contained in:
parent
1e079fa987
commit
9ecdce1d53
@ -38,6 +38,29 @@ describe('system()', function()
|
|||||||
eq(-1, eval('v:shell_error'))
|
eq(-1, eval('v:shell_error'))
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
it('parameter validation does NOT modify v:shell_error', function()
|
||||||
|
-- 1. Call system() with invalid parameters.
|
||||||
|
-- 2. Assert that v:shell_error was NOT set.
|
||||||
|
execute('call system({})')
|
||||||
|
eq('E475: Invalid argument: expected String or List', eval('v:errmsg'))
|
||||||
|
eq(0, eval('v:shell_error'))
|
||||||
|
execute('call system([])')
|
||||||
|
eq('E474: Invalid argument', eval('v:errmsg'))
|
||||||
|
eq(0, eval('v:shell_error'))
|
||||||
|
|
||||||
|
-- Provoke a non-zero v:shell_error.
|
||||||
|
call('system', { 'this-should-not-exist' })
|
||||||
|
local old_val = eval('v:shell_error')
|
||||||
|
eq(-1, old_val)
|
||||||
|
|
||||||
|
-- 1. Call system() with invalid parameters.
|
||||||
|
-- 2. Assert that v:shell_error was NOT modified.
|
||||||
|
execute('call system({})')
|
||||||
|
eq(old_val, eval('v:shell_error'))
|
||||||
|
execute('call system([])')
|
||||||
|
eq(old_val, eval('v:shell_error'))
|
||||||
|
end)
|
||||||
|
|
||||||
it('quotes arguments correctly #5280', function()
|
it('quotes arguments correctly #5280', function()
|
||||||
local out = call('system',
|
local out = call('system',
|
||||||
{ printargs_path, [[1]], [[2 "3]], [[4 ' 5]], [[6 ' 7']] })
|
{ printargs_path, [[1]], [[2 "3]], [[4 ' 5]], [[6 ' 7']] })
|
||||||
|
Loading…
Reference in New Issue
Block a user