diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2016-10-23 00:33:51 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-10-23 00:33:51 +0200 |
commit | fdc48cad7d9fe40ad62a0ba995d088c791bc38ab (patch) | |
tree | 2461740a620ddfbb7f8da2e6557f0a974b5c7cf1 /test/functional/eval/system_spec.lua | |
parent | 500c485e36759f23654de3ce792f3d3b68936c01 (diff) | |
parent | 459a6ff05882e5249f02172b61f2bddc4b598e39 (diff) | |
download | rneovim-fdc48cad7d9fe40ad62a0ba995d088c791bc38ab.tar.gz rneovim-fdc48cad7d9fe40ad62a0ba995d088c791bc38ab.tar.bz2 rneovim-fdc48cad7d9fe40ad62a0ba995d088c791bc38ab.zip |
Merge #5523 from justinmk/test-system
test: system(): Avoid indeterminism. Also adjust docs.
Diffstat (limited to 'test/functional/eval/system_spec.lua')
-rw-r--r-- | test/functional/eval/system_spec.lua | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/test/functional/eval/system_spec.lua b/test/functional/eval/system_spec.lua index b8f1f87f30..6393477260 100644 --- a/test/functional/eval/system_spec.lua +++ b/test/functional/eval/system_spec.lua @@ -1,6 +1,7 @@ local helpers = require('test.functional.helpers')(after_each) -local eq, clear, eval, feed, nvim = - helpers.eq, helpers.clear, helpers.eval, helpers.feed, helpers.nvim +local eq, clear, eval, execute, feed, nvim = + helpers.eq, helpers.clear, helpers.eval, helpers.execute, helpers.feed, + helpers.nvim local Screen = require('test.functional.ui.screen') @@ -117,8 +118,12 @@ describe('system()', function() eq("echoed", eval('system("echo -n echoed")')) end) it('to backgrounded command does not crash', function() - -- This is indeterminate, just exercise the codepath. - eval('system("echo -n echoed &")') + -- This is indeterminate, just exercise the codepath. May get E5677. + execute('call system("echo -n echoed &")') + local v_errnum = string.match(eval("v:errmsg"), "^E%d*:") + if v_errnum then + eq("E5677:", v_errnum) + end eq(2, eval("1+1")) -- Still alive? end) end) @@ -128,8 +133,12 @@ describe('system()', function() eq("input", eval('system("cat -", "input")')) end) it('to backgrounded command does not crash', function() - -- This is indeterminate, just exercise the codepath. - eval('system("cat - &", "input")') + -- This is indeterminate, just exercise the codepath. May get E5677. + execute('call system("cat - &")') + local v_errnum = string.match(eval("v:errmsg"), "^E%d*:") + if v_errnum then + eq("E5677:", v_errnum) + end eq(2, eval("1+1")) -- Still alive? end) end) |