api: Do not truncate errors <1 MB. #6237

Closes #5984
This commit is contained in:
Sander Bosma
2017-03-01 10:43:47 +01:00
committed by Justin M. Keyes
parent 4524053874
commit 5c9860a0a2
15 changed files with 209 additions and 172 deletions

View File

@@ -2,6 +2,7 @@ local helpers = require('test.functional.helpers')(after_each)
local eval, command, feed = helpers.eval, helpers.command, helpers.feed
local eq, clear, insert = helpers.eq, helpers.clear, helpers.insert
local expect, write_file = helpers.expect, helpers.write_file
local feed_command = helpers.feed_command
do
clear()
@@ -30,6 +31,15 @@ describe('python3 commands and functions', function()
eq({100, 0}, eval('g:set_by_python3'))
end)
it('does not truncate error message <1 MB', function()
-- XXX: Python limits the error name to 200 chars, so this test is
-- mostly bogus.
local very_long_symbol = string.rep('a', 1200)
feed_command(':silent! py3 print('..very_long_symbol..' b)')
-- Truncated error message would not contain this (last) line.
eq('SyntaxError: invalid syntax', eval('v:errmsg'))
end)
it('python3_execute with nested commands', function()
command([[python3 vim.command('python3 vim.command("python3 vim.command(\'let set_by_nested_python3 = 555\')")')]])
eq(555, eval('g:set_by_nested_python3'))