shell: update execute('!cmd') test to new behavior

And similarly nvim_command_output test
This commit is contained in:
Björn Linse
2018-01-21 19:58:19 +01:00
parent 9af14506e5
commit 4e7d85e635
2 changed files with 11 additions and 5 deletions

View File

@@ -15,6 +15,7 @@ local command = helpers.command
local intchar2lua = global_helpers.intchar2lua local intchar2lua = global_helpers.intchar2lua
local format_string = global_helpers.format_string local format_string = global_helpers.format_string
local mergedicts_copy = global_helpers.mergedicts_copy local mergedicts_copy = global_helpers.mergedicts_copy
local uname = global_helpers.uname
describe('api', function() describe('api', function()
before_each(clear) before_each(clear)
@@ -99,8 +100,9 @@ describe('api', function()
[[echo nvim_command_output('echo "nested1\nnested2"') | ls]])) [[echo nvim_command_output('echo "nested1\nnested2"') | ls]]))
end) end)
it('does not return shell |:!| output', function() it('returns shell |:!| output', function()
eq(':!echo "foo"\r\n', nvim('command_output', [[!echo "foo"]])) local win_lf = (uname() == 'Windows' and '\r') or ''
eq(':!echo foo\r\n\nfoo'..win_lf..'\n', nvim('command_output', [[!echo foo]]))
end) end)
it("parse error: fails (specific error), does NOT update v:errmsg", function() it("parse error: fails (specific error), does NOT update v:errmsg", function()

View File

@@ -1,4 +1,5 @@
local helpers = require('test.functional.helpers')(after_each) local helpers = require('test.functional.helpers')(after_each)
local global_helpers = require('test.helpers')
local eq = helpers.eq local eq = helpers.eq
local eval = helpers.eval local eval = helpers.eval
local clear = helpers.clear local clear = helpers.clear
@@ -9,6 +10,7 @@ local funcs = helpers.funcs
local Screen = require('test.functional.ui.screen') local Screen = require('test.functional.ui.screen')
local command = helpers.command local command = helpers.command
local feed = helpers.feed local feed = helpers.feed
local uname = global_helpers.uname
describe('execute()', function() describe('execute()', function()
before_each(clear) before_each(clear)
@@ -118,9 +120,11 @@ describe('execute()', function()
feed('<CR>') feed('<CR>')
end) end)
-- This matches Vim behavior. -- This deviates from vim behavior, but is consistent
it('does not capture shell-command output', function() -- with how nvim currently displays the output.
eq('\n:!echo "foo"\13\n', funcs.execute('!echo "foo"')) it('does capture shell-command output', function()
local win_lf = (uname() == 'Windows' and '\13') or ''
eq('\n:!echo foo\r\n\nfoo'..win_lf..'\n', funcs.execute('!echo foo'))
end) end)
describe('{silent} argument', function() describe('{silent} argument', function()