diff options
| author | James McCoy <jamessan@jamessan.com> | 2017-02-02 19:52:59 -0500 | 
|---|---|---|
| committer | James McCoy <jamessan@jamessan.com> | 2017-02-02 19:52:59 -0500 | 
| commit | ce51fa09551d6f807b87a05b8ec204f65fa70a4d (patch) | |
| tree | 08960edc785ddcf810f98115ba4c7616bee4f934 /test/functional/eval/system_spec.lua | |
| parent | 7e30fe315786c9e10817f87e5b80da70807e9cb1 (diff) | |
| download | rneovim-ce51fa09551d6f807b87a05b8ec204f65fa70a4d.tar.gz rneovim-ce51fa09551d6f807b87a05b8ec204f65fa70a4d.tar.bz2 rneovim-ce51fa09551d6f807b87a05b8ec204f65fa70a4d.zip | |
test: Turn printargs_path into a function
When test/functional/eval/system_spec.lua is run on its own,
helpers.os_name() was being called before a session had been created.
This caused that describe block to fail.
Turning printargs_path into a function delays the call of
helpers.os_name() until the test is being run, which ensures a session
is available.
Diffstat (limited to 'test/functional/eval/system_spec.lua')
| -rw-r--r-- | test/functional/eval/system_spec.lua | 12 | 
1 files changed, 7 insertions, 5 deletions
| diff --git a/test/functional/eval/system_spec.lua b/test/functional/eval/system_spec.lua index 96cfd5a31a..ee75b593ff 100644 --- a/test/functional/eval/system_spec.lua +++ b/test/functional/eval/system_spec.lua @@ -30,8 +30,10 @@ describe('system()', function()    before_each(clear)    describe('command passed as a List', function() -    local printargs_path = helpers.nvim_dir..'/printargs-test' -      .. (helpers.os_name() == 'windows' and '.exe' or '') +    local function printargs_path() +      return helpers.nvim_dir..'/printargs-test' +        .. (helpers.os_name() == 'windows' and '.exe' or '') +    end      it('sets v:shell_error if cmd[0] is not executable', function()        call('system', { 'this-should-not-exist' }) @@ -63,16 +65,16 @@ describe('system()', function()      it('quotes arguments correctly #5280', function()        local out = call('system', -        { printargs_path, [[1]], [[2 "3]], [[4 ' 5]], [[6 ' 7']] }) +        { printargs_path(), [[1]], [[2 "3]], [[4 ' 5]], [[6 ' 7']] })        eq(0, eval('v:shell_error'))        eq([[arg1=1;arg2=2 "3;arg3=4 ' 5;arg4=6 ' 7';]], out) -      out = call('system', { printargs_path, [['1]], [[2 "3]] }) +      out = call('system', { printargs_path(), [['1]], [[2 "3]] })        eq(0, eval('v:shell_error'))        eq([[arg1='1;arg2=2 "3;]], out) -      out = call('system', { printargs_path, "A\nB" }) +      out = call('system', { printargs_path(), "A\nB" })        eq(0, eval('v:shell_error'))        eq("arg1=A\nB;", out)      end) | 
