From fc2dee17368d76e7e845872990bb6fdef1c6bf54 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Mon, 23 Aug 2021 02:37:07 -0700 Subject: [PATCH] feat(messages): cleanup Lua error messages "Error" in error messages is redundant. Just provide the context, don't say "Error ...". --- runtime/doc/news.txt | 3 + runtime/doc/vim_diff.txt | 2 +- src/nvim/api/command.c | 4 +- src/nvim/decoration_provider.c | 2 +- src/nvim/eval/funcs.c | 4 +- src/nvim/lua/executor.c | 49 +++-- src/nvim/lua/secure.c | 4 +- src/nvim/lua/treesitter.c | 4 +- src/nvim/lua/xdiff.c | 3 +- src/nvim/main.c | 2 +- src/nvim/message.c | 2 +- src/nvim/shada.c | 9 +- test/functional/api/command_spec.lua | 2 +- test/functional/api/server_requests_spec.lua | 2 +- test/functional/api/vim_spec.lua | 40 ++-- test/functional/core/startup_spec.lua | 2 +- test/functional/ex_cmds/cmd_map_spec.lua | 14 +- test/functional/ex_cmds/map_spec.lua | 8 +- .../legacy/055_list_and_dict_types_spec.lua | 2 +- .../108_backtrace_debug_commands_spec.lua | 4 +- test/functional/lua/api_spec.lua | 30 +-- test/functional/lua/commands_spec.lua | 56 +++-- test/functional/lua/luaeval_spec.lua | 18 +- test/functional/lua/overrides_spec.lua | 58 +++--- test/functional/lua/thread_spec.lua | 8 +- test/functional/lua/ui_event_spec.lua | 19 +- .../lua/{loop_spec.lua => uv_spec.lua} | 8 +- test/functional/lua/vim_spec.lua | 16 +- test/functional/options/defaults_spec.lua | 12 +- test/functional/plugin/man_spec.lua | 4 +- test/functional/provider/python3_spec.lua | 10 +- test/functional/shada/errors_spec.lua | 2 +- test/functional/terminal/tui_spec.lua | 29 ++- test/functional/ui/cmdline_highlight_spec.lua | 9 +- test/functional/ui/decorations_spec.lua | 6 +- test/functional/ui/embed_spec.lua | 6 +- test/functional/ui/messages_spec.lua | 194 ++++++++---------- test/functional/ui/multigrid_spec.lua | 2 +- test/functional/vimscript/eval_spec.lua | 10 +- test/functional/vimscript/execute_spec.lua | 12 +- test/old/testdir/test_debugger.vim | 6 +- test/testutil.lua | 2 +- 42 files changed, 302 insertions(+), 377 deletions(-) rename test/functional/lua/{loop_spec.lua => uv_spec.lua} (96%) diff --git a/runtime/doc/news.txt b/runtime/doc/news.txt index acc139c0f8..17542733fc 100644 --- a/runtime/doc/news.txt +++ b/runtime/doc/news.txt @@ -198,6 +198,9 @@ UI • |ui-multigrid| provides composition information and absolute coordinates. • `vim._extui` provides an experimental commandline and message UI intended to replace the message grid in the TUI. +• Error messages are more concise: + • "Error detected while processing:" changed to "Error in:". + • "Error executing Lua:" changed to "Lua:". VIMSCRIPT diff --git a/runtime/doc/vim_diff.txt b/runtime/doc/vim_diff.txt index 827dc0c7be..43267db497 100644 --- a/runtime/doc/vim_diff.txt +++ b/runtime/doc/vim_diff.txt @@ -560,7 +560,7 @@ Lua interface (|lua.txt|): that prints `a` and `b` on separate lines, exactly like `:lua print("a\nb")` . - `:lua error('TEST')` emits the error: > - E5108: Error executing lua: [string ""]:1: TEST + E5108: Lua: [string ""]:1: TEST < whereas Vim emits only "TEST". - Lua has direct access to Nvim |API| via `vim.api`. - Lua package.path and package.cpath are automatically updated according to diff --git a/src/nvim/api/command.c b/src/nvim/api/command.c index ce51205d50..bd54cf7d19 100644 --- a/src/nvim/api/command.c +++ b/src/nvim/api/command.c @@ -110,9 +110,9 @@ Dict(cmd) nvim_parse_cmd(String str, Dict(empty) *opts, Arena *arena, Error *err if (!parse_cmdline(cmdline, &ea, &cmdinfo, &errormsg)) { if (errormsg != NULL) { - api_set_error(err, kErrorTypeException, "Error while parsing command line: %s", errormsg); + api_set_error(err, kErrorTypeException, "Parsing command-line: %s", errormsg); } else { - api_set_error(err, kErrorTypeException, "Error while parsing command line"); + api_set_error(err, kErrorTypeException, "Parsing command-line"); } goto end; } diff --git a/src/nvim/decoration_provider.c b/src/nvim/decoration_provider.c index fe92f820b4..bb30ad0d43 100644 --- a/src/nvim/decoration_provider.c +++ b/src/nvim/decoration_provider.c @@ -34,7 +34,7 @@ static void decor_provider_error(DecorProvider *provider, const char *name, cons { const char *ns = describe_ns(provider->ns_id, "(UNKNOWN PLUGIN)"); ELOG("Error in decoration provider \"%s\" (ns=%s):\n%s", name, ns, msg); - msg_schedule_semsg_multiline("Error in decoration provider \"%s\" (ns=%s):\n%s", name, ns, msg); + msg_schedule_semsg_multiline("Decoration provider \"%s\" (ns=%s):\n%s", name, ns, msg); } // Note we pass in a provider index as this function may cause decor_providers providers to be diff --git a/src/nvim/eval/funcs.c b/src/nvim/eval/funcs.c index 83bda29a1b..c433d551cb 100644 --- a/src/nvim/eval/funcs.c +++ b/src/nvim/eval/funcs.c @@ -6357,10 +6357,10 @@ static void f_rpcrequest(typval_T *argvars, typval_T *rettv, EvalFuncData fptr) name = get_client_info(chan, "name"); } if (name) { - semsg_multiline("rpc_error", "Error invoking '%s' on channel %" PRIu64 " (%s):\n%s", + semsg_multiline("rpc_error", "Invoking '%s' on channel %" PRIu64 " (%s):\n%s", method, chan_id, name, err.msg); } else { - semsg_multiline("rpc_error", "Error invoking '%s' on channel %" PRIu64 ":\n%s", + semsg_multiline("rpc_error", "Invoking '%s' on channel %" PRIu64 ":\n%s", method, chan_id, err.msg); } diff --git a/src/nvim/lua/executor.c b/src/nvim/lua/executor.c index 6eb723ff76..617921efd6 100644 --- a/src/nvim/lua/executor.c +++ b/src/nvim/lua/executor.c @@ -192,13 +192,13 @@ static void nlua_luv_error_event(void **argv) luv_err_t type = (luv_err_t)(intptr_t)argv[1]; switch (type) { case kCallback: - semsg_multiline("lua_error", "Error executing callback:\n%s", error); + semsg_multiline("lua_error", "Lua callback:\n%s", error); break; case kThread: - semsg_multiline("lua_error", "Error in luv thread:\n%s", error); + semsg_multiline("lua_error", "Luv thread:\n%s", error); break; case kThreadCallback: - semsg_multiline("lua_error", "Error in luv callback, thread:\n%s", error); + semsg_multiline("lua_error", "Luv callback, thread:\n%s", error); break; default: break; @@ -377,7 +377,7 @@ static void nlua_schedule_event(void **argv) nlua_pushref(lstate, cb); nlua_unref_global(lstate, cb); if (nlua_pcall(lstate, 0, 0)) { - nlua_error(lstate, _("Error executing vim.schedule lua callback: %.*s")); + nlua_error(lstate, _("vim.schedule callback: %.*s")); ui_remove_cb(ns_id, true); } } @@ -1032,7 +1032,7 @@ static int nlua_print(lua_State *const lstate) nlua_print_error: ga_clear(&msg_ga); char *buff = xmalloc(IOSIZE); - const char *fmt = _("E5114: Error while converting print argument #%i: %.*s"); + const char *fmt = _("E5114: Converting print argument #%i: %.*s"); size_t len = (size_t)vim_snprintf(buff, IOSIZE, fmt, curargidx, (int)errmsg_len, errmsg); lua_pushlstring(lstate, buff, len); @@ -1126,9 +1126,9 @@ static int nlua_debug(lua_State *lstate) } if (luaL_loadbuffer(lstate, input.vval.v_string, strlen(input.vval.v_string), "=(debug command)")) { - nlua_error(lstate, _("E5115: Error while loading debug string: %.*s")); + nlua_error(lstate, _("E5115: Loading Lua debug string: %.*s")); } else if (nlua_pcall(lstate, 0, 0)) { - nlua_error(lstate, _("E5116: Error while calling debug string: %.*s")); + nlua_error(lstate, _("E5116: Calling Lua debug string: %.*s")); } tv_clear(&input); } @@ -1436,7 +1436,7 @@ void nlua_call_user_expand_func(expand_T *xp, typval_T *ret_tv) lua_pushinteger(lstate, xp->xp_col); if (nlua_pcall(lstate, 3, 1)) { - nlua_error(lstate, _("E5108: Error executing Lua function: %.*s")); + nlua_error(lstate, _("E5108: Lua function: %.*s")); return; } @@ -1456,14 +1456,14 @@ static void nlua_typval_exec(const char *lcmd, size_t lcmd_len, const char *name lua_State *const lstate = global_lstate; if (luaL_loadbuffer(lstate, lcmd, lcmd_len, name)) { - nlua_error(lstate, _("E5107: Error loading lua %.*s")); + nlua_error(lstate, _("E5107: Lua: %.*s")); return; } PUSH_ALL_TYPVALS(lstate, args, argcount, special); if (nlua_pcall(lstate, argcount, ret_tv ? 1 : 0)) { - nlua_error(lstate, _("E5108: Error executing lua %.*s")); + nlua_error(lstate, _("E5108: Lua: %.*s")); return; } @@ -1525,8 +1525,7 @@ Object nlua_exec(const String str, const Array args, LuaRetMode mode, Arena *are if (luaL_loadbuffer(lstate, str.data, str.size, "")) { size_t len; const char *errstr = lua_tolstring(lstate, -1, &len); - api_set_error(err, kErrorTypeValidation, - "Error loading lua: %.*s", (int)len, errstr); + api_set_error(err, kErrorTypeValidation, "Lua: %.*s", (int)len, errstr); return NIL; } @@ -1537,8 +1536,7 @@ Object nlua_exec(const String str, const Array args, LuaRetMode mode, Arena *are if (nlua_pcall(lstate, (int)args.size, 1)) { size_t len; const char *errstr = lua_tolstring(lstate, -1, &len); - api_set_error(err, kErrorTypeException, - "Error executing lua: %.*s", (int)len, errstr); + api_set_error(err, kErrorTypeException, "Lua: %.*s", (int)len, errstr); return NIL; } @@ -1598,10 +1596,9 @@ Object nlua_call_ref_ctx(bool fast, LuaRef ref, const char *name, Array args, Lu if (err) { size_t len; const char *errstr = lua_tolstring(lstate, -1, &len); - api_set_error(err, kErrorTypeException, - "Error executing lua: %.*s", (int)len, errstr); + api_set_error(err, kErrorTypeException, "Lua: %.*s", (int)len, errstr); } else { - nlua_error(lstate, _("Error executing lua callback: %.*s")); + nlua_error(lstate, _("Lua callback: %.*s")); } return NIL; } @@ -1721,7 +1718,7 @@ void ex_luado(exarg_T *const eap) #undef DOEND if (luaL_loadbuffer(lstate, lcmd, lcmd_len, ":luado")) { - nlua_error(lstate, _("E5109: Error loading lua: %.*s")); + nlua_error(lstate, _("E5109: Lua: %.*s")); if (lcmd_len >= IOSIZE) { xfree(lcmd); } @@ -1731,7 +1728,7 @@ void ex_luado(exarg_T *const eap) xfree(lcmd); } if (nlua_pcall(lstate, 0, 1)) { - nlua_error(lstate, _("E5110: Error executing lua: %.*s")); + nlua_error(lstate, _("E5110: Lua: %.*s")); return; } @@ -1750,7 +1747,7 @@ void ex_luado(exarg_T *const eap) lua_pushstring(lstate, old_line); lua_pushnumber(lstate, (lua_Number)l); if (nlua_pcall(lstate, 2, 1)) { - nlua_error(lstate, _("E5111: Error calling lua: %.*s")); + nlua_error(lstate, _("E5111: Lua: %.*s")); break; } @@ -1845,7 +1842,7 @@ bool nlua_exec_file(const char *path) } if (nlua_pcall(lstate, 1, 2)) { - nlua_error(lstate, _("E5111: Error calling lua: %.*s")); + nlua_error(lstate, _("E5111: Lua: %.*s")); return false; } @@ -1855,7 +1852,7 @@ bool nlua_exec_file(const char *path) if (lua_isnil(lstate, -2)) { // 1 - nlua_error(lstate, _("E5112: Error while creating lua chunk: %.*s")); + nlua_error(lstate, _("E5112: Lua chunk: %.*s")); assert(lua_isnil(lstate, -1)); lua_pop(lstate, 1); return false; @@ -1866,7 +1863,7 @@ bool nlua_exec_file(const char *path) lua_pop(lstate, 1); if (nlua_pcall(lstate, 0, 0)) { - nlua_error(lstate, _("E5113: Error while calling lua chunk: %.*s")); + nlua_error(lstate, _("E5113: Lua chunk: %.*s")); return false; } @@ -1945,7 +1942,7 @@ void nlua_expand_pat(expand_T *xp) lua_pushlstring(lstate, pat, (size_t)patlen); if (nlua_pcall(lstate, 1, 2) != 0) { - nlua_error(lstate, _("Error executing vim._expand_pat: %.*s")); + nlua_error(lstate, _("vim._expand_pat: %.*s")); return; } @@ -2093,7 +2090,7 @@ bool nlua_execute_on_key(int c, char *typed_buf) bool discard = false; // Do not use nlua_pcall here to avoid duplicate stack trace information if (lua_pcall(lstate, 2, 1, 0)) { - nlua_error(lstate, _("Error executing vim.on_key() callbacks: %.*s")); + nlua_error(lstate, _("vim.on_key() callbacks: %.*s")); } else { if (lua_isboolean(lstate, -1)) { discard = lua_toboolean(lstate, -1); @@ -2338,7 +2335,7 @@ int nlua_do_ucmd(ucmd_T *cmd, exarg_T *eap, bool preview) } if (nlua_pcall(lstate, preview ? 3 : 1, preview ? 1 : 0)) { - nlua_error(lstate, _("Error executing Lua callback: %.*s")); + nlua_error(lstate, _("Lua :command callback: %.*s")); return 0; } diff --git a/src/nvim/lua/secure.c b/src/nvim/lua/secure.c index 1560881b55..dbcaf8fd24 100644 --- a/src/nvim/lua/secure.c +++ b/src/nvim/lua/secure.c @@ -26,7 +26,7 @@ char *nlua_read_secure(const char *path) lua_getfield(lstate, -1, "read"); lua_pushstring(lstate, path); if (nlua_pcall(lstate, 1, 1)) { - nlua_error(lstate, _("Error executing vim.secure.read: %.*s")); + nlua_error(lstate, _("vim.secure.read: %.*s")); lua_settop(lstate, top); return NULL; } @@ -68,7 +68,7 @@ static bool nlua_trust(const char *action, const char *path) } if (nlua_pcall(lstate, 1, 2)) { - nlua_error(lstate, _("Error executing vim.secure.trust: %.*s")); + nlua_error(lstate, _("vim.secure.trust: %.*s")); lua_settop(lstate, top); return false; } diff --git a/src/nvim/lua/treesitter.c b/src/nvim/lua/treesitter.c index 4c39cb332f..a3d23c6f9d 100644 --- a/src/nvim/lua/treesitter.c +++ b/src/nvim/lua/treesitter.c @@ -178,7 +178,7 @@ static const TSLanguage *load_language_from_wasm(lua_State *L, const char *path, } if (werr.kind > 0) { - luaL_error(L, "Error creating wasm store: (%s) %s", wasmerr_to_str(werr.kind), werr.message); + luaL_error(L, "Failed to create WASM store: (%s) %s", wasmerr_to_str(werr.kind), werr.message); } size_t file_size = 0; @@ -706,7 +706,7 @@ static void logger_cb(void *payload, TSLogType logtype, const char *s) lua_pushstring(lstate, logtype == TSLogTypeParse ? "parse" : "lex"); lua_pushstring(lstate, s); if (lua_pcall(lstate, 2, 0, 0)) { - luaL_error(lstate, "Error executing treesitter logger callback"); + luaL_error(lstate, "treesitter logger callback failed"); } } diff --git a/src/nvim/lua/xdiff.c b/src/nvim/lua/xdiff.c index f51c1a05cd..3eccfba47c 100644 --- a/src/nvim/lua/xdiff.c +++ b/src/nvim/lua/xdiff.c @@ -341,8 +341,7 @@ int nlua_xdl_diff(lua_State *lstate) if (xdl_diff(&ma, &mb, ¶ms, &cfg, &ecb) == -1) { if (!ERROR_SET(&err)) { - api_set_error(&err, kErrorTypeException, - "Error while performing diff operation"); + api_set_error(&err, kErrorTypeException, "diff operation failed"); } } diff --git a/src/nvim/main.c b/src/nvim/main.c index 73e1abe6a6..c6644b3bb7 100644 --- a/src/nvim/main.c +++ b/src/nvim/main.c @@ -2065,7 +2065,7 @@ static void do_exrc_initialization(void) nlua_exec(cstr_as_string(str), (Array)ARRAY_DICT_INIT, kRetNilBool, NULL, &err); xfree(str); if (ERROR_SET(&err)) { - semsg("Error detected while processing %s:", VIMRC_LUA_FILE); + semsg("Error in %s:", VIMRC_LUA_FILE); semsg_multiline("emsg", err.msg); api_clear_error(&err); } diff --git a/src/nvim/message.c b/src/nvim/message.c index 641af489d5..4af23110fe 100644 --- a/src/nvim/message.c +++ b/src/nvim/message.c @@ -593,7 +593,7 @@ static char *get_emsg_source(void) sname = SOURCING_NAME; } - const char *const p = _("Error detected while processing %s:"); + const char *const p = _("Error in %s:"); const size_t buf_len = strlen(sname) + strlen(p) + 1; char *const buf = xmalloc(buf_len); snprintf(buf, buf_len, p, sname); diff --git a/src/nvim/shada.c b/src/nvim/shada.c index b70ee62674..cf7cd1fb26 100644 --- a/src/nvim/shada.c +++ b/src/nvim/shada.c @@ -550,19 +550,16 @@ static ShaDaReadResult sd_reader_skip(FileDescriptor *const sd_reader, const siz { const ptrdiff_t skip_bytes = file_skip(sd_reader, offset); if (skip_bytes < 0) { - semsg(_(SERR "System error while skipping in ShaDa file: %s"), - os_strerror((int)skip_bytes)); + semsg(_(SERR "System error while skipping in ShaDa file: %s"), os_strerror((int)skip_bytes)); return kSDReadStatusReadError; } else if (skip_bytes != (ptrdiff_t)offset) { assert(skip_bytes < (ptrdiff_t)offset); if (file_eof(sd_reader)) { - semsg(_(RCERR "Error while reading ShaDa file: " - "last entry specified that it occupies %" PRIu64 " bytes, " + semsg(_(RCERR "Reading ShaDa file: last entry specified that it occupies %" PRIu64 " bytes, " "but file ended earlier"), (uint64_t)offset); } else { - semsg(_(SERR "System error while skipping in ShaDa file: %s"), - _("too few bytes read")); + semsg(_(SERR "System error while skipping in ShaDa file: %s"), _("too few bytes read")); } return kSDReadStatusNotShaDa; } diff --git a/test/functional/api/command_spec.lua b/test/functional/api/command_spec.lua index d332576fb4..49b26ab521 100644 --- a/test/functional/api/command_spec.lua +++ b/test/functional/api/command_spec.lua @@ -689,7 +689,7 @@ describe('nvim_create_user_command', function() }) ]]) feed(':Test ') - eq('E5108: Error executing Lua function: [NULL]', api.nvim_get_vvar('errmsg')) + eq('E5108: Lua function: [NULL]', api.nvim_get_vvar('errmsg')) eq('Test ', fn.getcmdline()) assert_alive() end) diff --git a/test/functional/api/server_requests_spec.lua b/test/functional/api/server_requests_spec.lua index c022ba28de..d660ed8049 100644 --- a/test/functional/api/server_requests_spec.lua +++ b/test/functional/api/server_requests_spec.lua @@ -222,7 +222,7 @@ describe('server -> client', function() it('returns an error if the request failed', function() eq( - "Vim:Error invoking 'does-not-exist' on channel 3:\nInvalid method: does-not-exist", + "Vim:Invoking 'does-not-exist' on channel 3:\nInvalid method: does-not-exist", pcall_err(eval, "rpcrequest(vim, 'does-not-exist')") ) end) diff --git a/test/functional/api/vim_spec.lua b/test/functional/api/vim_spec.lua index 1a5368eb54..3e18fb357b 100644 --- a/test/functional/api/vim_spec.lua +++ b/test/functional/api/vim_spec.lua @@ -768,26 +768,13 @@ describe('API', function() end) it('reports errors', function() - eq( - [[Error loading lua: [string ""]:0: '=' expected near '+']], - pcall_err(api.nvim_exec_lua, 'a+*b', {}) - ) - - eq( - [[Error loading lua: [string ""]:0: unexpected symbol near '1']], - pcall_err(api.nvim_exec_lua, '1+2', {}) - ) - - eq( - [[Error loading lua: [string ""]:0: unexpected symbol]], - pcall_err(api.nvim_exec_lua, 'aa=bb\0', {}) - ) - + eq([['=' expected near '+']], pcall_err(api.nvim_exec_lua, 'a+*b', {})) + eq([[unexpected symbol near '1']], pcall_err(api.nvim_exec_lua, '1+2', {})) + eq([[unexpected symbol]], pcall_err(api.nvim_exec_lua, 'aa=bb\0', {})) eq( [[attempt to call global 'bork' (a nil value)]], pcall_err(api.nvim_exec_lua, 'bork()', {}) ) - eq('did\nthe\nfail', pcall_err(api.nvim_exec_lua, 'error("did\\nthe\\nfail")', {})) end) @@ -2716,7 +2703,7 @@ describe('API', function() eq({ [1] = testinfo, [2] = stderr, [3] = info }, api.nvim_list_chans()) eq( - "Vim:Error invoking 'nvim_set_current_buf' on channel 3 (amazing-cat):\nWrong type for argument 1 when calling nvim_set_current_buf, expecting Buffer", + "Vim:Invoking 'nvim_set_current_buf' on channel 3 (amazing-cat):\nWrong type for argument 1 when calling nvim_set_current_buf, expecting Buffer", pcall_err(eval, 'rpcrequest(3, "nvim_set_current_buf", -1)') ) eq(info, eval('rpcrequest(3, "nvim_get_chan_info", 0)')) @@ -4690,24 +4677,21 @@ describe('API', function() }, api.nvim_parse_cmd('MyCommand test it', {})) end) it('validates command', function() - eq('Error while parsing command line', pcall_err(api.nvim_parse_cmd, '', {})) - eq('Error while parsing command line', pcall_err(api.nvim_parse_cmd, '" foo', {})) + eq('Parsing command-line', pcall_err(api.nvim_parse_cmd, '', {})) + eq('Parsing command-line', pcall_err(api.nvim_parse_cmd, '" foo', {})) eq( - 'Error while parsing command line: E492: Not an editor command: Fubar', + 'Parsing command-line: E492: Not an editor command: Fubar', pcall_err(api.nvim_parse_cmd, 'Fubar', {}) ) command('command! Fubar echo foo') + eq('Parsing command-line: E477: No ! allowed', pcall_err(api.nvim_parse_cmd, 'Fubar!', {})) eq( - 'Error while parsing command line: E477: No ! allowed', - pcall_err(api.nvim_parse_cmd, 'Fubar!', {}) - ) - eq( - 'Error while parsing command line: E481: No range allowed', + 'Parsing command-line: E481: No range allowed', pcall_err(api.nvim_parse_cmd, '4,6Fubar', {}) ) command('command! Foobar echo foo') eq( - 'Error while parsing command line: E464: Ambiguous use of user-defined command', + 'Parsing command-line: E464: Ambiguous use of user-defined command', pcall_err(api.nvim_parse_cmd, 'F', {}) ) end) @@ -4725,7 +4709,7 @@ describe('API', function() Entering Ex mode. Type "visual" to go to Normal mode. | :1^ | ]]) - eq('Error while parsing command line', pcall_err(api.nvim_parse_cmd, '', {})) + eq('Parsing command-line', pcall_err(api.nvim_parse_cmd, '', {})) feed('') screen:expect([[ foo | @@ -4794,7 +4778,7 @@ describe('API', function() end) it('no side-effects (error messages) in pcall() #20339', function() eq( - { false, 'Error while parsing command line: E16: Invalid range' }, + { false, 'Parsing command-line: E16: Invalid range' }, exec_lua([=[return {pcall(vim.api.nvim_parse_cmd, "'<,'>n", {})}]=]) ) eq('', eval('v:errmsg')) diff --git a/test/functional/core/startup_spec.lua b/test/functional/core/startup_spec.lua index 8ecd3dca97..0564b06ac6 100644 --- a/test/functional/core/startup_spec.lua +++ b/test/functional/core/startup_spec.lua @@ -651,7 +651,7 @@ describe('startup', function() screen:expect([[ ^ | | - Error detected while processing pre-vimrc command line: | + Error in pre-vimrc command line: | E121: Undefined variable: g:bar | Press ENTER or type command to continue | | diff --git a/test/functional/ex_cmds/cmd_map_spec.lua b/test/functional/ex_cmds/cmd_map_spec.lua index d63182109d..78aa12369f 100644 --- a/test/functional/ex_cmds/cmd_map_spec.lua +++ b/test/functional/ex_cmds/cmd_map_spec.lua @@ -344,7 +344,7 @@ describe('mappings with ', function() of test text | {1:~ }|*2 {7: }| - {2:Error detected while processing :} | + {2:Error in :} | {2:E605: Exception not caught: very error} | {3:Press ENTER or type command to continue}^ | ]]) @@ -410,7 +410,7 @@ describe('mappings with ', function() of test text | {1:~ }|*2 {7: }| - {2:Error detected while processing :} | + {2:Error in :} | {2:E605: Exception not caught: very error} | {3:Press ENTER or type command to continue}^ | ]]) @@ -433,7 +433,7 @@ describe('mappings with ', function() of test text | {1:~ }|*2 {7: }| - {2:Error detected while processing :} | + {2:Error in :} | {2:E605: Exception not caught: very error} | {3:Press ENTER or type command to continue}^ | ]]) @@ -493,7 +493,7 @@ describe('mappings with ', function() of test text | {1:~ }|*2 {7: }| - {2:Error detected while processing :} | + {2:Error in :} | {2:E605: Exception not caught: very error} | {3:Press ENTER or type command to continue}^ | ]]) @@ -531,7 +531,7 @@ describe('mappings with ', function() of test text | {1:~ }|*2 {7: }| - {2:Error detected while processing :} | + {2:Error in :} | {2:E605: Exception not caught: very error} | {3:Press ENTER or type command to continue}^ | ]]) @@ -640,7 +640,7 @@ describe('mappings with ', function() {1:~ }| {7: }| :echo 2 | - {2:Error detected while processing :} | + {2:Error in :} | {2:E605: Exception not caught: very error} | :echo 2^ | ]]) @@ -653,7 +653,7 @@ describe('mappings with ', function() of test text | {7: }| :echo 2 | - {2:Error detected while processing :} | + {2:Error in :} | {2:E605: Exception not caught: very error} | 4 | {3:Press ENTER or type command to continue}^ | diff --git a/test/functional/ex_cmds/map_spec.lua b/test/functional/ex_cmds/map_spec.lua index 954dae9335..e827b9534b 100644 --- a/test/functional/ex_cmds/map_spec.lua +++ b/test/functional/ex_cmds/map_spec.lua @@ -193,7 +193,7 @@ describe('Screen', function() screen:expect([[ | {3: }| - {9:Error detected while processing :} | + {9:Error in :} | {9:E605: Exception not caught: 42} | {6:Press ENTER or type command to continue}^ | ]]) @@ -218,7 +218,7 @@ describe('Screen', function() screen:expect([[ {3: }| :echo "foo | - {9:Error detected while processing :} | + {9:Error in :} | {9:E605: Exception not caught: 42} | :echo "foo^ | ]]) @@ -226,14 +226,14 @@ describe('Screen', function() screen:expect([[ {3: }| :echo "foo | - {9:Error detected while processing :} | + {9:Error in :} | {9:E605: Exception not caught: 42} | :echo "foo"^ | ]]) feed('\n') screen:expect([[ :echo "foo | - {9:Error detected while processing :} | + {9:Error in :} | {9:E605: Exception not caught: 42} | foo | {6:Press ENTER or type command to continue}^ | diff --git a/test/functional/legacy/055_list_and_dict_types_spec.lua b/test/functional/legacy/055_list_and_dict_types_spec.lua index 21d6b07a2d..737417126b 100644 --- a/test/functional/legacy/055_list_and_dict_types_spec.lua +++ b/test/functional/legacy/055_list_and_dict_types_spec.lua @@ -687,7 +687,7 @@ describe('list and dictionary types', function() Vim(foldopen):E490: - Error detected while processing : + Error in : E492: Not an editor command: foobar|catch|let a = matchstr(v:exception,'^[^ ]*')|endtry ]]) end) diff --git a/test/functional/legacy/108_backtrace_debug_commands_spec.lua b/test/functional/legacy/108_backtrace_debug_commands_spec.lua index d2ae785813..aac25cca23 100644 --- a/test/functional/legacy/108_backtrace_debug_commands_spec.lua +++ b/test/functional/legacy/108_backtrace_debug_commands_spec.lua @@ -119,14 +119,14 @@ describe('108', function() - undefined vars: undefined var3 on former level: - Error detected while processing function Foo[2]..Bar[2]..Bazz: + Error in function Foo[2]..Bar[2]..Bazz: line 3: E121: Undefined variable: var3 here var3 is defined with "another var": another var undefined var2 on former level - Error detected while processing function Foo[2]..Bar: + Error in function Foo[2]..Bar: line 3: E121: Undefined variable: var2 here var2 is defined with 10: diff --git a/test/functional/lua/api_spec.lua b/test/functional/lua/api_spec.lua index 741ed0cf6e..1712fa2a5d 100644 --- a/test/functional/lua/api_spec.lua +++ b/test/functional/lua/api_spec.lua @@ -303,76 +303,76 @@ describe('luaeval(vim.api.…)', function() it('errors out correctly when working with API', function() -- Conversion errors eq( - [[Vim(call):E5108: Error executing lua [string "luaeval()"]:1: Invalid 'obj': Cannot convert given Lua table]], + [[Vim(call):E5108: Lua: [string "luaeval()"]:1: Invalid 'obj': Cannot convert given Lua table]], remove_trace(exc_exec([[call luaeval("vim.api.nvim__id({1, foo=42})")]])) ) -- Errors in number of arguments eq( - 'Vim(call):E5108: Error executing lua [string "luaeval()"]:1: Expected 1 argument', + 'Vim(call):E5108: Lua: [string "luaeval()"]:1: Expected 1 argument', remove_trace(exc_exec([[call luaeval("vim.api.nvim__id()")]])) ) eq( - 'Vim(call):E5108: Error executing lua [string "luaeval()"]:1: Expected 1 argument', + 'Vim(call):E5108: Lua: [string "luaeval()"]:1: Expected 1 argument', remove_trace(exc_exec([[call luaeval("vim.api.nvim__id(1, 2)")]])) ) eq( - 'Vim(call):E5108: Error executing lua [string "luaeval()"]:1: Expected 2 arguments', + 'Vim(call):E5108: Lua: [string "luaeval()"]:1: Expected 2 arguments', remove_trace(exc_exec([[call luaeval("vim.api.nvim_set_var(1, 2, 3)")]])) ) -- Error in argument types eq( - [[Vim(call):E5108: Error executing lua [string "luaeval()"]:1: Invalid 'name': Expected Lua string]], + [[Vim(call):E5108: Lua: [string "luaeval()"]:1: Invalid 'name': Expected Lua string]], remove_trace(exc_exec([[call luaeval("vim.api.nvim_set_var(1, 2)")]])) ) eq( - [[Vim(call):E5108: Error executing lua [string "luaeval()"]:1: Invalid 'start': Expected Lua number]], + [[Vim(call):E5108: Lua: [string "luaeval()"]:1: Invalid 'start': Expected Lua number]], remove_trace(exc_exec([[call luaeval("vim.api.nvim_buf_get_lines(0, 'test', 1, false)")]])) ) eq( - [[Vim(call):E5108: Error executing lua [string "luaeval()"]:1: Invalid 'start': Number is not integral]], + [[Vim(call):E5108: Lua: [string "luaeval()"]:1: Invalid 'start': Number is not integral]], remove_trace(exc_exec([[call luaeval("vim.api.nvim_buf_get_lines(0, 1.5, 1, false)")]])) ) eq( - [[Vim(call):E5108: Error executing lua [string "luaeval()"]:1: Invalid 'window': Expected Lua number]], + [[Vim(call):E5108: Lua: [string "luaeval()"]:1: Invalid 'window': Expected Lua number]], remove_trace(exc_exec([[call luaeval("vim.api.nvim_win_is_valid(nil)")]])) ) eq( - [[Vim(call):E5108: Error executing lua [string "luaeval()"]:1: Invalid 'flt': Expected Lua number]], + [[Vim(call):E5108: Lua: [string "luaeval()"]:1: Invalid 'flt': Expected Lua number]], remove_trace(exc_exec([[call luaeval("vim.api.nvim__id_float('test')")]])) ) eq( - [[Vim(call):E5108: Error executing lua [string "luaeval()"]:1: Invalid 'flt': Expected Float-like Lua table]], + [[Vim(call):E5108: Lua: [string "luaeval()"]:1: Invalid 'flt': Expected Float-like Lua table]], remove_trace( exc_exec([[call luaeval("vim.api.nvim__id_float({[vim.type_idx]=vim.types.dictionary})")]]) ) ) eq( - [[Vim(call):E5108: Error executing lua [string "luaeval()"]:1: Invalid 'arr': Expected Lua table]], + [[Vim(call):E5108: Lua: [string "luaeval()"]:1: Invalid 'arr': Expected Lua table]], remove_trace(exc_exec([[call luaeval("vim.api.nvim__id_array(1)")]])) ) eq( - [[Vim(call):E5108: Error executing lua [string "luaeval()"]:1: Invalid 'arr': Expected Array-like Lua table]], + [[Vim(call):E5108: Lua: [string "luaeval()"]:1: Invalid 'arr': Expected Array-like Lua table]], remove_trace( exc_exec([[call luaeval("vim.api.nvim__id_array({[vim.type_idx]=vim.types.dictionary})")]]) ) ) eq( - [[Vim(call):E5108: Error executing lua [string "luaeval()"]:1: Invalid 'dct': Expected Lua table]], + [[Vim(call):E5108: Lua: [string "luaeval()"]:1: Invalid 'dct': Expected Lua table]], remove_trace(exc_exec([[call luaeval("vim.api.nvim__id_dict(1)")]])) ) eq( - [[Vim(call):E5108: Error executing lua [string "luaeval()"]:1: Invalid 'dct': Expected Dict-like Lua table]], + [[Vim(call):E5108: Lua: [string "luaeval()"]:1: Invalid 'dct': Expected Dict-like Lua table]], remove_trace( exc_exec([[call luaeval("vim.api.nvim__id_dict({[vim.type_idx]=vim.types.array})")]]) ) ) eq( - [[Vim(call):E5108: Error executing lua [string "luaeval()"]:1: Expected Lua table]], + [[Vim(call):E5108: Lua: [string "luaeval()"]:1: Expected Lua table]], remove_trace(exc_exec([[call luaeval("vim.api.nvim_set_keymap('', '', '', '')")]])) ) diff --git a/test/functional/lua/commands_spec.lua b/test/functional/lua/commands_spec.lua index cb3b436f9e..561830240a 100644 --- a/test/functional/lua/commands_spec.lua +++ b/test/functional/lua/commands_spec.lua @@ -59,22 +59,22 @@ describe(':lua', function() it('throws catchable errors', function() eq('Vim(lua):E471: Argument required', pcall_err(command, 'lua')) eq( - [[Vim(lua):E5107: Error loading lua [string ":lua"]:0: unexpected symbol near ')']], + [[Vim(lua):E5107: Lua: [string ":lua"]:0: unexpected symbol near ')']], pcall_err(command, 'lua ()') ) eq( - [[Vim(lua):E5108: Error executing lua [string ":lua"]:1: TEST]], + [[Vim(lua):E5108: Lua: [string ":lua"]:1: TEST]], remove_trace(exc_exec('lua error("TEST")')) ) eq( - [[Vim(lua):E5108: Error executing lua [string ":lua"]:1: Invalid buffer id: -10]], + [[Vim(lua):E5108: Lua: [string ":lua"]:1: Invalid buffer id: -10]], remove_trace(exc_exec('lua vim.api.nvim_buf_set_lines(-10, 1, 1, false, {"TEST"})')) ) eq({ '' }, api.nvim_buf_get_lines(0, 0, 100, false)) end) it('works with NULL errors', function() - eq([=[Vim(lua):E5108: Error executing lua [NULL]]=], exc_exec('lua error(nil)')) + eq([=[Vim(lua):E5108: Lua: [NULL]]=], exc_exec('lua error(nil)')) end) it('accepts embedded NLs without heredoc', function() @@ -100,7 +100,7 @@ describe(':lua', function() local s = ('x'):rep(100500) eq( - 'Vim(lua):E5107: Error loading lua [string ":lua"]:0: unfinished string near \'\'', + 'Vim(lua):E5107: Lua: [string ":lua"]:0: unfinished string near \'\'', pcall_err(command, ('lua vim.api.nvim_buf_set_lines(1, 1, 2, false, {"%s})'):format(s)) ) eq({ '' }, api.nvim_buf_get_lines(0, 0, -1, false)) @@ -119,11 +119,10 @@ describe(':lua', function() }) feed(':lua error("fail\\nmuch error\\nsuch details")') - screen:expect { - grid = [[ + screen:expect([[ + | {2: }| - {3:E5108: Error executing lua [string ":lua}| - {3:"]:1: fail} | + {3:E5108: Lua: [string ":lua"]:1: fail} | {3:much error} | {3:such details} | {3:stack traceback:} | @@ -131,8 +130,7 @@ describe(':lua', function() {3: [string ":lua"]:1: in main chunk}| | {4:Press ENTER or type command to continue}^ | - ]], - } + ]]) feed('') screen:expect { grid = [[ @@ -142,22 +140,20 @@ describe(':lua', function() ]], } eq( - 'E5108: Error executing lua [string ":lua"]:1: fail\nmuch error\nsuch details', + 'E5108: Lua: [string ":lua"]:1: fail\nmuch error\nsuch details', remove_trace(eval('v:errmsg')) ) local status, err = pcall(command, 'lua error("some error\\nin a\\nAPI command")') - local expected = - 'Vim(lua):E5108: Error executing lua [string ":lua"]:1: some error\nin a\nAPI command' + local expected = 'Vim(lua):E5108: Lua: [string ":lua"]:1: some error\nin a\nAPI command' eq(false, status) eq(expected, string.sub(remove_trace(err), -string.len(expected))) feed(':messages') - screen:expect { - grid = [[ + screen:expect([[ + | {2: }| - {3:E5108: Error executing lua [string ":lua}| - {3:"]:1: fail} | + {3:E5108: Lua: [string ":lua"]:1: fail} | {3:much error} | {3:such details} | {3:stack traceback:} | @@ -165,8 +161,7 @@ describe(':lua', function() {3: [string ":lua"]:1: in main chunk}| | {4:Press ENTER or type command to continue}^ | - ]], - } + ]]) end) it('prints result of =expr', function() @@ -212,7 +207,7 @@ describe(':lua', function() -- ":{range}lua" fails on invalid Lua code. eq( - [[:{range}lua buffer=1: Vim(lua):E5107: Error loading lua ]] + [[:{range}lua buffer=1: Vim(lua):E5107: Lua: ]] .. [[[string ":{range}lua buffer=1"]:0: '=' expected near '']], pcall_err(command, '1lua') ) @@ -279,17 +274,17 @@ describe(':luado command', function() it('fails on errors', function() eq( - [[Vim(luado):E5109: Error loading lua: [string ":luado"]:0: unexpected symbol near ')']], + [[Vim(luado):E5109: Lua: [string ":luado"]:0: unexpected symbol near ')']], pcall_err(command, 'luado ()') ) eq( - [[Vim(luado):E5111: Error calling lua: [string ":luado"]:0: attempt to perform arithmetic on global 'liness' (a nil value)]], + [[Vim(luado):E5111: Lua: [string ":luado"]:0: attempt to perform arithmetic on global 'liness' (a nil value)]], pcall_err(command, 'luado return liness + 1') ) end) it('works with NULL errors', function() - eq([=[Vim(luado):E5111: Error calling lua: [NULL]]=], exc_exec('luado error(nil)')) + eq([=[Vim(luado):E5111: Lua: [NULL]]=], exc_exec('luado error(nil)')) end) it('fails in sandbox when needed', function() @@ -305,7 +300,7 @@ describe(':luado command', function() local s = ('x'):rep(100500) eq( - 'Vim(luado):E5109: Error loading lua: [string ":luado"]:0: unfinished string near \'\'', + 'Vim(luado):E5109: Lua: [string ":luado"]:0: unfinished string near \'\'', pcall_err(command, ('luado return "%s'):format(s)) ) eq({ '' }, api.nvim_buf_get_lines(0, 0, -1, false)) @@ -338,14 +333,12 @@ describe(':luafile', function() it('correctly errors out', function() write_file(fname, '()') eq( - ("Vim(luafile):E5112: Error while creating lua chunk: %s:1: unexpected symbol near ')'"):format( - fname - ), + ("Vim(luafile):E5112: Lua chunk: %s:1: unexpected symbol near ')'"):format(fname), exc_exec('luafile ' .. fname) ) write_file(fname, 'vimm.api.nvim_buf_set_lines(1, 1, 2, false, {"ETTS"})') eq( - ("Vim(luafile):E5113: Error while calling lua chunk: %s:1: attempt to index global 'vimm' (a nil value)"):format( + ("Vim(luafile):E5113: Lua chunk: %s:1: attempt to index global 'vimm' (a nil value)"):format( fname ), remove_trace(exc_exec('luafile ' .. fname)) @@ -354,9 +347,6 @@ describe(':luafile', function() it('works with NULL errors', function() write_file(fname, 'error(nil)') - eq( - [=[Vim(luafile):E5113: Error while calling lua chunk: [NULL]]=], - exc_exec('luafile ' .. fname) - ) + eq([=[Vim(luafile):E5113: Lua chunk: [NULL]]=], exc_exec('luafile ' .. fname)) end) end) diff --git a/test/functional/lua/luaeval_spec.lua b/test/functional/lua/luaeval_spec.lua index 5fea79141c..495525b1e9 100644 --- a/test/functional/lua/luaeval_spec.lua +++ b/test/functional/lua/luaeval_spec.lua @@ -189,9 +189,9 @@ describe('luaeval()', function() eq("Vim(call):E5100: Cannot convert given Lua table: table should contain either only integer keys or only string keys", exc_exec('call luaeval("{1, foo=2}")')) - startswith("Vim(call):E5107: Error loading lua [string \"luaeval()\"]:", + startswith("Vim(call):E5107: Lua: [string \"luaeval()\"]:", exc_exec('call luaeval("1, 2, 3")')) - startswith("Vim(call):E5108: Error executing lua [string \"luaeval()\"]:", + startswith("Vim(call):E5108: Lua: [string \"luaeval()\"]:", exc_exec('call luaeval("(nil)()")')) end) @@ -428,18 +428,18 @@ describe('luaeval()', function() it('errors out correctly when doing incorrect things in lua', function() -- Conversion errors - eq('Vim(call):E5108: Error executing lua [string "luaeval()"]:1: attempt to call field \'xxx_nonexistent_key_xxx\' (a nil value)', + eq('Vim(call):E5108: Lua: [string "luaeval()"]:1: attempt to call field \'xxx_nonexistent_key_xxx\' (a nil value)', remove_trace(exc_exec([[call luaeval("vim.xxx_nonexistent_key_xxx()")]]))) - eq('Vim(call):E5108: Error executing lua [string "luaeval()"]:1: ERROR', + eq('Vim(call):E5108: Lua: [string "luaeval()"]:1: ERROR', remove_trace(exc_exec([[call luaeval("error('ERROR')")]]))) - eq('Vim(call):E5108: Error executing lua [NULL]', + eq('Vim(call):E5108: Lua: [NULL]', remove_trace(exc_exec([[call luaeval("error(nil)")]]))) end) it('does not leak memory when called with too long line', function() local s = ('x'):rep(65536) - eq('Vim(call):E5107: Error loading lua [string "luaeval()"]:1: unexpected symbol near \')\'', + eq('Vim(call):E5107: Lua: [string "luaeval()"]:1: unexpected symbol near \')\'', exc_exec([[call luaeval("(']] .. s ..[[' + )")]])) eq(s, fn.luaeval('"' .. s .. '"')) end) @@ -482,7 +482,7 @@ describe('v:lua', function() eq("string: abc", eval('v:lua.mymod.whatis(0z616263)')) eq("string: ", eval('v:lua.mymod.whatis(v:_null_blob)')) - eq("Vim:E5108: Error executing lua [string \"\"]:0: attempt to call global 'nonexistent' (a nil value)", + eq("Vim:E5108: Lua: [string \"\"]:0: attempt to call global 'nonexistent' (a nil value)", pcall_err(eval, 'v:lua.mymod.crashy()')) end) @@ -497,14 +497,14 @@ describe('v:lua', function() eq("hey there", api.nvim_get_current_line()) eq({5, 10, 15, 20}, eval('[[1], [2, 3], [4]]->v:lua.vim.tbl_flatten()->map({_, v -> v * 5})')) - eq("Vim:E5108: Error executing lua [string \"\"]:0: attempt to call global 'nonexistent' (a nil value)", + eq("Vim:E5108: Lua: [string \"\"]:0: attempt to call global 'nonexistent' (a nil value)", pcall_err(eval, '"huh?"->v:lua.mymod.crashy()')) end) it('works in :call', function() command(":call v:lua.mymod.noisy('command')") eq("hey command", api.nvim_get_current_line()) - eq("Vim(call):E5108: Error executing lua [string \"\"]:0: attempt to call global 'nonexistent' (a nil value)", + eq("Vim(call):E5108: Lua: [string \"\"]:0: attempt to call global 'nonexistent' (a nil value)", pcall_err(command, 'call v:lua.mymod.crashy()')) end) diff --git a/test/functional/lua/overrides_spec.lua b/test/functional/lua/overrides_spec.lua index 2f332d2c10..e0d0bd908e 100644 --- a/test/functional/lua/overrides_spec.lua +++ b/test/functional/lua/overrides_spec.lua @@ -57,15 +57,15 @@ describe('print', function() eq('', exec_capture('luafile ' .. fname)) -- TODO(bfredl): these look weird, print() should not use "E5114:" style errors.. eq( - 'Vim(lua):E5108: Error executing lua E5114: Error while converting print argument #2: [NULL]', + 'Vim(lua):E5108: Lua: E5114: Converting print argument #2: [NULL]', pcall_err(command, 'lua print("foo", v_nilerr, "bar")') ) eq( - 'Vim(lua):E5108: Error executing lua E5114: Error while converting print argument #2: Xtest-functional-lua-overrides-luafile:2: abc', + 'Vim(lua):E5108: Lua: E5114: Converting print argument #2: Xtest-functional-lua-overrides-luafile:2: abc', pcall_err(command, 'lua print("foo", v_abcerr, "bar")') ) eq( - 'Vim(lua):E5108: Error executing lua E5114: Error while converting print argument #2: ', + 'Vim(lua):E5108: Lua: E5114: Converting print argument #2: ', pcall_err(command, 'lua print("foo", v_tblout, "bar")') ) end) @@ -98,20 +98,20 @@ describe('print', function() ) eq('', exec_capture('luafile ' .. fname)) eq( - 'Vim(lua):E5108: Error executing lua Xtest-functional-lua-overrides-luafile:1: my mistake', + 'Vim(lua):E5108: Lua: Xtest-functional-lua-overrides-luafile:1: my mistake', pcall_err(command, 'lua string_error()') ) eq( - 'Vim(lua):E5108: Error executing lua Xtest-functional-lua-overrides-luafile:2: 1234', + 'Vim(lua):E5108: Lua: Xtest-functional-lua-overrides-luafile:2: 1234', pcall_err(command, 'lua number_error()') ) - eq('Vim(lua):E5108: Error executing lua [NULL]', pcall_err(command, 'lua nil_error()')) - eq('Vim(lua):E5108: Error executing lua [NULL]', pcall_err(command, 'lua table_error()')) + eq('Vim(lua):E5108: Lua: [NULL]', pcall_err(command, 'lua nil_error()')) + eq('Vim(lua):E5108: Lua: [NULL]', pcall_err(command, 'lua table_error()')) eq( - 'Vim(lua):E5108: Error executing lua Internal Error [11234] my mistake', + 'Vim(lua):E5108: Lua: Internal Error [11234] my mistake', pcall_err(command, 'lua custom_error()') ) - eq('Vim(lua):E5108: Error executing lua [NULL]', pcall_err(command, 'lua bad_custom_error()')) + eq('Vim(lua):E5108: Lua: [NULL]', pcall_err(command, 'lua bad_custom_error()')) end) it('prints strings with NULs and NLs correctly', function() api.nvim_set_option_value('more', true, {}) @@ -232,8 +232,7 @@ describe('debug.debug', function() lua_debug> ^ | ]]) feed('') - screen:expect { - grid = [[ + screen:expect([[ | {0:~ }|*2 {1: }| @@ -241,14 +240,13 @@ describe('debug.debug', function() lua_debug> print("TEST") | TEST | | - {E:E5108: Error executing lua [string ":lua"]:5: attempt}| - {E: to perform arithmetic on local 'a' (a nil value)} | + {E:E5108: Lua: [string ":lua"]:5: attempt to perform ari}| + {E:thmetic on local 'a' (a nil value)} | {E:stack traceback:} | {E: [string ":lua"]:5: in function 'Test'} | {E: [string ":lua"]:1: in main chunk} | Interrupt: {cr:Press ENTER or type command to continue}^ | - ]], - } + ]]) feed(':lua Test()\n') screen:expect([[ | @@ -258,21 +256,19 @@ describe('debug.debug', function() lua_debug> ^ | ]]) feed('\n') - screen:expect { - grid = [[ + screen:expect([[ | {0:~ }|*4 {1: }| nil | lua_debug> | - {E:E5108: Error executing lua [string ":lua"]:5: attempt}| - {E: to perform arithmetic on local 'a' (a nil value)} | + {E:E5108: Lua: [string ":lua"]:5: attempt to perform ari}| + {E:thmetic on local 'a' (a nil value)} | {E:stack traceback:} | {E: [string ":lua"]:5: in function 'Test'} | {E: [string ":lua"]:1: in main chunk} | {cr:Press ENTER or type command to continue}^ | - ]], - } + ]]) end) it("can be safely exited with 'cont'", function() @@ -287,32 +283,28 @@ describe('debug.debug', function() } feed('conttt') -- misspelled cont; invalid syntax - screen:expect { - grid = [[ + screen:expect([[ | {0:~ }|*8 {1: }| lua_debug> conttt | - {E:E5115: Error while loading debug string: (debug comma}| - {E:nd):1: '=' expected near ''} | + {E:E5115: Loading Lua debug string: (debug command):1: '}| + {E:=' expected near ''} | lua_debug> ^ | - ]], - } + ]]) feed('cont') -- exactly "cont", exit now - screen:expect { - grid = [[ + screen:expect([[ | {0:~ }|*6 {1: }| lua_debug> conttt | - {E:E5115: Error while loading debug string: (debug comma}| - {E:nd):1: '=' expected near ''} | + {E:E5115: Loading Lua debug string: (debug command):1: '}| + {E:=' expected near ''} | lua_debug> cont | x | {cr:Press ENTER or type command to continue}^ | - ]], - } + ]]) feed('') screen:expect { diff --git a/test/functional/lua/thread_spec.lua b/test/functional/lua/thread_spec.lua index 7610886b47..e4ff2b8068 100644 --- a/test/functional/lua/thread_spec.lua +++ b/test/functional/lua/thread_spec.lua @@ -31,7 +31,7 @@ describe('thread', function() | {1:~ }|*5 {3: }| - {9:Error in luv thread:} | + {9:Luv thread:} | {9:[NULL]} | {6:Press ENTER or type command to continue}^ | ]]) @@ -51,7 +51,7 @@ describe('thread', function() | {1:~ }|*5 {3: }| - {9:Error in luv thread:} | + {9:Luv thread:} | {9:[string ""]:2: Error in thread entry func} | {6:Press ENTER or type command to continue}^ | ]]) @@ -78,7 +78,7 @@ describe('thread', function() | {1:~ }|*5 {3: }| - {9:Error in luv callback, thread:} | + {9:Luv callback, thread:} | {9:[string ""]:6: Error in thread callback} | {6:Press ENTER or type command to continue}^ | ]]) @@ -286,7 +286,7 @@ describe('threadpool', function() | {1:~ }|*5 {3: }| - {9:Error in luv thread:} | + {9:Luv thread:} | {9:Error: thread arg not support type 'table' at 1} | {6:Press ENTER or type command to continue}^ | ]]) diff --git a/test/functional/lua/ui_event_spec.lua b/test/functional/lua/ui_event_spec.lua index a47f37c6d9..86cf705e19 100644 --- a/test/functional/lua/ui_event_spec.lua +++ b/test/functional/lua/ui_event_spec.lua @@ -427,14 +427,17 @@ describe('vim.ui_attach', function() os.remove(testlog) end) - it('error in callback is logged', function() + it('callback error is logged', function() exec_lua([[ local ns = vim.api.nvim_create_namespace('test') vim.ui_attach(ns, { ext_popupmenu = true }, function() error(42) end) ]]) feed('ifoofoobarfo') - assert_log('Error in "popupmenu_show" UI event handler %(ns=test%):', testlog, 100) - assert_log('Error executing lua: .*: 42', testlog, 100) + assert_log( + 'Error in "popupmenu_show" UI event handler %(ns=test%):[\r\n\t ]+Lua: .*: 42', + testlog, + 100 + ) end) it('detaches after excessive errors', function() @@ -464,7 +467,7 @@ describe('vim.ui_attach', function() { content = { { - 'Error executing callback:\n[string ""]:3: attempt to index global \'err\' (a nil value)\nstack traceback:\n\t[string ""]:3: in function <[string ""]:1>', + 'Lua callback:\n[string ""]:3: attempt to index global \'err\' (a nil value)\nstack traceback:\n\t[string ""]:3: in function <[string ""]:1>', 9, 6, }, @@ -482,11 +485,11 @@ describe('vim.ui_attach', function() feed(':messages') screen:expect([[ {9:Error in "msg_show" UI event handler (ns=(UNKNOWN PLUGIN)):} | - {9:Error executing lua: [string ""]:3: attempt to index global 'err' (a nil value)} | + {9:Lua: [string ""]:3: attempt to index global 'err' (a nil value)} | {9:stack traceback:} | {9: [string ""]:3: in function <[string ""]:1>} | {9:Error in "msg_clear" UI event handler (ns=(UNKNOWN PLUGIN)):} | - {9:Error executing lua: [string ""]:3: attempt to index global 'err' (a nil value)} | + {9:Lua: [string ""]:3: attempt to index global 'err' (a nil value)} | {9:stack traceback:} | {9: [string ""]:3: in function <[string ""]:1>} | {9:Excessive errors in vim.ui_attach() callback (ns=(UNKNOWN PLUGIN))} | @@ -506,7 +509,7 @@ describe('vim.ui_attach', function() { content = { { - 'Error executing vim.schedule lua callback: [string ""]:2: attempt to index global \'err\' (a nil value)\nstack traceback:\n\t[string ""]:2: in function <[string ""]:2>', + 'vim.schedule callback: [string ""]:2: attempt to index global \'err\' (a nil value)\nstack traceback:\n\t[string ""]:2: in function <[string ""]:2>', 9, 6, }, @@ -517,7 +520,7 @@ describe('vim.ui_attach', function() { content = { { - 'Error executing vim.schedule lua callback: [string ""]:2: attempt to index global \'err\' (a nil value)\nstack traceback:\n\t[string ""]:2: in function <[string ""]:2>', + 'vim.schedule callback: [string ""]:2: attempt to index global \'err\' (a nil value)\nstack traceback:\n\t[string ""]:2: in function <[string ""]:2>', 9, 6, }, diff --git a/test/functional/lua/loop_spec.lua b/test/functional/lua/uv_spec.lua similarity index 96% rename from test/functional/lua/loop_spec.lua rename to test/functional/lua/uv_spec.lua index 0ee101a0eb..848a073cb5 100644 --- a/test/functional/lua/loop_spec.lua +++ b/test/functional/lua/uv_spec.lua @@ -87,7 +87,7 @@ describe('vim.uv', function() screen:expect([[ | {2: }| - {3:Error executing callback:} | + {3:Lua callback:} | {3:[string ""]:5: E5560: nvim_set_var must not }| {3:be called in a fast event context} | {3:stack traceback:} | @@ -173,7 +173,7 @@ describe('vim.uv', function() | {1:~ }|*5 {3: }| - {9:Error executing callback:} | + {9:Lua callback:} | {9:[NULL]} | {6:Press ENTER or type command to continue}^ | ]] @@ -208,7 +208,7 @@ describe('vim.uv', function() screen:expect([[ {3: }| - {9:Error executing callback:} | + {9:Lua callback:} | {9:[NULL]} | {6:Press ENTER or type command to continue}^ | ]]) @@ -232,7 +232,7 @@ describe('vim.uv', function() screen:expect([[ {3: }| - {9:Error executing callback:} | + {9:Lua callback:} | {9:uv_idle_t: 0x{MATCH:%w+}}{MATCH: +}| {6:Press ENTER or type command to continue}^ | ]]) diff --git a/test/functional/lua/vim_spec.lua b/test/functional/lua/vim_spec.lua index 9693beb242..420d894635 100644 --- a/test/functional/lua/vim_spec.lua +++ b/test/functional/lua/vim_spec.lua @@ -3376,7 +3376,7 @@ describe('lua stdlib', function() local errmsg = api.nvim_get_vvar('errmsg') matches( [[ -^Error executing vim%.on%_key%(%) callbacks:.* +^vim%.on%_key%(%) callbacks:.* With ns%_id %d+: .*: Dumb Error stack traceback: .*: in function 'error' @@ -3506,19 +3506,13 @@ stack traceback: api.nvim_buf_set_lines(0, 0, -1, true, { '54321' }) - local function cleanup_msg(msg) - return msg:gsub('^Error .*\nWith ns%_id %d+: ', '') - end - feed('x') eq(1, exec_lua [[ return n_call ]]) - eq(1, exec_lua [[ return vim.on_key(nil, nil) ]]) - - eq('', cleanup_msg(eval('v:errmsg'))) + eq('', eval('v:errmsg')) feed('x') eq(2, exec_lua [[ return n_call ]]) - eq('return string must be empty', cleanup_msg(eval('v:errmsg'))) + matches('return string must be empty', eval('v:errmsg')) command('let v:errmsg = ""') eq(0, exec_lua [[ return vim.on_key(nil, nil) ]]) @@ -3526,7 +3520,7 @@ stack traceback: feed('x') eq(2, exec_lua [[ return n_call ]]) expect('21') - eq('', cleanup_msg(eval('v:errmsg'))) + eq('', eval('v:errmsg')) end) end) @@ -3991,7 +3985,7 @@ stack traceback: pcall_err(exec_lua, [[vim.api.nvim_win_call(0, function() vim.cmd 'fooooo' end)]]) ) eq( - 'Error executing lua: [string ""]:0: fooooo', + 'Lua: [string ""]:0: fooooo', pcall_err(exec_lua, [[vim.api.nvim_win_call(0, function() error('fooooo') end)]]) ) end) diff --git a/test/functional/options/defaults_spec.lua b/test/functional/options/defaults_spec.lua index e2695bd7a3..9ff076223b 100644 --- a/test/functional/options/defaults_spec.lua +++ b/test/functional/options/defaults_spec.lua @@ -1171,7 +1171,11 @@ describe('stdpath()', function() set_paths_via_system(env_var_name, paths) eq(expected_paths, t.fix_slashes(fn.stdpath(stdpath_arg))) if not is_os('win') then - assert_log('$TMPDIR tempdir not a directory[^\n]*TMPDIR%-should%-be%-ignored', testlog, 100) + assert_log( + '$TMPDIR tempdir not a directory[^\n]*TMPDIR%-should%-be%-ignored', + testlog, + 100 + ) end end) @@ -1179,7 +1183,11 @@ describe('stdpath()', function() set_paths_at_runtime(env_var_name, paths) eq(expected_paths, t.fix_slashes(fn.stdpath(stdpath_arg))) if not is_os('win') then - assert_log('$TMPDIR tempdir not a directory[^\n]*TMPDIR%-should%-be%-ignored', testlog, 100) + assert_log( + '$TMPDIR tempdir not a directory[^\n]*TMPDIR%-should%-be%-ignored', + testlog, + 100 + ) end end) end) diff --git a/test/functional/plugin/man_spec.lua b/test/functional/plugin/man_spec.lua index a77879aa7d..2e2c6d4050 100644 --- a/test/functional/plugin/man_spec.lua +++ b/test/functional/plugin/man_spec.lua @@ -253,9 +253,7 @@ describe(':Man', function() matches('^/.+', actual_file) local args = { nvim_prog, '--headless', '+:Man ' .. actual_file, '+q' } matches( - ('Error detected while processing command line:\r\n' .. 'man.lua: no manual entry for %s'):format( - pesc(actual_file) - ), + ('Error in command line:\r\n' .. 'man.lua: no manual entry for %s'):format(pesc(actual_file)), fn.system(args, { '' }) ) os.remove(actual_file) diff --git a/test/functional/provider/python3_spec.lua b/test/functional/provider/python3_spec.lua index 71a067d3d2..8b2756c019 100644 --- a/test/functional/provider/python3_spec.lua +++ b/test/functional/provider/python3_spec.lua @@ -65,11 +65,11 @@ describe('python3 provider', function() matches( string.format( dedent([[ - ^Error invoking 'python_execute' on channel 3 %%(python3%%-script%%-host%%): - File "", line 1 - print%%(%s b%%) - %%C* - SyntaxError: invalid syntax%%C*$]]), + ^Invoking 'python_execute' on channel 3 %%(python3%%-script%%-host%%): + File "", line 1 + print%%(%s b%%) + %%C* + SyntaxError: invalid syntax%%C*$]]), very_long_symbol ), eval('v:errmsg') diff --git a/test/functional/shada/errors_spec.lua b/test/functional/shada/errors_spec.lua index 0016e0bdf9..641c3e8a33 100644 --- a/test/functional/shada/errors_spec.lua +++ b/test/functional/shada/errors_spec.lua @@ -660,7 +660,7 @@ $ it('fails on invalid ShaDa file (failing skip in second item)', function() wshada('\001\000\001\128#!/') eq( - 'Vim(rshada):E576: Error while reading ShaDa file: last entry specified that it occupies 47 bytes, but file ended earlier', + 'Vim(rshada):E576: Reading ShaDa file: last entry specified that it occupies 47 bytes, but file ended earlier', exc_exec(sdrcmd()) ) eq( diff --git a/test/functional/terminal/tui_spec.lua b/test/functional/terminal/tui_spec.lua index 559131b3a6..cc0bc7cfad 100644 --- a/test/functional/terminal/tui_spec.lua +++ b/test/functional/terminal/tui_spec.lua @@ -271,23 +271,21 @@ describe('TUI', function() {} ) feed_data(':call ManyErr()\r') - screen:expect { - grid = [[ - {8:Error detected while processing function ManyErr:} | + screen:expect([[ + {8:Error in function ManyErr:} | {11:line 2:} | {8:FAIL 0} | {8:FAIL 1} | {8:FAIL 2} | {10:-- More --}^ | {3:-- TERMINAL --} | - ]], - } + ]]) screen:try_resize(50, 10) screen:expect { grid = [[ :call ManyErr() | - {8:Error detected while processing function ManyErr:} | + {8:Error in function ManyErr:} | {11:line 2:} | {8:FAIL 0} | {8:FAIL 1} | @@ -301,7 +299,7 @@ describe('TUI', function() feed_data('j') screen:expect { grid = [[ - {8:Error detected while processing function ManyErr:} | + {8:Error in function ManyErr:} | {11:line 2:} | {8:FAIL 0} | {8:FAIL 1} | @@ -342,7 +340,7 @@ describe('TUI', function() screen:expect { grid = [[ :call ManyErr() | - {8:Error detected while processing function ManyErr:} | + {8:Error in function ManyErr:} | {11:line 2:} | {10:-- More --}^ | {3:-- TERMINAL --} | @@ -353,7 +351,7 @@ describe('TUI', function() screen:expect { grid = [[ :call ManyErr() | - {8:Error detected while processing function ManyErr:} | + {8:Error in function ManyErr:} | {11:line 2:} | {8:FAIL 0} | {8:FAIL 1} | @@ -1413,11 +1411,10 @@ describe('TUI', function() feed_data('\027[200~line 1\nline 2\n') screen:expect([[ foo | - | - {5: }| - {8:paste: Error executing lua: [string ""]:4: f}| - {8:ake fail} | - {10:Press ENTER or type command to continue}^ | + ^ | + {4:~ }|*2 + {5:[No Name] [+] }| + {8:paste: Lua: [string ""]:4: fake fail} | {3:-- TERMINAL --} | ]]) -- Remaining chunks are discarded after vim.paste() failure. @@ -1518,8 +1515,8 @@ describe('TUI', function() | {4:~ }| {5: }| - {8:paste: Error executing lua: Vim:E21: Cannot make c}| - {8:hanges, 'modifiable' is off} | + {8:paste: Lua: Vim:E21: Cannot make changes, 'modifia}| + {8:ble' is off} | {10:Press ENTER or type command to continue}^ | {3:-- TERMINAL --} | ]]) diff --git a/test/functional/ui/cmdline_highlight_spec.lua b/test/functional/ui/cmdline_highlight_spec.lua index 6e2f1f244f..e77b23b668 100644 --- a/test/functional/ui/cmdline_highlight_spec.lua +++ b/test/functional/ui/cmdline_highlight_spec.lua @@ -686,7 +686,7 @@ describe('Ex commands coloring', function() {EOB:~ }|*2 {MSEP: }| :# | - {ERR:Error detected while processing :} | + {ERR:Error in :} | {ERR:E605: Exception not caught: 42} | :#^ | ]]) @@ -696,16 +696,13 @@ describe('Ex commands coloring', function() {EOB:~ }| {MSEP: }| :# | - {ERR:Error detected while processing :} | + {ERR:Error in :} | {ERR:E605: Exception not caught: 42} | {ERR:E749: Empty buffer} | {PE:Press ENTER or type command to continue}^ | ]]) feed('') - eq( - 'Error detected while processing :\nE605: Exception not caught: 42\nE749: Empty buffer', - exec_capture('messages') - ) + eq('Error in :\nE605: Exception not caught: 42\nE749: Empty buffer', exec_capture('messages')) end) it('errors out when failing to get callback', function() api.nvim_set_var('Nvim_color_cmdline', 42) diff --git a/test/functional/ui/decorations_spec.lua b/test/functional/ui/decorations_spec.lua index f222f115f3..db92bc7f5f 100644 --- a/test/functional/ui/decorations_spec.lua +++ b/test/functional/ui/decorations_spec.lua @@ -872,15 +872,15 @@ describe('decoration_providers', function() ]]) screen:expect([[ {3: }| - {9:Error in decoration provider "start" (ns=ns1):} | - {9:Error executing lua: [string ""]:4: Foo} | + {9:Decoration provider "start" (ns=ns1):} | + {9:Lua: [string ""]:4: Foo} | {9:stack traceback:} | {9: [C]: in function 'error'} | {9: [string ""]:4: in function <[string ""]:3>} | {6:Press ENTER or type command to continue}^ | ]]) t.assert_log('Error in decoration provider "start" %(ns=ns1%):', testlog, 100) - t.assert_log('Error executing lua: %[string ""%]:4: Foo', testlog, 100) + t.assert_log('Lua: %[string ""%]:4: Foo', testlog, 100) n.check_close() os.remove(testlog) end) diff --git a/test/functional/ui/embed_spec.lua b/test/functional/ui/embed_spec.lua index 977141ae3e..d65324bbfe 100644 --- a/test/functional/ui/embed_spec.lua +++ b/test/functional/ui/embed_spec.lua @@ -41,7 +41,7 @@ local function test_embed(ext_linegrid) screen:expect([[ |*4 {102: }| - {9:Error detected while processing pre-vimrc command line:} | + {9:Error in pre-vimrc command line:} | {9:E121: Undefined variable: invalid} | {6:Press ENTER or type command to continue}^ | ]]) @@ -62,7 +62,7 @@ local function test_embed(ext_linegrid) screen:expect([[ |*3 {102: }| - {9:Error detected while processing pre-vimrc command line:} | + {9:Error in pre-vimrc command line:} | {9:foo} | {101:bar} | {100:Press ENTER or type command to continue}^ | @@ -75,7 +75,7 @@ local function test_embed(ext_linegrid) grid = [[ |*3 {102: }| - {9:Error detected while processing pre-vimrc command line:} | + {9:Error in pre-vimrc command line:} | {9:foo} | {9:bar} | {6:Press ENTER or type command to continue}^ | diff --git a/test/functional/ui/messages_spec.lua b/test/functional/ui/messages_spec.lua index 4e1aca2b7c..5a48b21b09 100644 --- a/test/functional/ui/messages_spec.lua +++ b/test/functional/ui/messages_spec.lua @@ -182,7 +182,7 @@ describe('ui/ext_messages', function() messages = { { content = { - { 'Error detected while processing :\nE605: Exception not caught: foo', 9, 6 }, + { 'Error in :\nE605: Exception not caught: foo', 9, 6 }, }, history = true, kind = 'emsg', @@ -1250,7 +1250,7 @@ describe('ui/ext_messages', function() { content = { { - [[E5108: Error executing lua [string ":lua"]:1: such + [[E5108: Lua: [string ":lua"]:1: such multiline error stack traceback: @@ -1279,7 +1279,7 @@ stack traceback: messages = { { content = { - { "Error invoking 'test_method' on channel 1:\ncomplete\nerror\n\nmessage", 9, 6 }, + { "Invoking 'test_method' on channel 1:\ncomplete\nerror\n\nmessage", 9, 6 }, }, history = true, kind = 'rpc_error', @@ -1699,7 +1699,7 @@ describe('ui/builtin messages', function() screen:expect { grid = [[ {3: }| - {9:Error invoking 'test_method' on channel 1:} | + {9:Invoking 'test_method' on channel 1:} | {9:complete} | {9:error} | | @@ -1934,7 +1934,7 @@ vimComment xxx match /\s"[^\-:.%#=*].*$/ms=s+1,lc=1 excludenl contains=@vim feed(':set colorcolumn=5 | lua error("x\\n\\nx")') screen:expect { grid = [[ - {9:E5108: Error executing lua [string ":lua"]:1: x} | + {9:E5108: Lua: [string ":lua"]:1: x} | | {9:x} | {9:stack traceback:} | @@ -1961,7 +1961,7 @@ vimComment xxx match /\s"[^\-:.%#=*].*$/ms=s+1,lc=1 excludenl contains=@vim feed(':set colorcolumn=5 | lua error("x\\n\\n\\nx")') screen:expect { grid = [[ - {9:E5108: Error executing lua [string ":lua"]:1: x} | + {9:E5108: Lua: [string ":lua"]:1: x} | |*2 {9:x} | {9:stack traceback:} | @@ -2686,76 +2686,66 @@ aliquip ex ea commodo consequat.]] it('handles wrapped lines with line scroll', function() feed(':lua error(_G.x)') - screen:expect { - grid = [[ - {2:E5108: Error executing lua [string }| - {2:":lua"]:1: Lorem ipsum dolor sit am}| - {2:et, consectetur} | + screen:expect([[ + {2:E5108: Lua: [string ":lua"]:1: Lore}| + {2:m ipsum dolor sit amet, consectetur}| + | {2:adipisicing elit, sed do eiusmod te}| {2:mpor} | {2:incididunt ut labore et dolore magn}| {2:a aliqua.} | {4:-- More --}^ | - ]], - } + ]]) feed('j') - screen:expect { - grid = [[ - {2:":lua"]:1: Lorem ipsum dolor sit am}| - {2:et, consectetur} | + screen:expect([[ + {2:m ipsum dolor sit amet, consectetur}| + | {2:adipisicing elit, sed do eiusmod te}| {2:mpor} | {2:incididunt ut labore et dolore magn}| {2:a aliqua.} | {2:Ut enim ad minim veniam, quis nostr}| {4:-- More --}^ | - ]], - } + ]]) feed('k') - screen:expect { - grid = [[ - {2:E5108: Error executing lua [string }| - {2:":lua"]:1: Lorem ipsum dolor sit am}| - {2:et, consectetur} | + screen:expect([[ + {2:E5108: Lua: [string ":lua"]:1: Lore}| + {2:m ipsum dolor sit amet, consectetur}| + | {2:adipisicing elit, sed do eiusmod te}| {2:mpor} | {2:incididunt ut labore et dolore magn}| {2:a aliqua.} | {4:-- More --}^ | - ]], - } + ]]) feed('j') - screen:expect { - grid = [[ - {2:":lua"]:1: Lorem ipsum dolor sit am}| - {2:et, consectetur} | + screen:expect([[ + {2:m ipsum dolor sit amet, consectetur}| + | {2:adipisicing elit, sed do eiusmod te}| {2:mpor} | {2:incididunt ut labore et dolore magn}| {2:a aliqua.} | {2:Ut enim ad minim veniam, quis nostr}| {4:-- More --}^ | - ]], - } + ]]) end) it('handles wrapped lines with page scroll', function() feed(':lua error(_G.x)') - screen:expect { - grid = [[ - {2:E5108: Error executing lua [string }| - {2:":lua"]:1: Lorem ipsum dolor sit am}| - {2:et, consectetur} | + screen:expect([[ + {2:E5108: Lua: [string ":lua"]:1: Lore}| + {2:m ipsum dolor sit amet, consectetur}| + | {2:adipisicing elit, sed do eiusmod te}| {2:mpor} | {2:incididunt ut labore et dolore magn}| {2:a aliqua.} | {4:-- More --}^ | - ]], - } + ]]) feed('d') screen:expect { grid = [[ @@ -2770,18 +2760,16 @@ aliquip ex ea commodo consequat.]] ]], } feed('u') - screen:expect { - grid = [[ - {2:E5108: Error executing lua [string }| - {2:":lua"]:1: Lorem ipsum dolor sit am}| - {2:et, consectetur} | + screen:expect([[ + {2:E5108: Lua: [string ":lua"]:1: Lore}| + {2:m ipsum dolor sit amet, consectetur}| + | {2:adipisicing elit, sed do eiusmod te}| {2:mpor} | {2:incididunt ut labore et dolore magn}| {2:a aliqua.} | {4:-- More --}^ | - ]], - } + ]]) feed('d') screen:expect { grid = [[ @@ -2801,77 +2789,67 @@ aliquip ex ea commodo consequat.]] command('hi MsgArea guisp=Yellow') feed(':lua error(_G.x)') - screen:expect { - grid = [[ - {3:E5108: Error executing lua [string }| - {3:":lua"]:1: Lorem ipsum dolor sit am}| - {3:et, consectetur}{5: }| + screen:expect([[ + {3:E5108: Lua: [string ":lua"]:1: Lore}| + {3:m ipsum dolor sit amet, consectetur}| + {5: }| {3:adipisicing elit, sed do eiusmod te}| {3:mpor}{5: }| {3:incididunt ut labore et dolore magn}| {3:a aliqua.}{5: }| {6:-- More --}{5:^ }| - ]], - } + ]]) feed('j') - screen:expect { - grid = [[ - {3:":lua"]:1: Lorem ipsum dolor sit am}| - {3:et, consectetur}{5: }| + screen:expect([[ + {3:m ipsum dolor sit amet, consectetur}| + {5: }| {3:adipisicing elit, sed do eiusmod te}| {3:mpor}{5: }| {3:incididunt ut labore et dolore magn}| {3:a aliqua.}{5: }| {3:Ut enim ad minim veniam, quis nostr}| {6:-- More --}{5:^ }| - ]], - } + ]]) feed('k') - screen:expect { - grid = [[ - {3:E5108: Error executing lua [string }| - {3:":lua"]:1: Lorem ipsum dolor sit am}| - {3:et, consectetur}{5: }| + screen:expect([[ + {3:E5108: Lua: [string ":lua"]:1: Lore}| + {3:m ipsum dolor sit amet, consectetur}| + {5: }| {3:adipisicing elit, sed do eiusmod te}| {3:mpor}{5: }| {3:incididunt ut labore et dolore magn}| {3:a aliqua.}{5: }| {6:-- More --}{5:^ }| - ]], - } + ]]) feed('j') - screen:expect { - grid = [[ - {3:":lua"]:1: Lorem ipsum dolor sit am}| - {3:et, consectetur}{5: }| + screen:expect([[ + {3:m ipsum dolor sit amet, consectetur}| + {5: }| {3:adipisicing elit, sed do eiusmod te}| {3:mpor}{5: }| {3:incididunt ut labore et dolore magn}| {3:a aliqua.}{5: }| {3:Ut enim ad minim veniam, quis nostr}| {6:-- More --}{5:^ }| - ]], - } + ]]) end) it('handles wrapped lines with page scroll and MsgArea highlight', function() command('hi MsgArea guisp=Yellow') feed(':lua error(_G.x)') - screen:expect { - grid = [[ - {3:E5108: Error executing lua [string }| - {3:":lua"]:1: Lorem ipsum dolor sit am}| - {3:et, consectetur}{5: }| + screen:expect([[ + {3:E5108: Lua: [string ":lua"]:1: Lore}| + {3:m ipsum dolor sit amet, consectetur}| + {5: }| {3:adipisicing elit, sed do eiusmod te}| {3:mpor}{5: }| {3:incididunt ut labore et dolore magn}| {3:a aliqua.}{5: }| {6:-- More --}{5:^ }| - ]], - } + ]]) feed('d') screen:expect { grid = [[ @@ -2886,18 +2864,16 @@ aliquip ex ea commodo consequat.]] ]], } feed('u') - screen:expect { - grid = [[ - {3:E5108: Error executing lua [string }| - {3:":lua"]:1: Lorem ipsum dolor sit am}| - {3:et, consectetur}{5: }| + screen:expect([[ + {3:E5108: Lua: [string ":lua"]:1: Lore}| + {3:m ipsum dolor sit amet, consectetur}| + {5: }| {3:adipisicing elit, sed do eiusmod te}| {3:mpor}{5: }| {3:incididunt ut labore et dolore magn}| {3:a aliqua.}{5: }| {6:-- More --}{5:^ }| - ]], - } + ]]) feed('d') screen:expect { grid = [[ @@ -3059,18 +3035,16 @@ aliquip ex ea commodo consequat.]] it('can be resized', function() feed(':lua error(_G.x)') - screen:expect { - grid = [[ - {2:E5108: Error executing lua [string }| - {2:":lua"]:1: Lorem ipsum dolor sit am}| - {2:et, consectetur} | + screen:expect([[ + {2:E5108: Lua: [string ":lua"]:1: Lore}| + {2:m ipsum dolor sit amet, consectetur}| + | {2:adipisicing elit, sed do eiusmod te}| {2:mpor} | {2:incididunt ut labore et dolore magn}| {2:a aliqua.} | {4:-- More --}^ | - ]], - } + ]]) -- responds to resize, but text is not reflown screen:try_resize(45, 5) @@ -3087,29 +3061,26 @@ aliquip ex ea commodo consequat.]] -- can create empty space, as the command hasn't output the text below yet. -- text is not reflown; existing lines get cut screen:try_resize(30, 12) - screen:expect { - grid = [[ + screen:expect([[ :lua error(_G.x) | - {2:E5108: Error executing lua [st}| - {2:":lua"]:1: Lorem ipsum dolor s}| - {2:et, consectetur} | + {2:E5108: Lua: [string ":lua"]:1:}| + {2:m ipsum dolor sit amet, consec}| + {2:tetur} | {2:adipisicing elit, sed do eiusm}| {2:mpore} | {2:incididunt ut labore et dolore}| {2:a aliqua.} | |*3 {4:-- More --}^ | - ]], - } + ]]) -- continues in a mostly consistent state, but only new lines are -- wrapped at the new screen size. feed('') - screen:expect { - grid = [[ - {2:E5108: Error executing lua [st}| - {2:":lua"]:1: Lorem ipsum dolor s}| - {2:et, consectetur} | + screen:expect([[ + {2:E5108: Lua: [string ":lua"]:1:}| + {2:m ipsum dolor sit amet, consec}| + {2:tetur} | {2:adipisicing elit, sed do eiusm}| {2:mpore} | {2:incididunt ut labore et dolore}| @@ -3119,14 +3090,12 @@ aliquip ex ea commodo consequat.]] {2:ullamco laboris nisi ut} | {2:aliquip ex ea commodo consequa}| {4:-- More --}^ | - ]], - } + ]]) feed('') - screen:expect { - grid = [[ - {2:":lua"]:1: Lorem ipsum dolor s}| - {2:et, consectetur} | + screen:expect([[ + {2:m ipsum dolor sit amet, consec}| + {2:tetur} | {2:adipisicing elit, sed do eiusm}| {2:mpore} | {2:incididunt ut labore et dolore}| @@ -3137,8 +3106,7 @@ aliquip ex ea commodo consequat.]] {2:aliquip ex ea commodo consequa}| {2:t.} | {4:-- More --}^ | - ]], - } + ]]) feed('q') screen:expect { diff --git a/test/functional/ui/multigrid_spec.lua b/test/functional/ui/multigrid_spec.lua index 218a6a02b1..3a00c80628 100644 --- a/test/functional/ui/multigrid_spec.lua +++ b/test/functional/ui/multigrid_spec.lua @@ -892,7 +892,7 @@ describe('ext_multigrid', function() | {1:~ }|*4 ## grid 3 - {14:Error detected while processing function ErrMsg:} | + {14:Error in function ErrMsg:} | {19:line 2:} | {14:error 0} | {14:error 1} | diff --git a/test/functional/vimscript/eval_spec.lua b/test/functional/vimscript/eval_spec.lua index 2a4835f7e1..bdea40b4e4 100644 --- a/test/functional/vimscript/eval_spec.lua +++ b/test/functional/vimscript/eval_spec.lua @@ -193,21 +193,19 @@ describe('uncaught exception', function() end ]]) feed(':try\rlua _G.Oops()\rendtry\r') - screen:expect { - grid = [[ + screen:expect([[ {3: }| :try | : lua _G.Oops() | : endtry | - {9:Error detected while processing :} | - {9:E5108: Error executing lua [string ""]:2: oops} | + {9:Error in :} | + {9:E5108: Lua: [string ""]:2: oops} | {9:stack traceback:} | {9: [C]: in function 'error'} | {9: [string ""]:2: in function 'Oops'} | {9: [string ":lua"]:1: in main chunk} | {6:Press ENTER or type command to continue}^ | - ]], - } + ]]) end) end) diff --git a/test/functional/vimscript/execute_spec.lua b/test/functional/vimscript/execute_spec.lua index 2404538e77..457f7d184e 100644 --- a/test/functional/vimscript/execute_spec.lua +++ b/test/functional/vimscript/execute_spec.lua @@ -214,9 +214,9 @@ describe('execute()', function() -- echoerr does not set did_emsg -- "ef" was overwritten since msg_col was recovered wrongly screen:expect([[ + {3: }| 1234 | - {9:Error detected while processing function}| - {9: Test4:} | + {9:Error in function Test4:} | {8:line 2:} | {9:abcd}ABCD | {6:Press ENTER or type command to continue}^ | @@ -232,9 +232,9 @@ describe('execute()', function() feed([[:call Test6()]]) screen:expect([[ + {3: }| | - {9:Error detected while processing function}| - {9: Test6:} | + {9:Error in function Test6:} | {8:line 2:} | {9:E121}ABCD | {6:Press ENTER or type command to continue}^ | @@ -242,8 +242,8 @@ describe('execute()', function() feed([[:call Test7()]]) screen:expect([[ - {9:Error detected while processing function}| - {9: Test6:} | + | + {9:Error in function Test6:} | {8:line 2:} | {9:E121}ABCD | ABCD | diff --git a/test/old/testdir/test_debugger.vim b/test/old/testdir/test_debugger.vim index 5820b58247..25f9e8325f 100644 --- a/test/old/testdir/test_debugger.vim +++ b/test/old/testdir/test_debugger.vim @@ -129,7 +129,7 @@ func Test_Debugger() call RunDbgCmd(buf, 'step') call RunDbgCmd(buf, 'frame 2') call RunDbgCmd(buf, 'echo var3', [ - \ 'Error detected while processing function Foo[2]..Bar[2]..Bazz:', + \ 'Error in function Foo[2]..Bar[2]..Bazz:', \ 'line 4:', \ 'E121: Undefined variable: var3']) @@ -149,7 +149,7 @@ func Test_Debugger() " Undefined var2 call RunDbgCmd(buf, 'echo var2', [ - \ 'Error detected while processing function Foo[2]..Bar:', + \ 'Error in function Foo[2]..Bar:', \ 'line 3:', \ 'E121: Undefined variable: var2']) @@ -268,7 +268,7 @@ func Test_Debugger() " Check for error cases call RunDbgCmd(buf, 'breakadd abcd', [ - \ 'Error detected while processing function Bazz:', + \ 'Error in function Bazz:', \ 'line 5:', \ 'E475: Invalid argument: abcd']) call RunDbgCmd(buf, 'breakadd func', ['E475: Invalid argument: func']) diff --git a/test/testutil.lua b/test/testutil.lua index dffedfdc03..62cf1b18ca 100644 --- a/test/testutil.lua +++ b/test/testutil.lua @@ -268,7 +268,7 @@ function M.pcall_err_withtrace(fn, ...) return ( errmsg :gsub('^%.%.%./testnvim%.lua:0: ', '') - :gsub('^Error executing lua:- ', '') + :gsub('^Lua:- ', '') :gsub('^%[string ""%]:0: ', '') ) end