aboutsummaryrefslogtreecommitdiff
path: root/test/functional/shell/viml_system_spec.lua
diff options
context:
space:
mode:
authorThiago de Arruda <tpadilha84@gmail.com>2014-10-22 07:15:55 -0300
committerThiago de Arruda <tpadilha84@gmail.com>2014-10-22 07:15:55 -0300
commitf7fab4af863839a064a941a555b237b6eb789870 (patch)
tree57a419ce9104adf84bd1152a01f9c1f75f4bef85 /test/functional/shell/viml_system_spec.lua
parentb49460f930edc52be80522fa5da3d5b6a1260629 (diff)
downloadrneovim-f7fab4af863839a064a941a555b237b6eb789870.tar.gz
rneovim-f7fab4af863839a064a941a555b237b6eb789870.tar.bz2
rneovim-f7fab4af863839a064a941a555b237b6eb789870.zip
test: verify that v:shell_error is set by `system()`/`systemlist()`
Diffstat (limited to 'test/functional/shell/viml_system_spec.lua')
-rw-r--r--test/functional/shell/viml_system_spec.lua18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/functional/shell/viml_system_spec.lua b/test/functional/shell/viml_system_spec.lua
index effabe715c..6dde2ef538 100644
--- a/test/functional/shell/viml_system_spec.lua
+++ b/test/functional/shell/viml_system_spec.lua
@@ -23,6 +23,15 @@ end
describe('system()', function()
before_each(clear)
+ it('sets the v:shell_error variable', function()
+ eval([[system("sh -c 'exit'")]])
+ eq(0, eval('v:shell_error'))
+ eval([[system("sh -c 'exit 1'")]])
+ eq(1, eval('v:shell_error'))
+ eval([[system("sh -c 'exit 5'")]])
+ eq(5, eval('v:shell_error'))
+ end)
+
describe('passing no input', function()
it('returns the program output', function()
eq("echoed", eval('system("echo -n echoed")'))
@@ -83,6 +92,15 @@ describe('systemlist()', function()
-- string.
before_each(clear)
+ it('sets the v:shell_error variable', function()
+ eval([[systemlist("sh -c 'exit'")]])
+ eq(0, eval('v:shell_error'))
+ eval([[systemlist("sh -c 'exit 1'")]])
+ eq(1, eval('v:shell_error'))
+ eval([[systemlist("sh -c 'exit 5'")]])
+ eq(5, eval('v:shell_error'))
+ end)
+
describe('passing string with linefeed characters as input', function()
it('splits the output on linefeed characters', function()
eq({'abc', 'def', 'ghi'}, eval([[systemlist("cat -", "abc\ndef\nghi")]]))