aboutsummaryrefslogtreecommitdiff
path: root/test/functional/eval/system_spec.lua
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2017-01-10 18:06:34 +0100
committerJustin M. Keyes <justinkz@gmail.com>2017-01-11 01:05:56 +0100
commit9ecdce1d530aa2ae1db5982794f615050c3af05a (patch)
tree5f122c90d174e9e75fbfd0ff367cd17912d750f9 /test/functional/eval/system_spec.lua
parent1e079fa987ac5211a1749c13a4efaa6090963fa7 (diff)
downloadrneovim-9ecdce1d530aa2ae1db5982794f615050c3af05a.tar.gz
rneovim-9ecdce1d530aa2ae1db5982794f615050c3af05a.tar.bz2
rneovim-9ecdce1d530aa2ae1db5982794f615050c3af05a.zip
test: system([...]): v:shell_error
Diffstat (limited to 'test/functional/eval/system_spec.lua')
-rw-r--r--test/functional/eval/system_spec.lua23
1 files changed, 23 insertions, 0 deletions
diff --git a/test/functional/eval/system_spec.lua b/test/functional/eval/system_spec.lua
index bbbbdcd2ef..d5845132dd 100644
--- a/test/functional/eval/system_spec.lua
+++ b/test/functional/eval/system_spec.lua
@@ -38,6 +38,29 @@ describe('system()', function()
eq(-1, eval('v:shell_error'))
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()
local out = call('system',
{ printargs_path, [[1]], [[2 "3]], [[4 ' 5]], [[6 ' 7']] })