From 8e77d70e29f936f4e708ee3244046188b8ad0383 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Sat, 12 Sep 2020 19:04:22 -0700 Subject: test/vim.validate(): assert normalized stacktrace - The previous commit lost information in the tests. Instead, add some more "normalization" substitutions in pcall_err(), so that the general shape of the stacktrace is included in the asserted text. - Eliminate contains(), it is redundant with matches() --- test/functional/api/vim_spec.lua | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'test/functional/api') diff --git a/test/functional/api/vim_spec.lua b/test/functional/api/vim_spec.lua index 72e810e3e4..246ee5c86c 100644 --- a/test/functional/api/vim_spec.lua +++ b/test/functional/api/vim_spec.lua @@ -449,19 +449,19 @@ describe('API', function() end) it('reports errors', function() - eq([[Error loading lua: [string ""]:1: '=' expected near '+']], + eq([[Error loading lua: [string ""]:0: '=' expected near '+']], pcall_err(meths.exec_lua, 'a+*b', {})) - eq([[Error loading lua: [string ""]:1: unexpected symbol near '1']], + eq([[Error loading lua: [string ""]:0: unexpected symbol near '1']], pcall_err(meths.exec_lua, '1+2', {})) - eq([[Error loading lua: [string ""]:1: unexpected symbol]], + eq([[Error loading lua: [string ""]:0: unexpected symbol]], pcall_err(meths.exec_lua, 'aa=bb\0', {})) - eq([[Error executing lua: [string ""]:1: attempt to call global 'bork' (a nil value)]], + eq([[Error executing lua: [string ""]:0: attempt to call global 'bork' (a nil value)]], pcall_err(meths.exec_lua, 'bork()', {})) - eq('Error executing lua: [string ""]:1: did\nthe\nfail', + eq('Error executing lua: [string ""]:0: did\nthe\nfail', pcall_err(meths.exec_lua, 'error("did\\nthe\\nfail")', {})) end) @@ -605,7 +605,7 @@ describe('API', function() end) it('vim.paste() failure', function() nvim('exec_lua', 'vim.paste = (function(lines, phase) error("fake fail") end)', {}) - eq([[Error executing lua: [string ""]:1: fake fail]], + eq([[Error executing lua: [string ""]:0: fake fail]], pcall_err(request, 'nvim_paste', 'line 1\nline 2\nline 3', false, 1)) end) end) -- cgit