diff options
Diffstat (limited to 'test/functional/api/vim_spec.lua')
-rw-r--r-- | test/functional/api/vim_spec.lua | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/test/functional/api/vim_spec.lua b/test/functional/api/vim_spec.lua index 39db831fe3..1faed4e9b1 100644 --- a/test/functional/api/vim_spec.lua +++ b/test/functional/api/vim_spec.lua @@ -11,6 +11,7 @@ local funcs = helpers.funcs local request = helpers.request local meth_pcall = helpers.meth_pcall local command = helpers.command +local iswin = helpers.iswin local intchar2lua = global_helpers.intchar2lua local format_string = global_helpers.format_string @@ -99,8 +100,9 @@ describe('api', function() [[echo nvim_command_output('echo "nested1\nnested2"') | ls]])) end) - it('does not return shell |:!| output', function() - eq(':!echo "foo"\r\n', nvim('command_output', [[!echo "foo"]])) + it('returns shell |:!| output', function() + local win_lf = iswin() and '\r' or '' + eq(':!echo foo\r\n\nfoo'..win_lf..'\n', nvim('command_output', [[!echo foo]])) end) it("parse error: fails (specific error), does NOT update v:errmsg", function() @@ -951,9 +953,20 @@ describe('api', function() end end) if not err then - msg = format_string('Error while processing test (%r, %s):\n%s', - str, FLAGS_TO_STR[flags], msg) - error(msg) + if type(msg) == 'table' then + local merr, new_msg = pcall( + format_string, 'table error:\n%s\n\n(%r)', msg.message, msg) + if merr then + msg = new_msg + else + msg = format_string('table error without .message:\n(%r)', + msg) + end + elseif type(msg) ~= 'string' then + msg = format_string('non-string non-table error:\n%r', msg) + end + error(format_string('Error while processing test (%r, %s):\n%s', + str, FLAGS_TO_STR[flags], msg)) end end end |