mirror of
https://github.com/neovim/neovim.git
synced 2025-09-20 10:18:18 +00:00
feat(messages): cleanup Lua error messages
"Error" in error messages is redundant. Just provide the context, don't say "Error ...".
This commit is contained in:
@@ -198,6 +198,9 @@ UI
|
|||||||
• |ui-multigrid| provides composition information and absolute coordinates.
|
• |ui-multigrid| provides composition information and absolute coordinates.
|
||||||
• `vim._extui` provides an experimental commandline and message UI intended to
|
• `vim._extui` provides an experimental commandline and message UI intended to
|
||||||
replace the message grid in the TUI.
|
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
|
VIMSCRIPT
|
||||||
|
|
||||||
|
@@ -560,7 +560,7 @@ Lua interface (|lua.txt|):
|
|||||||
that prints `a` and `b` on separate lines, exactly like
|
that prints `a` and `b` on separate lines, exactly like
|
||||||
`:lua print("a\nb")` .
|
`:lua print("a\nb")` .
|
||||||
- `:lua error('TEST')` emits the error: >
|
- `:lua error('TEST')` emits the error: >
|
||||||
E5108: Error executing lua: [string "<Vimscript compiled string>"]:1: TEST
|
E5108: Lua: [string "<Vimscript compiled string>"]:1: TEST
|
||||||
< whereas Vim emits only "TEST".
|
< whereas Vim emits only "TEST".
|
||||||
- Lua has direct access to Nvim |API| via `vim.api`.
|
- Lua has direct access to Nvim |API| via `vim.api`.
|
||||||
- Lua package.path and package.cpath are automatically updated according to
|
- Lua package.path and package.cpath are automatically updated according to
|
||||||
|
@@ -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 (!parse_cmdline(cmdline, &ea, &cmdinfo, &errormsg)) {
|
||||||
if (errormsg != NULL) {
|
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 {
|
} else {
|
||||||
api_set_error(err, kErrorTypeException, "Error while parsing command line");
|
api_set_error(err, kErrorTypeException, "Parsing command-line");
|
||||||
}
|
}
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
@@ -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)");
|
const char *ns = describe_ns(provider->ns_id, "(UNKNOWN PLUGIN)");
|
||||||
ELOG("Error in decoration provider \"%s\" (ns=%s):\n%s", name, ns, msg);
|
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
|
// Note we pass in a provider index as this function may cause decor_providers providers to be
|
||||||
|
@@ -6357,10 +6357,10 @@ static void f_rpcrequest(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
|
|||||||
name = get_client_info(chan, "name");
|
name = get_client_info(chan, "name");
|
||||||
}
|
}
|
||||||
if (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);
|
method, chan_id, name, err.msg);
|
||||||
} else {
|
} 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);
|
method, chan_id, err.msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -192,13 +192,13 @@ static void nlua_luv_error_event(void **argv)
|
|||||||
luv_err_t type = (luv_err_t)(intptr_t)argv[1];
|
luv_err_t type = (luv_err_t)(intptr_t)argv[1];
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case kCallback:
|
case kCallback:
|
||||||
semsg_multiline("lua_error", "Error executing callback:\n%s", error);
|
semsg_multiline("lua_error", "Lua callback:\n%s", error);
|
||||||
break;
|
break;
|
||||||
case kThread:
|
case kThread:
|
||||||
semsg_multiline("lua_error", "Error in luv thread:\n%s", error);
|
semsg_multiline("lua_error", "Luv thread:\n%s", error);
|
||||||
break;
|
break;
|
||||||
case kThreadCallback:
|
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;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@@ -377,7 +377,7 @@ static void nlua_schedule_event(void **argv)
|
|||||||
nlua_pushref(lstate, cb);
|
nlua_pushref(lstate, cb);
|
||||||
nlua_unref_global(lstate, cb);
|
nlua_unref_global(lstate, cb);
|
||||||
if (nlua_pcall(lstate, 0, 0)) {
|
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);
|
ui_remove_cb(ns_id, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1032,7 +1032,7 @@ static int nlua_print(lua_State *const lstate)
|
|||||||
nlua_print_error:
|
nlua_print_error:
|
||||||
ga_clear(&msg_ga);
|
ga_clear(&msg_ga);
|
||||||
char *buff = xmalloc(IOSIZE);
|
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,
|
size_t len = (size_t)vim_snprintf(buff, IOSIZE, fmt, curargidx,
|
||||||
(int)errmsg_len, errmsg);
|
(int)errmsg_len, errmsg);
|
||||||
lua_pushlstring(lstate, buff, len);
|
lua_pushlstring(lstate, buff, len);
|
||||||
@@ -1126,9 +1126,9 @@ static int nlua_debug(lua_State *lstate)
|
|||||||
}
|
}
|
||||||
if (luaL_loadbuffer(lstate, input.vval.v_string,
|
if (luaL_loadbuffer(lstate, input.vval.v_string,
|
||||||
strlen(input.vval.v_string), "=(debug command)")) {
|
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)) {
|
} 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);
|
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);
|
lua_pushinteger(lstate, xp->xp_col);
|
||||||
|
|
||||||
if (nlua_pcall(lstate, 3, 1)) {
|
if (nlua_pcall(lstate, 3, 1)) {
|
||||||
nlua_error(lstate, _("E5108: Error executing Lua function: %.*s"));
|
nlua_error(lstate, _("E5108: Lua function: %.*s"));
|
||||||
return;
|
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;
|
lua_State *const lstate = global_lstate;
|
||||||
if (luaL_loadbuffer(lstate, lcmd, lcmd_len, name)) {
|
if (luaL_loadbuffer(lstate, lcmd, lcmd_len, name)) {
|
||||||
nlua_error(lstate, _("E5107: Error loading lua %.*s"));
|
nlua_error(lstate, _("E5107: Lua: %.*s"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
PUSH_ALL_TYPVALS(lstate, args, argcount, special);
|
PUSH_ALL_TYPVALS(lstate, args, argcount, special);
|
||||||
|
|
||||||
if (nlua_pcall(lstate, argcount, ret_tv ? 1 : 0)) {
|
if (nlua_pcall(lstate, argcount, ret_tv ? 1 : 0)) {
|
||||||
nlua_error(lstate, _("E5108: Error executing lua %.*s"));
|
nlua_error(lstate, _("E5108: Lua: %.*s"));
|
||||||
return;
|
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, "<nvim>")) {
|
if (luaL_loadbuffer(lstate, str.data, str.size, "<nvim>")) {
|
||||||
size_t len;
|
size_t len;
|
||||||
const char *errstr = lua_tolstring(lstate, -1, &len);
|
const char *errstr = lua_tolstring(lstate, -1, &len);
|
||||||
api_set_error(err, kErrorTypeValidation,
|
api_set_error(err, kErrorTypeValidation, "Lua: %.*s", (int)len, errstr);
|
||||||
"Error loading lua: %.*s", (int)len, errstr);
|
|
||||||
return NIL;
|
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)) {
|
if (nlua_pcall(lstate, (int)args.size, 1)) {
|
||||||
size_t len;
|
size_t len;
|
||||||
const char *errstr = lua_tolstring(lstate, -1, &len);
|
const char *errstr = lua_tolstring(lstate, -1, &len);
|
||||||
api_set_error(err, kErrorTypeException,
|
api_set_error(err, kErrorTypeException, "Lua: %.*s", (int)len, errstr);
|
||||||
"Error executing lua: %.*s", (int)len, errstr);
|
|
||||||
return NIL;
|
return NIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1598,10 +1596,9 @@ Object nlua_call_ref_ctx(bool fast, LuaRef ref, const char *name, Array args, Lu
|
|||||||
if (err) {
|
if (err) {
|
||||||
size_t len;
|
size_t len;
|
||||||
const char *errstr = lua_tolstring(lstate, -1, &len);
|
const char *errstr = lua_tolstring(lstate, -1, &len);
|
||||||
api_set_error(err, kErrorTypeException,
|
api_set_error(err, kErrorTypeException, "Lua: %.*s", (int)len, errstr);
|
||||||
"Error executing lua: %.*s", (int)len, errstr);
|
|
||||||
} else {
|
} else {
|
||||||
nlua_error(lstate, _("Error executing lua callback: %.*s"));
|
nlua_error(lstate, _("Lua callback: %.*s"));
|
||||||
}
|
}
|
||||||
return NIL;
|
return NIL;
|
||||||
}
|
}
|
||||||
@@ -1721,7 +1718,7 @@ void ex_luado(exarg_T *const eap)
|
|||||||
#undef DOEND
|
#undef DOEND
|
||||||
|
|
||||||
if (luaL_loadbuffer(lstate, lcmd, lcmd_len, ":luado")) {
|
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) {
|
if (lcmd_len >= IOSIZE) {
|
||||||
xfree(lcmd);
|
xfree(lcmd);
|
||||||
}
|
}
|
||||||
@@ -1731,7 +1728,7 @@ void ex_luado(exarg_T *const eap)
|
|||||||
xfree(lcmd);
|
xfree(lcmd);
|
||||||
}
|
}
|
||||||
if (nlua_pcall(lstate, 0, 1)) {
|
if (nlua_pcall(lstate, 0, 1)) {
|
||||||
nlua_error(lstate, _("E5110: Error executing lua: %.*s"));
|
nlua_error(lstate, _("E5110: Lua: %.*s"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1750,7 +1747,7 @@ void ex_luado(exarg_T *const eap)
|
|||||||
lua_pushstring(lstate, old_line);
|
lua_pushstring(lstate, old_line);
|
||||||
lua_pushnumber(lstate, (lua_Number)l);
|
lua_pushnumber(lstate, (lua_Number)l);
|
||||||
if (nlua_pcall(lstate, 2, 1)) {
|
if (nlua_pcall(lstate, 2, 1)) {
|
||||||
nlua_error(lstate, _("E5111: Error calling lua: %.*s"));
|
nlua_error(lstate, _("E5111: Lua: %.*s"));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1845,7 +1842,7 @@ bool nlua_exec_file(const char *path)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (nlua_pcall(lstate, 1, 2)) {
|
if (nlua_pcall(lstate, 1, 2)) {
|
||||||
nlua_error(lstate, _("E5111: Error calling lua: %.*s"));
|
nlua_error(lstate, _("E5111: Lua: %.*s"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1855,7 +1852,7 @@ bool nlua_exec_file(const char *path)
|
|||||||
|
|
||||||
if (lua_isnil(lstate, -2)) {
|
if (lua_isnil(lstate, -2)) {
|
||||||
// 1
|
// 1
|
||||||
nlua_error(lstate, _("E5112: Error while creating lua chunk: %.*s"));
|
nlua_error(lstate, _("E5112: Lua chunk: %.*s"));
|
||||||
assert(lua_isnil(lstate, -1));
|
assert(lua_isnil(lstate, -1));
|
||||||
lua_pop(lstate, 1);
|
lua_pop(lstate, 1);
|
||||||
return false;
|
return false;
|
||||||
@@ -1866,7 +1863,7 @@ bool nlua_exec_file(const char *path)
|
|||||||
lua_pop(lstate, 1);
|
lua_pop(lstate, 1);
|
||||||
|
|
||||||
if (nlua_pcall(lstate, 0, 0)) {
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1945,7 +1942,7 @@ void nlua_expand_pat(expand_T *xp)
|
|||||||
lua_pushlstring(lstate, pat, (size_t)patlen);
|
lua_pushlstring(lstate, pat, (size_t)patlen);
|
||||||
|
|
||||||
if (nlua_pcall(lstate, 1, 2) != 0) {
|
if (nlua_pcall(lstate, 1, 2) != 0) {
|
||||||
nlua_error(lstate, _("Error executing vim._expand_pat: %.*s"));
|
nlua_error(lstate, _("vim._expand_pat: %.*s"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2093,7 +2090,7 @@ bool nlua_execute_on_key(int c, char *typed_buf)
|
|||||||
bool discard = false;
|
bool discard = false;
|
||||||
// Do not use nlua_pcall here to avoid duplicate stack trace information
|
// Do not use nlua_pcall here to avoid duplicate stack trace information
|
||||||
if (lua_pcall(lstate, 2, 1, 0)) {
|
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 {
|
} else {
|
||||||
if (lua_isboolean(lstate, -1)) {
|
if (lua_isboolean(lstate, -1)) {
|
||||||
discard = lua_toboolean(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)) {
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -26,7 +26,7 @@ char *nlua_read_secure(const char *path)
|
|||||||
lua_getfield(lstate, -1, "read");
|
lua_getfield(lstate, -1, "read");
|
||||||
lua_pushstring(lstate, path);
|
lua_pushstring(lstate, path);
|
||||||
if (nlua_pcall(lstate, 1, 1)) {
|
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);
|
lua_settop(lstate, top);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@@ -68,7 +68,7 @@ static bool nlua_trust(const char *action, const char *path)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (nlua_pcall(lstate, 1, 2)) {
|
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);
|
lua_settop(lstate, top);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@@ -178,7 +178,7 @@ static const TSLanguage *load_language_from_wasm(lua_State *L, const char *path,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (werr.kind > 0) {
|
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;
|
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, logtype == TSLogTypeParse ? "parse" : "lex");
|
||||||
lua_pushstring(lstate, s);
|
lua_pushstring(lstate, s);
|
||||||
if (lua_pcall(lstate, 2, 0, 0)) {
|
if (lua_pcall(lstate, 2, 0, 0)) {
|
||||||
luaL_error(lstate, "Error executing treesitter logger callback");
|
luaL_error(lstate, "treesitter logger callback failed");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -341,8 +341,7 @@ int nlua_xdl_diff(lua_State *lstate)
|
|||||||
|
|
||||||
if (xdl_diff(&ma, &mb, ¶ms, &cfg, &ecb) == -1) {
|
if (xdl_diff(&ma, &mb, ¶ms, &cfg, &ecb) == -1) {
|
||||||
if (!ERROR_SET(&err)) {
|
if (!ERROR_SET(&err)) {
|
||||||
api_set_error(&err, kErrorTypeException,
|
api_set_error(&err, kErrorTypeException, "diff operation failed");
|
||||||
"Error while performing diff operation");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -2065,7 +2065,7 @@ static void do_exrc_initialization(void)
|
|||||||
nlua_exec(cstr_as_string(str), (Array)ARRAY_DICT_INIT, kRetNilBool, NULL, &err);
|
nlua_exec(cstr_as_string(str), (Array)ARRAY_DICT_INIT, kRetNilBool, NULL, &err);
|
||||||
xfree(str);
|
xfree(str);
|
||||||
if (ERROR_SET(&err)) {
|
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);
|
semsg_multiline("emsg", err.msg);
|
||||||
api_clear_error(&err);
|
api_clear_error(&err);
|
||||||
}
|
}
|
||||||
|
@@ -593,7 +593,7 @@ static char *get_emsg_source(void)
|
|||||||
sname = SOURCING_NAME;
|
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;
|
const size_t buf_len = strlen(sname) + strlen(p) + 1;
|
||||||
char *const buf = xmalloc(buf_len);
|
char *const buf = xmalloc(buf_len);
|
||||||
snprintf(buf, buf_len, p, sname);
|
snprintf(buf, buf_len, p, sname);
|
||||||
|
@@ -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);
|
const ptrdiff_t skip_bytes = file_skip(sd_reader, offset);
|
||||||
if (skip_bytes < 0) {
|
if (skip_bytes < 0) {
|
||||||
semsg(_(SERR "System error while skipping in ShaDa file: %s"),
|
semsg(_(SERR "System error while skipping in ShaDa file: %s"), os_strerror((int)skip_bytes));
|
||||||
os_strerror((int)skip_bytes));
|
|
||||||
return kSDReadStatusReadError;
|
return kSDReadStatusReadError;
|
||||||
} else if (skip_bytes != (ptrdiff_t)offset) {
|
} else if (skip_bytes != (ptrdiff_t)offset) {
|
||||||
assert(skip_bytes < (ptrdiff_t)offset);
|
assert(skip_bytes < (ptrdiff_t)offset);
|
||||||
if (file_eof(sd_reader)) {
|
if (file_eof(sd_reader)) {
|
||||||
semsg(_(RCERR "Error while reading ShaDa file: "
|
semsg(_(RCERR "Reading ShaDa file: last entry specified that it occupies %" PRIu64 " bytes, "
|
||||||
"last entry specified that it occupies %" PRIu64 " bytes, "
|
|
||||||
"but file ended earlier"),
|
"but file ended earlier"),
|
||||||
(uint64_t)offset);
|
(uint64_t)offset);
|
||||||
} else {
|
} else {
|
||||||
semsg(_(SERR "System error while skipping in ShaDa file: %s"),
|
semsg(_(SERR "System error while skipping in ShaDa file: %s"), _("too few bytes read"));
|
||||||
_("too few bytes read"));
|
|
||||||
}
|
}
|
||||||
return kSDReadStatusNotShaDa;
|
return kSDReadStatusNotShaDa;
|
||||||
}
|
}
|
||||||
|
@@ -689,7 +689,7 @@ describe('nvim_create_user_command', function()
|
|||||||
})
|
})
|
||||||
]])
|
]])
|
||||||
feed(':Test <Tab>')
|
feed(':Test <Tab>')
|
||||||
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())
|
eq('Test ', fn.getcmdline())
|
||||||
assert_alive()
|
assert_alive()
|
||||||
end)
|
end)
|
||||||
|
@@ -222,7 +222,7 @@ describe('server -> client', function()
|
|||||||
|
|
||||||
it('returns an error if the request failed', function()
|
it('returns an error if the request failed', function()
|
||||||
eq(
|
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')")
|
pcall_err(eval, "rpcrequest(vim, 'does-not-exist')")
|
||||||
)
|
)
|
||||||
end)
|
end)
|
||||||
|
@@ -768,26 +768,13 @@ describe('API', function()
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
it('reports errors', function()
|
it('reports errors', function()
|
||||||
eq(
|
eq([['=' expected near '+']], pcall_err(api.nvim_exec_lua, 'a+*b', {}))
|
||||||
[[Error loading lua: [string "<nvim>"]:0: '=' expected near '+']],
|
eq([[unexpected symbol near '1']], pcall_err(api.nvim_exec_lua, '1+2', {}))
|
||||||
pcall_err(api.nvim_exec_lua, 'a+*b', {})
|
eq([[unexpected symbol]], pcall_err(api.nvim_exec_lua, 'aa=bb\0', {}))
|
||||||
)
|
|
||||||
|
|
||||||
eq(
|
|
||||||
[[Error loading lua: [string "<nvim>"]:0: unexpected symbol near '1']],
|
|
||||||
pcall_err(api.nvim_exec_lua, '1+2', {})
|
|
||||||
)
|
|
||||||
|
|
||||||
eq(
|
|
||||||
[[Error loading lua: [string "<nvim>"]:0: unexpected symbol]],
|
|
||||||
pcall_err(api.nvim_exec_lua, 'aa=bb\0', {})
|
|
||||||
)
|
|
||||||
|
|
||||||
eq(
|
eq(
|
||||||
[[attempt to call global 'bork' (a nil value)]],
|
[[attempt to call global 'bork' (a nil value)]],
|
||||||
pcall_err(api.nvim_exec_lua, 'bork()', {})
|
pcall_err(api.nvim_exec_lua, 'bork()', {})
|
||||||
)
|
)
|
||||||
|
|
||||||
eq('did\nthe\nfail', pcall_err(api.nvim_exec_lua, 'error("did\\nthe\\nfail")', {}))
|
eq('did\nthe\nfail', pcall_err(api.nvim_exec_lua, 'error("did\\nthe\\nfail")', {}))
|
||||||
end)
|
end)
|
||||||
|
|
||||||
@@ -2716,7 +2703,7 @@ describe('API', function()
|
|||||||
eq({ [1] = testinfo, [2] = stderr, [3] = info }, api.nvim_list_chans())
|
eq({ [1] = testinfo, [2] = stderr, [3] = info }, api.nvim_list_chans())
|
||||||
|
|
||||||
eq(
|
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)')
|
pcall_err(eval, 'rpcrequest(3, "nvim_set_current_buf", -1)')
|
||||||
)
|
)
|
||||||
eq(info, eval('rpcrequest(3, "nvim_get_chan_info", 0)'))
|
eq(info, eval('rpcrequest(3, "nvim_get_chan_info", 0)'))
|
||||||
@@ -4690,24 +4677,21 @@ describe('API', function()
|
|||||||
}, api.nvim_parse_cmd('MyCommand test it', {}))
|
}, api.nvim_parse_cmd('MyCommand test it', {}))
|
||||||
end)
|
end)
|
||||||
it('validates command', function()
|
it('validates command', function()
|
||||||
eq('Error while parsing command line', pcall_err(api.nvim_parse_cmd, '', {}))
|
eq('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, '" foo', {}))
|
||||||
eq(
|
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', {})
|
pcall_err(api.nvim_parse_cmd, 'Fubar', {})
|
||||||
)
|
)
|
||||||
command('command! Fubar echo foo')
|
command('command! Fubar echo foo')
|
||||||
|
eq('Parsing command-line: E477: No ! allowed', pcall_err(api.nvim_parse_cmd, 'Fubar!', {}))
|
||||||
eq(
|
eq(
|
||||||
'Error while parsing command line: E477: No ! allowed',
|
'Parsing command-line: E481: No range allowed',
|
||||||
pcall_err(api.nvim_parse_cmd, 'Fubar!', {})
|
|
||||||
)
|
|
||||||
eq(
|
|
||||||
'Error while parsing command line: E481: No range allowed',
|
|
||||||
pcall_err(api.nvim_parse_cmd, '4,6Fubar', {})
|
pcall_err(api.nvim_parse_cmd, '4,6Fubar', {})
|
||||||
)
|
)
|
||||||
command('command! Foobar echo foo')
|
command('command! Foobar echo foo')
|
||||||
eq(
|
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', {})
|
pcall_err(api.nvim_parse_cmd, 'F', {})
|
||||||
)
|
)
|
||||||
end)
|
end)
|
||||||
@@ -4725,7 +4709,7 @@ describe('API', function()
|
|||||||
Entering Ex mode. Type "visual" to go to Normal mode. |
|
Entering Ex mode. Type "visual" to go to Normal mode. |
|
||||||
:1^ |
|
:1^ |
|
||||||
]])
|
]])
|
||||||
eq('Error while parsing command line', pcall_err(api.nvim_parse_cmd, '', {}))
|
eq('Parsing command-line', pcall_err(api.nvim_parse_cmd, '', {}))
|
||||||
feed('<CR>')
|
feed('<CR>')
|
||||||
screen:expect([[
|
screen:expect([[
|
||||||
foo |
|
foo |
|
||||||
@@ -4794,7 +4778,7 @@ describe('API', function()
|
|||||||
end)
|
end)
|
||||||
it('no side-effects (error messages) in pcall() #20339', function()
|
it('no side-effects (error messages) in pcall() #20339', function()
|
||||||
eq(
|
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", {})}]=])
|
exec_lua([=[return {pcall(vim.api.nvim_parse_cmd, "'<,'>n", {})}]=])
|
||||||
)
|
)
|
||||||
eq('', eval('v:errmsg'))
|
eq('', eval('v:errmsg'))
|
||||||
|
@@ -651,7 +651,7 @@ describe('startup', function()
|
|||||||
screen:expect([[
|
screen:expect([[
|
||||||
^ |
|
^ |
|
||||||
|
|
|
|
||||||
Error detected while processing pre-vimrc command line: |
|
Error in pre-vimrc command line: |
|
||||||
E121: Undefined variable: g:bar |
|
E121: Undefined variable: g:bar |
|
||||||
Press ENTER or type command to continue |
|
Press ENTER or type command to continue |
|
||||||
|
|
|
|
||||||
|
@@ -344,7 +344,7 @@ describe('mappings with <Cmd>', function()
|
|||||||
of test text |
|
of test text |
|
||||||
{1:~ }|*2
|
{1:~ }|*2
|
||||||
{7: }|
|
{7: }|
|
||||||
{2:Error detected while processing :} |
|
{2:Error in :} |
|
||||||
{2:E605: Exception not caught: very error} |
|
{2:E605: Exception not caught: very error} |
|
||||||
{3:Press ENTER or type command to continue}^ |
|
{3:Press ENTER or type command to continue}^ |
|
||||||
]])
|
]])
|
||||||
@@ -410,7 +410,7 @@ describe('mappings with <Cmd>', function()
|
|||||||
of test text |
|
of test text |
|
||||||
{1:~ }|*2
|
{1:~ }|*2
|
||||||
{7: }|
|
{7: }|
|
||||||
{2:Error detected while processing :} |
|
{2:Error in :} |
|
||||||
{2:E605: Exception not caught: very error} |
|
{2:E605: Exception not caught: very error} |
|
||||||
{3:Press ENTER or type command to continue}^ |
|
{3:Press ENTER or type command to continue}^ |
|
||||||
]])
|
]])
|
||||||
@@ -433,7 +433,7 @@ describe('mappings with <Cmd>', function()
|
|||||||
of test text |
|
of test text |
|
||||||
{1:~ }|*2
|
{1:~ }|*2
|
||||||
{7: }|
|
{7: }|
|
||||||
{2:Error detected while processing :} |
|
{2:Error in :} |
|
||||||
{2:E605: Exception not caught: very error} |
|
{2:E605: Exception not caught: very error} |
|
||||||
{3:Press ENTER or type command to continue}^ |
|
{3:Press ENTER or type command to continue}^ |
|
||||||
]])
|
]])
|
||||||
@@ -493,7 +493,7 @@ describe('mappings with <Cmd>', function()
|
|||||||
of test text |
|
of test text |
|
||||||
{1:~ }|*2
|
{1:~ }|*2
|
||||||
{7: }|
|
{7: }|
|
||||||
{2:Error detected while processing :} |
|
{2:Error in :} |
|
||||||
{2:E605: Exception not caught: very error} |
|
{2:E605: Exception not caught: very error} |
|
||||||
{3:Press ENTER or type command to continue}^ |
|
{3:Press ENTER or type command to continue}^ |
|
||||||
]])
|
]])
|
||||||
@@ -531,7 +531,7 @@ describe('mappings with <Cmd>', function()
|
|||||||
of test text |
|
of test text |
|
||||||
{1:~ }|*2
|
{1:~ }|*2
|
||||||
{7: }|
|
{7: }|
|
||||||
{2:Error detected while processing :} |
|
{2:Error in :} |
|
||||||
{2:E605: Exception not caught: very error} |
|
{2:E605: Exception not caught: very error} |
|
||||||
{3:Press ENTER or type command to continue}^ |
|
{3:Press ENTER or type command to continue}^ |
|
||||||
]])
|
]])
|
||||||
@@ -640,7 +640,7 @@ describe('mappings with <Cmd>', function()
|
|||||||
{1:~ }|
|
{1:~ }|
|
||||||
{7: }|
|
{7: }|
|
||||||
:echo 2 |
|
:echo 2 |
|
||||||
{2:Error detected while processing :} |
|
{2:Error in :} |
|
||||||
{2:E605: Exception not caught: very error} |
|
{2:E605: Exception not caught: very error} |
|
||||||
:echo 2^ |
|
:echo 2^ |
|
||||||
]])
|
]])
|
||||||
@@ -653,7 +653,7 @@ describe('mappings with <Cmd>', function()
|
|||||||
of test text |
|
of test text |
|
||||||
{7: }|
|
{7: }|
|
||||||
:echo 2 |
|
:echo 2 |
|
||||||
{2:Error detected while processing :} |
|
{2:Error in :} |
|
||||||
{2:E605: Exception not caught: very error} |
|
{2:E605: Exception not caught: very error} |
|
||||||
4 |
|
4 |
|
||||||
{3:Press ENTER or type command to continue}^ |
|
{3:Press ENTER or type command to continue}^ |
|
||||||
|
@@ -193,7 +193,7 @@ describe('Screen', function()
|
|||||||
screen:expect([[
|
screen:expect([[
|
||||||
|
|
|
|
||||||
{3: }|
|
{3: }|
|
||||||
{9:Error detected while processing :} |
|
{9:Error in :} |
|
||||||
{9:E605: Exception not caught: 42} |
|
{9:E605: Exception not caught: 42} |
|
||||||
{6:Press ENTER or type command to continue}^ |
|
{6:Press ENTER or type command to continue}^ |
|
||||||
]])
|
]])
|
||||||
@@ -218,7 +218,7 @@ describe('Screen', function()
|
|||||||
screen:expect([[
|
screen:expect([[
|
||||||
{3: }|
|
{3: }|
|
||||||
:echo "foo |
|
:echo "foo |
|
||||||
{9:Error detected while processing :} |
|
{9:Error in :} |
|
||||||
{9:E605: Exception not caught: 42} |
|
{9:E605: Exception not caught: 42} |
|
||||||
:echo "foo^ |
|
:echo "foo^ |
|
||||||
]])
|
]])
|
||||||
@@ -226,14 +226,14 @@ describe('Screen', function()
|
|||||||
screen:expect([[
|
screen:expect([[
|
||||||
{3: }|
|
{3: }|
|
||||||
:echo "foo |
|
:echo "foo |
|
||||||
{9:Error detected while processing :} |
|
{9:Error in :} |
|
||||||
{9:E605: Exception not caught: 42} |
|
{9:E605: Exception not caught: 42} |
|
||||||
:echo "foo"^ |
|
:echo "foo"^ |
|
||||||
]])
|
]])
|
||||||
feed('\n')
|
feed('\n')
|
||||||
screen:expect([[
|
screen:expect([[
|
||||||
:echo "foo |
|
:echo "foo |
|
||||||
{9:Error detected while processing :} |
|
{9:Error in :} |
|
||||||
{9:E605: Exception not caught: 42} |
|
{9:E605: Exception not caught: 42} |
|
||||||
foo |
|
foo |
|
||||||
{6:Press ENTER or type command to continue}^ |
|
{6:Press ENTER or type command to continue}^ |
|
||||||
|
@@ -687,7 +687,7 @@ describe('list and dictionary types', function()
|
|||||||
Vim(foldopen):E490:
|
Vim(foldopen):E490:
|
||||||
|
|
||||||
|
|
||||||
Error detected while processing :
|
Error in :
|
||||||
E492: Not an editor command: foobar|catch|let a = matchstr(v:exception,'^[^ ]*')|endtry
|
E492: Not an editor command: foobar|catch|let a = matchstr(v:exception,'^[^ ]*')|endtry
|
||||||
]])
|
]])
|
||||||
end)
|
end)
|
||||||
|
@@ -119,14 +119,14 @@ describe('108', function()
|
|||||||
- undefined vars:
|
- undefined vars:
|
||||||
|
|
||||||
undefined var3 on former level:
|
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:
|
line 3:
|
||||||
E121: Undefined variable: var3
|
E121: Undefined variable: var3
|
||||||
here var3 is defined with "another var":
|
here var3 is defined with "another var":
|
||||||
another var
|
another var
|
||||||
|
|
||||||
undefined var2 on former level
|
undefined var2 on former level
|
||||||
Error detected while processing function Foo[2]..Bar:
|
Error in function Foo[2]..Bar:
|
||||||
line 3:
|
line 3:
|
||||||
E121: Undefined variable: var2
|
E121: Undefined variable: var2
|
||||||
here var2 is defined with 10:
|
here var2 is defined with 10:
|
||||||
|
@@ -303,76 +303,76 @@ describe('luaeval(vim.api.…)', function()
|
|||||||
it('errors out correctly when working with API', function()
|
it('errors out correctly when working with API', function()
|
||||||
-- Conversion errors
|
-- Conversion errors
|
||||||
eq(
|
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})")]]))
|
remove_trace(exc_exec([[call luaeval("vim.api.nvim__id({1, foo=42})")]]))
|
||||||
)
|
)
|
||||||
-- Errors in number of arguments
|
-- Errors in number of arguments
|
||||||
eq(
|
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()")]]))
|
remove_trace(exc_exec([[call luaeval("vim.api.nvim__id()")]]))
|
||||||
)
|
)
|
||||||
eq(
|
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)")]]))
|
remove_trace(exc_exec([[call luaeval("vim.api.nvim__id(1, 2)")]]))
|
||||||
)
|
)
|
||||||
eq(
|
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)")]]))
|
remove_trace(exc_exec([[call luaeval("vim.api.nvim_set_var(1, 2, 3)")]]))
|
||||||
)
|
)
|
||||||
-- Error in argument types
|
-- Error in argument types
|
||||||
eq(
|
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)")]]))
|
remove_trace(exc_exec([[call luaeval("vim.api.nvim_set_var(1, 2)")]]))
|
||||||
)
|
)
|
||||||
|
|
||||||
eq(
|
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)")]]))
|
remove_trace(exc_exec([[call luaeval("vim.api.nvim_buf_get_lines(0, 'test', 1, false)")]]))
|
||||||
)
|
)
|
||||||
eq(
|
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)")]]))
|
remove_trace(exc_exec([[call luaeval("vim.api.nvim_buf_get_lines(0, 1.5, 1, false)")]]))
|
||||||
)
|
)
|
||||||
eq(
|
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)")]]))
|
remove_trace(exc_exec([[call luaeval("vim.api.nvim_win_is_valid(nil)")]]))
|
||||||
)
|
)
|
||||||
|
|
||||||
eq(
|
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')")]]))
|
remove_trace(exc_exec([[call luaeval("vim.api.nvim__id_float('test')")]]))
|
||||||
)
|
)
|
||||||
eq(
|
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(
|
remove_trace(
|
||||||
exc_exec([[call luaeval("vim.api.nvim__id_float({[vim.type_idx]=vim.types.dictionary})")]])
|
exc_exec([[call luaeval("vim.api.nvim__id_float({[vim.type_idx]=vim.types.dictionary})")]])
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
eq(
|
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)")]]))
|
remove_trace(exc_exec([[call luaeval("vim.api.nvim__id_array(1)")]]))
|
||||||
)
|
)
|
||||||
eq(
|
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(
|
remove_trace(
|
||||||
exc_exec([[call luaeval("vim.api.nvim__id_array({[vim.type_idx]=vim.types.dictionary})")]])
|
exc_exec([[call luaeval("vim.api.nvim__id_array({[vim.type_idx]=vim.types.dictionary})")]])
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
eq(
|
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)")]]))
|
remove_trace(exc_exec([[call luaeval("vim.api.nvim__id_dict(1)")]]))
|
||||||
)
|
)
|
||||||
eq(
|
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(
|
remove_trace(
|
||||||
exc_exec([[call luaeval("vim.api.nvim__id_dict({[vim.type_idx]=vim.types.array})")]])
|
exc_exec([[call luaeval("vim.api.nvim__id_dict({[vim.type_idx]=vim.types.array})")]])
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
eq(
|
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('', '', '', '')")]]))
|
remove_trace(exc_exec([[call luaeval("vim.api.nvim_set_keymap('', '', '', '')")]]))
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@@ -59,22 +59,22 @@ describe(':lua', function()
|
|||||||
it('throws catchable errors', function()
|
it('throws catchable errors', function()
|
||||||
eq('Vim(lua):E471: Argument required', pcall_err(command, 'lua'))
|
eq('Vim(lua):E471: Argument required', pcall_err(command, 'lua'))
|
||||||
eq(
|
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 ()')
|
pcall_err(command, 'lua ()')
|
||||||
)
|
)
|
||||||
eq(
|
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")'))
|
remove_trace(exc_exec('lua error("TEST")'))
|
||||||
)
|
)
|
||||||
eq(
|
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"})'))
|
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))
|
eq({ '' }, api.nvim_buf_get_lines(0, 0, 100, false))
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('works with NULL errors', function()
|
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)
|
end)
|
||||||
|
|
||||||
it('accepts embedded NLs without heredoc', function()
|
it('accepts embedded NLs without heredoc', function()
|
||||||
@@ -100,7 +100,7 @@ describe(':lua', function()
|
|||||||
local s = ('x'):rep(100500)
|
local s = ('x'):rep(100500)
|
||||||
|
|
||||||
eq(
|
eq(
|
||||||
'Vim(lua):E5107: Error loading lua [string ":lua"]:0: unfinished string near \'<eof>\'',
|
'Vim(lua):E5107: Lua: [string ":lua"]:0: unfinished string near \'<eof>\'',
|
||||||
pcall_err(command, ('lua vim.api.nvim_buf_set_lines(1, 1, 2, false, {"%s})'):format(s))
|
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))
|
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")<cr>')
|
feed(':lua error("fail\\nmuch error\\nsuch details")<cr>')
|
||||||
screen:expect {
|
screen:expect([[
|
||||||
grid = [[
|
|
|
||||||
{2: }|
|
{2: }|
|
||||||
{3:E5108: Error executing lua [string ":lua}|
|
{3:E5108: Lua: [string ":lua"]:1: fail} |
|
||||||
{3:"]:1: fail} |
|
|
||||||
{3:much error} |
|
{3:much error} |
|
||||||
{3:such details} |
|
{3:such details} |
|
||||||
{3:stack traceback:} |
|
{3:stack traceback:} |
|
||||||
@@ -131,8 +130,7 @@ describe(':lua', function()
|
|||||||
{3: [string ":lua"]:1: in main chunk}|
|
{3: [string ":lua"]:1: in main chunk}|
|
||||||
|
|
|
|
||||||
{4:Press ENTER or type command to continue}^ |
|
{4:Press ENTER or type command to continue}^ |
|
||||||
]],
|
]])
|
||||||
}
|
|
||||||
feed('<cr>')
|
feed('<cr>')
|
||||||
screen:expect {
|
screen:expect {
|
||||||
grid = [[
|
grid = [[
|
||||||
@@ -142,22 +140,20 @@ describe(':lua', function()
|
|||||||
]],
|
]],
|
||||||
}
|
}
|
||||||
eq(
|
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'))
|
remove_trace(eval('v:errmsg'))
|
||||||
)
|
)
|
||||||
|
|
||||||
local status, err = pcall(command, 'lua error("some error\\nin a\\nAPI command")')
|
local status, err = pcall(command, 'lua error("some error\\nin a\\nAPI command")')
|
||||||
local expected =
|
local expected = 'Vim(lua):E5108: Lua: [string ":lua"]:1: some error\nin a\nAPI command'
|
||||||
'Vim(lua):E5108: Error executing lua [string ":lua"]:1: some error\nin a\nAPI command'
|
|
||||||
eq(false, status)
|
eq(false, status)
|
||||||
eq(expected, string.sub(remove_trace(err), -string.len(expected)))
|
eq(expected, string.sub(remove_trace(err), -string.len(expected)))
|
||||||
|
|
||||||
feed(':messages<cr>')
|
feed(':messages<cr>')
|
||||||
screen:expect {
|
screen:expect([[
|
||||||
grid = [[
|
|
|
||||||
{2: }|
|
{2: }|
|
||||||
{3:E5108: Error executing lua [string ":lua}|
|
{3:E5108: Lua: [string ":lua"]:1: fail} |
|
||||||
{3:"]:1: fail} |
|
|
||||||
{3:much error} |
|
{3:much error} |
|
||||||
{3:such details} |
|
{3:such details} |
|
||||||
{3:stack traceback:} |
|
{3:stack traceback:} |
|
||||||
@@ -165,8 +161,7 @@ describe(':lua', function()
|
|||||||
{3: [string ":lua"]:1: in main chunk}|
|
{3: [string ":lua"]:1: in main chunk}|
|
||||||
|
|
|
|
||||||
{4:Press ENTER or type command to continue}^ |
|
{4:Press ENTER or type command to continue}^ |
|
||||||
]],
|
]])
|
||||||
}
|
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('prints result of =expr', function()
|
it('prints result of =expr', function()
|
||||||
@@ -212,7 +207,7 @@ describe(':lua', function()
|
|||||||
|
|
||||||
-- ":{range}lua" fails on invalid Lua code.
|
-- ":{range}lua" fails on invalid Lua code.
|
||||||
eq(
|
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 '<eof>']],
|
.. [[[string ":{range}lua buffer=1"]:0: '=' expected near '<eof>']],
|
||||||
pcall_err(command, '1lua')
|
pcall_err(command, '1lua')
|
||||||
)
|
)
|
||||||
@@ -279,17 +274,17 @@ describe(':luado command', function()
|
|||||||
|
|
||||||
it('fails on errors', function()
|
it('fails on errors', function()
|
||||||
eq(
|
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 ()')
|
pcall_err(command, 'luado ()')
|
||||||
)
|
)
|
||||||
eq(
|
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')
|
pcall_err(command, 'luado return liness + 1')
|
||||||
)
|
)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('works with NULL errors', function()
|
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)
|
end)
|
||||||
|
|
||||||
it('fails in sandbox when needed', function()
|
it('fails in sandbox when needed', function()
|
||||||
@@ -305,7 +300,7 @@ describe(':luado command', function()
|
|||||||
local s = ('x'):rep(100500)
|
local s = ('x'):rep(100500)
|
||||||
|
|
||||||
eq(
|
eq(
|
||||||
'Vim(luado):E5109: Error loading lua: [string ":luado"]:0: unfinished string near \'<eof>\'',
|
'Vim(luado):E5109: Lua: [string ":luado"]:0: unfinished string near \'<eof>\'',
|
||||||
pcall_err(command, ('luado return "%s'):format(s))
|
pcall_err(command, ('luado return "%s'):format(s))
|
||||||
)
|
)
|
||||||
eq({ '' }, api.nvim_buf_get_lines(0, 0, -1, false))
|
eq({ '' }, api.nvim_buf_get_lines(0, 0, -1, false))
|
||||||
@@ -338,14 +333,12 @@ describe(':luafile', function()
|
|||||||
it('correctly errors out', function()
|
it('correctly errors out', function()
|
||||||
write_file(fname, '()')
|
write_file(fname, '()')
|
||||||
eq(
|
eq(
|
||||||
("Vim(luafile):E5112: Error while creating lua chunk: %s:1: unexpected symbol near ')'"):format(
|
("Vim(luafile):E5112: Lua chunk: %s:1: unexpected symbol near ')'"):format(fname),
|
||||||
fname
|
|
||||||
),
|
|
||||||
exc_exec('luafile ' .. fname)
|
exc_exec('luafile ' .. fname)
|
||||||
)
|
)
|
||||||
write_file(fname, 'vimm.api.nvim_buf_set_lines(1, 1, 2, false, {"ETTS"})')
|
write_file(fname, 'vimm.api.nvim_buf_set_lines(1, 1, 2, false, {"ETTS"})')
|
||||||
eq(
|
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
|
fname
|
||||||
),
|
),
|
||||||
remove_trace(exc_exec('luafile ' .. fname))
|
remove_trace(exc_exec('luafile ' .. fname))
|
||||||
@@ -354,9 +347,6 @@ describe(':luafile', function()
|
|||||||
|
|
||||||
it('works with NULL errors', function()
|
it('works with NULL errors', function()
|
||||||
write_file(fname, 'error(nil)')
|
write_file(fname, 'error(nil)')
|
||||||
eq(
|
eq([=[Vim(luafile):E5113: Lua chunk: [NULL]]=], exc_exec('luafile ' .. fname))
|
||||||
[=[Vim(luafile):E5113: Error while calling lua chunk: [NULL]]=],
|
|
||||||
exc_exec('luafile ' .. fname)
|
|
||||||
)
|
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
@@ -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",
|
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}")'))
|
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")'))
|
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)()")'))
|
exc_exec('call luaeval("(nil)()")'))
|
||||||
|
|
||||||
end)
|
end)
|
||||||
@@ -428,18 +428,18 @@ describe('luaeval()', function()
|
|||||||
|
|
||||||
it('errors out correctly when doing incorrect things in lua', function()
|
it('errors out correctly when doing incorrect things in lua', function()
|
||||||
-- Conversion errors
|
-- 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()")]])))
|
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')")]])))
|
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)")]])))
|
remove_trace(exc_exec([[call luaeval("error(nil)")]])))
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('does not leak memory when called with too long line',
|
it('does not leak memory when called with too long line',
|
||||||
function()
|
function()
|
||||||
local s = ('x'):rep(65536)
|
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 ..[[' + )")]]))
|
exc_exec([[call luaeval("(']] .. s ..[[' + )")]]))
|
||||||
eq(s, fn.luaeval('"' .. s .. '"'))
|
eq(s, fn.luaeval('"' .. s .. '"'))
|
||||||
end)
|
end)
|
||||||
@@ -482,7 +482,7 @@ describe('v:lua', function()
|
|||||||
eq("string: abc", eval('v:lua.mymod.whatis(0z616263)'))
|
eq("string: abc", eval('v:lua.mymod.whatis(0z616263)'))
|
||||||
eq("string: ", eval('v:lua.mymod.whatis(v:_null_blob)'))
|
eq("string: ", eval('v:lua.mymod.whatis(v:_null_blob)'))
|
||||||
|
|
||||||
eq("Vim:E5108: Error executing lua [string \"<nvim>\"]:0: attempt to call global 'nonexistent' (a nil value)",
|
eq("Vim:E5108: Lua: [string \"<nvim>\"]:0: attempt to call global 'nonexistent' (a nil value)",
|
||||||
pcall_err(eval, 'v:lua.mymod.crashy()'))
|
pcall_err(eval, 'v:lua.mymod.crashy()'))
|
||||||
end)
|
end)
|
||||||
|
|
||||||
@@ -497,14 +497,14 @@ describe('v:lua', function()
|
|||||||
eq("hey there", api.nvim_get_current_line())
|
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({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 \"<nvim>\"]:0: attempt to call global 'nonexistent' (a nil value)",
|
eq("Vim:E5108: Lua: [string \"<nvim>\"]:0: attempt to call global 'nonexistent' (a nil value)",
|
||||||
pcall_err(eval, '"huh?"->v:lua.mymod.crashy()'))
|
pcall_err(eval, '"huh?"->v:lua.mymod.crashy()'))
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('works in :call', function()
|
it('works in :call', function()
|
||||||
command(":call v:lua.mymod.noisy('command')")
|
command(":call v:lua.mymod.noisy('command')")
|
||||||
eq("hey command", api.nvim_get_current_line())
|
eq("hey command", api.nvim_get_current_line())
|
||||||
eq("Vim(call):E5108: Error executing lua [string \"<nvim>\"]:0: attempt to call global 'nonexistent' (a nil value)",
|
eq("Vim(call):E5108: Lua: [string \"<nvim>\"]:0: attempt to call global 'nonexistent' (a nil value)",
|
||||||
pcall_err(command, 'call v:lua.mymod.crashy()'))
|
pcall_err(command, 'call v:lua.mymod.crashy()'))
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
@@ -57,15 +57,15 @@ describe('print', function()
|
|||||||
eq('', exec_capture('luafile ' .. fname))
|
eq('', exec_capture('luafile ' .. fname))
|
||||||
-- TODO(bfredl): these look weird, print() should not use "E5114:" style errors..
|
-- TODO(bfredl): these look weird, print() should not use "E5114:" style errors..
|
||||||
eq(
|
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")')
|
pcall_err(command, 'lua print("foo", v_nilerr, "bar")')
|
||||||
)
|
)
|
||||||
eq(
|
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")')
|
pcall_err(command, 'lua print("foo", v_abcerr, "bar")')
|
||||||
)
|
)
|
||||||
eq(
|
eq(
|
||||||
'Vim(lua):E5108: Error executing lua E5114: Error while converting print argument #2: <Unknown error: lua_tolstring returned NULL for tostring result>',
|
'Vim(lua):E5108: Lua: E5114: Converting print argument #2: <Unknown error: lua_tolstring returned NULL for tostring result>',
|
||||||
pcall_err(command, 'lua print("foo", v_tblout, "bar")')
|
pcall_err(command, 'lua print("foo", v_tblout, "bar")')
|
||||||
)
|
)
|
||||||
end)
|
end)
|
||||||
@@ -98,20 +98,20 @@ describe('print', function()
|
|||||||
)
|
)
|
||||||
eq('', exec_capture('luafile ' .. fname))
|
eq('', exec_capture('luafile ' .. fname))
|
||||||
eq(
|
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()')
|
pcall_err(command, 'lua string_error()')
|
||||||
)
|
)
|
||||||
eq(
|
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()')
|
pcall_err(command, 'lua number_error()')
|
||||||
)
|
)
|
||||||
eq('Vim(lua):E5108: Error executing lua [NULL]', pcall_err(command, 'lua nil_error()'))
|
eq('Vim(lua):E5108: 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 table_error()'))
|
||||||
eq(
|
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()')
|
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)
|
end)
|
||||||
it('prints strings with NULs and NLs correctly', function()
|
it('prints strings with NULs and NLs correctly', function()
|
||||||
api.nvim_set_option_value('more', true, {})
|
api.nvim_set_option_value('more', true, {})
|
||||||
@@ -232,8 +232,7 @@ describe('debug.debug', function()
|
|||||||
lua_debug> ^ |
|
lua_debug> ^ |
|
||||||
]])
|
]])
|
||||||
feed('<C-c>')
|
feed('<C-c>')
|
||||||
screen:expect {
|
screen:expect([[
|
||||||
grid = [[
|
|
||||||
|
|
|
|
||||||
{0:~ }|*2
|
{0:~ }|*2
|
||||||
{1: }|
|
{1: }|
|
||||||
@@ -241,14 +240,13 @@ describe('debug.debug', function()
|
|||||||
lua_debug> print("TEST") |
|
lua_debug> print("TEST") |
|
||||||
TEST |
|
TEST |
|
||||||
|
|
|
|
||||||
{E:E5108: Error executing lua [string ":lua"]:5: attempt}|
|
{E:E5108: Lua: [string ":lua"]:5: attempt to perform ari}|
|
||||||
{E: to perform arithmetic on local 'a' (a nil value)} |
|
{E:thmetic on local 'a' (a nil value)} |
|
||||||
{E:stack traceback:} |
|
{E:stack traceback:} |
|
||||||
{E: [string ":lua"]:5: in function 'Test'} |
|
{E: [string ":lua"]:5: in function 'Test'} |
|
||||||
{E: [string ":lua"]:1: in main chunk} |
|
{E: [string ":lua"]:1: in main chunk} |
|
||||||
Interrupt: {cr:Press ENTER or type command to continue}^ |
|
Interrupt: {cr:Press ENTER or type command to continue}^ |
|
||||||
]],
|
]])
|
||||||
}
|
|
||||||
feed('<C-l>:lua Test()\n')
|
feed('<C-l>:lua Test()\n')
|
||||||
screen:expect([[
|
screen:expect([[
|
||||||
|
|
|
|
||||||
@@ -258,21 +256,19 @@ describe('debug.debug', function()
|
|||||||
lua_debug> ^ |
|
lua_debug> ^ |
|
||||||
]])
|
]])
|
||||||
feed('\n')
|
feed('\n')
|
||||||
screen:expect {
|
screen:expect([[
|
||||||
grid = [[
|
|
||||||
|
|
|
|
||||||
{0:~ }|*4
|
{0:~ }|*4
|
||||||
{1: }|
|
{1: }|
|
||||||
nil |
|
nil |
|
||||||
lua_debug> |
|
lua_debug> |
|
||||||
{E:E5108: Error executing lua [string ":lua"]:5: attempt}|
|
{E:E5108: Lua: [string ":lua"]:5: attempt to perform ari}|
|
||||||
{E: to perform arithmetic on local 'a' (a nil value)} |
|
{E:thmetic on local 'a' (a nil value)} |
|
||||||
{E:stack traceback:} |
|
{E:stack traceback:} |
|
||||||
{E: [string ":lua"]:5: in function 'Test'} |
|
{E: [string ":lua"]:5: in function 'Test'} |
|
||||||
{E: [string ":lua"]:1: in main chunk} |
|
{E: [string ":lua"]:1: in main chunk} |
|
||||||
{cr:Press ENTER or type command to continue}^ |
|
{cr:Press ENTER or type command to continue}^ |
|
||||||
]],
|
]])
|
||||||
}
|
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it("can be safely exited with 'cont'", function()
|
it("can be safely exited with 'cont'", function()
|
||||||
@@ -287,32 +283,28 @@ describe('debug.debug', function()
|
|||||||
}
|
}
|
||||||
|
|
||||||
feed('conttt<cr>') -- misspelled cont; invalid syntax
|
feed('conttt<cr>') -- misspelled cont; invalid syntax
|
||||||
screen:expect {
|
screen:expect([[
|
||||||
grid = [[
|
|
||||||
|
|
|
|
||||||
{0:~ }|*8
|
{0:~ }|*8
|
||||||
{1: }|
|
{1: }|
|
||||||
lua_debug> conttt |
|
lua_debug> conttt |
|
||||||
{E:E5115: Error while loading debug string: (debug comma}|
|
{E:E5115: Loading Lua debug string: (debug command):1: '}|
|
||||||
{E:nd):1: '=' expected near '<eof>'} |
|
{E:=' expected near '<eof>'} |
|
||||||
lua_debug> ^ |
|
lua_debug> ^ |
|
||||||
]],
|
]])
|
||||||
}
|
|
||||||
|
|
||||||
feed('cont<cr>') -- exactly "cont", exit now
|
feed('cont<cr>') -- exactly "cont", exit now
|
||||||
screen:expect {
|
screen:expect([[
|
||||||
grid = [[
|
|
||||||
|
|
|
|
||||||
{0:~ }|*6
|
{0:~ }|*6
|
||||||
{1: }|
|
{1: }|
|
||||||
lua_debug> conttt |
|
lua_debug> conttt |
|
||||||
{E:E5115: Error while loading debug string: (debug comma}|
|
{E:E5115: Loading Lua debug string: (debug command):1: '}|
|
||||||
{E:nd):1: '=' expected near '<eof>'} |
|
{E:=' expected near '<eof>'} |
|
||||||
lua_debug> cont |
|
lua_debug> cont |
|
||||||
x |
|
x |
|
||||||
{cr:Press ENTER or type command to continue}^ |
|
{cr:Press ENTER or type command to continue}^ |
|
||||||
]],
|
]])
|
||||||
}
|
|
||||||
|
|
||||||
feed('<cr>')
|
feed('<cr>')
|
||||||
screen:expect {
|
screen:expect {
|
||||||
|
@@ -31,7 +31,7 @@ describe('thread', function()
|
|||||||
|
|
|
|
||||||
{1:~ }|*5
|
{1:~ }|*5
|
||||||
{3: }|
|
{3: }|
|
||||||
{9:Error in luv thread:} |
|
{9:Luv thread:} |
|
||||||
{9:[NULL]} |
|
{9:[NULL]} |
|
||||||
{6:Press ENTER or type command to continue}^ |
|
{6:Press ENTER or type command to continue}^ |
|
||||||
]])
|
]])
|
||||||
@@ -51,7 +51,7 @@ describe('thread', function()
|
|||||||
|
|
|
|
||||||
{1:~ }|*5
|
{1:~ }|*5
|
||||||
{3: }|
|
{3: }|
|
||||||
{9:Error in luv thread:} |
|
{9:Luv thread:} |
|
||||||
{9:[string "<nvim>"]:2: Error in thread entry func} |
|
{9:[string "<nvim>"]:2: Error in thread entry func} |
|
||||||
{6:Press ENTER or type command to continue}^ |
|
{6:Press ENTER or type command to continue}^ |
|
||||||
]])
|
]])
|
||||||
@@ -78,7 +78,7 @@ describe('thread', function()
|
|||||||
|
|
|
|
||||||
{1:~ }|*5
|
{1:~ }|*5
|
||||||
{3: }|
|
{3: }|
|
||||||
{9:Error in luv callback, thread:} |
|
{9:Luv callback, thread:} |
|
||||||
{9:[string "<nvim>"]:6: Error in thread callback} |
|
{9:[string "<nvim>"]:6: Error in thread callback} |
|
||||||
{6:Press ENTER or type command to continue}^ |
|
{6:Press ENTER or type command to continue}^ |
|
||||||
]])
|
]])
|
||||||
@@ -286,7 +286,7 @@ describe('threadpool', function()
|
|||||||
|
|
|
|
||||||
{1:~ }|*5
|
{1:~ }|*5
|
||||||
{3: }|
|
{3: }|
|
||||||
{9:Error in luv thread:} |
|
{9:Luv thread:} |
|
||||||
{9:Error: thread arg not support type 'table' at 1} |
|
{9:Error: thread arg not support type 'table' at 1} |
|
||||||
{6:Press ENTER or type command to continue}^ |
|
{6:Press ENTER or type command to continue}^ |
|
||||||
]])
|
]])
|
||||||
|
@@ -427,14 +427,17 @@ describe('vim.ui_attach', function()
|
|||||||
os.remove(testlog)
|
os.remove(testlog)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('error in callback is logged', function()
|
it('callback error is logged', function()
|
||||||
exec_lua([[
|
exec_lua([[
|
||||||
local ns = vim.api.nvim_create_namespace('test')
|
local ns = vim.api.nvim_create_namespace('test')
|
||||||
vim.ui_attach(ns, { ext_popupmenu = true }, function() error(42) end)
|
vim.ui_attach(ns, { ext_popupmenu = true }, function() error(42) end)
|
||||||
]])
|
]])
|
||||||
feed('ifoo<CR>foobar<CR>fo<C-X><C-N>')
|
feed('ifoo<CR>foobar<CR>fo<C-X><C-N>')
|
||||||
assert_log('Error in "popupmenu_show" UI event handler %(ns=test%):', testlog, 100)
|
assert_log(
|
||||||
assert_log('Error executing lua: .*: 42', testlog, 100)
|
'Error in "popupmenu_show" UI event handler %(ns=test%):[\r\n\t ]+Lua: .*: 42',
|
||||||
|
testlog,
|
||||||
|
100
|
||||||
|
)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('detaches after excessive errors', function()
|
it('detaches after excessive errors', function()
|
||||||
@@ -464,7 +467,7 @@ describe('vim.ui_attach', function()
|
|||||||
{
|
{
|
||||||
content = {
|
content = {
|
||||||
{
|
{
|
||||||
'Error executing callback:\n[string "<nvim>"]:3: attempt to index global \'err\' (a nil value)\nstack traceback:\n\t[string "<nvim>"]:3: in function <[string "<nvim>"]:1>',
|
'Lua callback:\n[string "<nvim>"]:3: attempt to index global \'err\' (a nil value)\nstack traceback:\n\t[string "<nvim>"]:3: in function <[string "<nvim>"]:1>',
|
||||||
9,
|
9,
|
||||||
6,
|
6,
|
||||||
},
|
},
|
||||||
@@ -482,11 +485,11 @@ describe('vim.ui_attach', function()
|
|||||||
feed('<CR>:messages<CR>')
|
feed('<CR>:messages<CR>')
|
||||||
screen:expect([[
|
screen:expect([[
|
||||||
{9:Error in "msg_show" UI event handler (ns=(UNKNOWN PLUGIN)):} |
|
{9:Error in "msg_show" UI event handler (ns=(UNKNOWN PLUGIN)):} |
|
||||||
{9:Error executing lua: [string "<nvim>"]:3: attempt to index global 'err' (a nil value)} |
|
{9:Lua: [string "<nvim>"]:3: attempt to index global 'err' (a nil value)} |
|
||||||
{9:stack traceback:} |
|
{9:stack traceback:} |
|
||||||
{9: [string "<nvim>"]:3: in function <[string "<nvim>"]:1>} |
|
{9: [string "<nvim>"]:3: in function <[string "<nvim>"]:1>} |
|
||||||
{9:Error in "msg_clear" UI event handler (ns=(UNKNOWN PLUGIN)):} |
|
{9:Error in "msg_clear" UI event handler (ns=(UNKNOWN PLUGIN)):} |
|
||||||
{9:Error executing lua: [string "<nvim>"]:3: attempt to index global 'err' (a nil value)} |
|
{9:Lua: [string "<nvim>"]:3: attempt to index global 'err' (a nil value)} |
|
||||||
{9:stack traceback:} |
|
{9:stack traceback:} |
|
||||||
{9: [string "<nvim>"]:3: in function <[string "<nvim>"]:1>} |
|
{9: [string "<nvim>"]:3: in function <[string "<nvim>"]:1>} |
|
||||||
{9:Excessive errors in vim.ui_attach() callback (ns=(UNKNOWN PLUGIN))} |
|
{9:Excessive errors in vim.ui_attach() callback (ns=(UNKNOWN PLUGIN))} |
|
||||||
@@ -506,7 +509,7 @@ describe('vim.ui_attach', function()
|
|||||||
{
|
{
|
||||||
content = {
|
content = {
|
||||||
{
|
{
|
||||||
'Error executing vim.schedule lua callback: [string "<nvim>"]:2: attempt to index global \'err\' (a nil value)\nstack traceback:\n\t[string "<nvim>"]:2: in function <[string "<nvim>"]:2>',
|
'vim.schedule callback: [string "<nvim>"]:2: attempt to index global \'err\' (a nil value)\nstack traceback:\n\t[string "<nvim>"]:2: in function <[string "<nvim>"]:2>',
|
||||||
9,
|
9,
|
||||||
6,
|
6,
|
||||||
},
|
},
|
||||||
@@ -517,7 +520,7 @@ describe('vim.ui_attach', function()
|
|||||||
{
|
{
|
||||||
content = {
|
content = {
|
||||||
{
|
{
|
||||||
'Error executing vim.schedule lua callback: [string "<nvim>"]:2: attempt to index global \'err\' (a nil value)\nstack traceback:\n\t[string "<nvim>"]:2: in function <[string "<nvim>"]:2>',
|
'vim.schedule callback: [string "<nvim>"]:2: attempt to index global \'err\' (a nil value)\nstack traceback:\n\t[string "<nvim>"]:2: in function <[string "<nvim>"]:2>',
|
||||||
9,
|
9,
|
||||||
6,
|
6,
|
||||||
},
|
},
|
||||||
|
@@ -87,7 +87,7 @@ describe('vim.uv', function()
|
|||||||
screen:expect([[
|
screen:expect([[
|
||||||
|
|
|
|
||||||
{2: }|
|
{2: }|
|
||||||
{3:Error executing callback:} |
|
{3:Lua callback:} |
|
||||||
{3:[string "<nvim>"]:5: E5560: nvim_set_var must not }|
|
{3:[string "<nvim>"]:5: E5560: nvim_set_var must not }|
|
||||||
{3:be called in a fast event context} |
|
{3:be called in a fast event context} |
|
||||||
{3:stack traceback:} |
|
{3:stack traceback:} |
|
||||||
@@ -173,7 +173,7 @@ describe('vim.uv', function()
|
|||||||
|
|
|
|
||||||
{1:~ }|*5
|
{1:~ }|*5
|
||||||
{3: }|
|
{3: }|
|
||||||
{9:Error executing callback:} |
|
{9:Lua callback:} |
|
||||||
{9:[NULL]} |
|
{9:[NULL]} |
|
||||||
{6:Press ENTER or type command to continue}^ |
|
{6:Press ENTER or type command to continue}^ |
|
||||||
]]
|
]]
|
||||||
@@ -208,7 +208,7 @@ describe('vim.uv', function()
|
|||||||
|
|
||||||
screen:expect([[
|
screen:expect([[
|
||||||
{3: }|
|
{3: }|
|
||||||
{9:Error executing callback:} |
|
{9:Lua callback:} |
|
||||||
{9:[NULL]} |
|
{9:[NULL]} |
|
||||||
{6:Press ENTER or type command to continue}^ |
|
{6:Press ENTER or type command to continue}^ |
|
||||||
]])
|
]])
|
||||||
@@ -232,7 +232,7 @@ describe('vim.uv', function()
|
|||||||
|
|
||||||
screen:expect([[
|
screen:expect([[
|
||||||
{3: }|
|
{3: }|
|
||||||
{9:Error executing callback:} |
|
{9:Lua callback:} |
|
||||||
{9:uv_idle_t: 0x{MATCH:%w+}}{MATCH: +}|
|
{9:uv_idle_t: 0x{MATCH:%w+}}{MATCH: +}|
|
||||||
{6:Press ENTER or type command to continue}^ |
|
{6:Press ENTER or type command to continue}^ |
|
||||||
]])
|
]])
|
@@ -3376,7 +3376,7 @@ describe('lua stdlib', function()
|
|||||||
local errmsg = api.nvim_get_vvar('errmsg')
|
local errmsg = api.nvim_get_vvar('errmsg')
|
||||||
matches(
|
matches(
|
||||||
[[
|
[[
|
||||||
^Error executing vim%.on%_key%(%) callbacks:.*
|
^vim%.on%_key%(%) callbacks:.*
|
||||||
With ns%_id %d+: .*: Dumb Error
|
With ns%_id %d+: .*: Dumb Error
|
||||||
stack traceback:
|
stack traceback:
|
||||||
.*: in function 'error'
|
.*: in function 'error'
|
||||||
@@ -3506,19 +3506,13 @@ stack traceback:
|
|||||||
|
|
||||||
api.nvim_buf_set_lines(0, 0, -1, true, { '54321' })
|
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')
|
feed('x')
|
||||||
eq(1, exec_lua [[ return n_call ]])
|
eq(1, exec_lua [[ return n_call ]])
|
||||||
|
|
||||||
eq(1, exec_lua [[ return vim.on_key(nil, nil) ]])
|
eq(1, exec_lua [[ return vim.on_key(nil, nil) ]])
|
||||||
|
eq('', eval('v:errmsg'))
|
||||||
eq('', cleanup_msg(eval('v:errmsg')))
|
|
||||||
feed('x')
|
feed('x')
|
||||||
eq(2, exec_lua [[ return n_call ]])
|
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 = ""')
|
command('let v:errmsg = ""')
|
||||||
|
|
||||||
eq(0, exec_lua [[ return vim.on_key(nil, nil) ]])
|
eq(0, exec_lua [[ return vim.on_key(nil, nil) ]])
|
||||||
@@ -3526,7 +3520,7 @@ stack traceback:
|
|||||||
feed('x')
|
feed('x')
|
||||||
eq(2, exec_lua [[ return n_call ]])
|
eq(2, exec_lua [[ return n_call ]])
|
||||||
expect('21')
|
expect('21')
|
||||||
eq('', cleanup_msg(eval('v:errmsg')))
|
eq('', eval('v:errmsg'))
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
@@ -3991,7 +3985,7 @@ stack traceback:
|
|||||||
pcall_err(exec_lua, [[vim.api.nvim_win_call(0, function() vim.cmd 'fooooo' end)]])
|
pcall_err(exec_lua, [[vim.api.nvim_win_call(0, function() vim.cmd 'fooooo' end)]])
|
||||||
)
|
)
|
||||||
eq(
|
eq(
|
||||||
'Error executing lua: [string "<nvim>"]:0: fooooo',
|
'Lua: [string "<nvim>"]:0: fooooo',
|
||||||
pcall_err(exec_lua, [[vim.api.nvim_win_call(0, function() error('fooooo') end)]])
|
pcall_err(exec_lua, [[vim.api.nvim_win_call(0, function() error('fooooo') end)]])
|
||||||
)
|
)
|
||||||
end)
|
end)
|
||||||
|
@@ -1171,7 +1171,11 @@ describe('stdpath()', function()
|
|||||||
set_paths_via_system(env_var_name, paths)
|
set_paths_via_system(env_var_name, paths)
|
||||||
eq(expected_paths, t.fix_slashes(fn.stdpath(stdpath_arg)))
|
eq(expected_paths, t.fix_slashes(fn.stdpath(stdpath_arg)))
|
||||||
if not is_os('win') then
|
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)
|
end)
|
||||||
|
|
||||||
@@ -1179,7 +1183,11 @@ describe('stdpath()', function()
|
|||||||
set_paths_at_runtime(env_var_name, paths)
|
set_paths_at_runtime(env_var_name, paths)
|
||||||
eq(expected_paths, t.fix_slashes(fn.stdpath(stdpath_arg)))
|
eq(expected_paths, t.fix_slashes(fn.stdpath(stdpath_arg)))
|
||||||
if not is_os('win') then
|
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)
|
end)
|
||||||
end)
|
end)
|
||||||
|
@@ -253,9 +253,7 @@ describe(':Man', function()
|
|||||||
matches('^/.+', actual_file)
|
matches('^/.+', actual_file)
|
||||||
local args = { nvim_prog, '--headless', '+:Man ' .. actual_file, '+q' }
|
local args = { nvim_prog, '--headless', '+:Man ' .. actual_file, '+q' }
|
||||||
matches(
|
matches(
|
||||||
('Error detected while processing command line:\r\n' .. 'man.lua: no manual entry for %s'):format(
|
('Error in command line:\r\n' .. 'man.lua: no manual entry for %s'):format(pesc(actual_file)),
|
||||||
pesc(actual_file)
|
|
||||||
),
|
|
||||||
fn.system(args, { '' })
|
fn.system(args, { '' })
|
||||||
)
|
)
|
||||||
os.remove(actual_file)
|
os.remove(actual_file)
|
||||||
|
@@ -65,7 +65,7 @@ describe('python3 provider', function()
|
|||||||
matches(
|
matches(
|
||||||
string.format(
|
string.format(
|
||||||
dedent([[
|
dedent([[
|
||||||
^Error invoking 'python_execute' on channel 3 %%(python3%%-script%%-host%%):
|
^Invoking 'python_execute' on channel 3 %%(python3%%-script%%-host%%):
|
||||||
File "<string>", line 1
|
File "<string>", line 1
|
||||||
print%%(%s b%%)
|
print%%(%s b%%)
|
||||||
%%C*
|
%%C*
|
||||||
|
@@ -660,7 +660,7 @@ $
|
|||||||
it('fails on invalid ShaDa file (failing skip in second item)', function()
|
it('fails on invalid ShaDa file (failing skip in second item)', function()
|
||||||
wshada('\001\000\001\128#!/')
|
wshada('\001\000\001\128#!/')
|
||||||
eq(
|
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())
|
exc_exec(sdrcmd())
|
||||||
)
|
)
|
||||||
eq(
|
eq(
|
||||||
|
@@ -271,23 +271,21 @@ describe('TUI', function()
|
|||||||
{}
|
{}
|
||||||
)
|
)
|
||||||
feed_data(':call ManyErr()\r')
|
feed_data(':call ManyErr()\r')
|
||||||
screen:expect {
|
screen:expect([[
|
||||||
grid = [[
|
{8:Error in function ManyErr:} |
|
||||||
{8:Error detected while processing function ManyErr:} |
|
|
||||||
{11:line 2:} |
|
{11:line 2:} |
|
||||||
{8:FAIL 0} |
|
{8:FAIL 0} |
|
||||||
{8:FAIL 1} |
|
{8:FAIL 1} |
|
||||||
{8:FAIL 2} |
|
{8:FAIL 2} |
|
||||||
{10:-- More --}^ |
|
{10:-- More --}^ |
|
||||||
{3:-- TERMINAL --} |
|
{3:-- TERMINAL --} |
|
||||||
]],
|
]])
|
||||||
}
|
|
||||||
|
|
||||||
screen:try_resize(50, 10)
|
screen:try_resize(50, 10)
|
||||||
screen:expect {
|
screen:expect {
|
||||||
grid = [[
|
grid = [[
|
||||||
:call ManyErr() |
|
:call ManyErr() |
|
||||||
{8:Error detected while processing function ManyErr:} |
|
{8:Error in function ManyErr:} |
|
||||||
{11:line 2:} |
|
{11:line 2:} |
|
||||||
{8:FAIL 0} |
|
{8:FAIL 0} |
|
||||||
{8:FAIL 1} |
|
{8:FAIL 1} |
|
||||||
@@ -301,7 +299,7 @@ describe('TUI', function()
|
|||||||
feed_data('j')
|
feed_data('j')
|
||||||
screen:expect {
|
screen:expect {
|
||||||
grid = [[
|
grid = [[
|
||||||
{8:Error detected while processing function ManyErr:} |
|
{8:Error in function ManyErr:} |
|
||||||
{11:line 2:} |
|
{11:line 2:} |
|
||||||
{8:FAIL 0} |
|
{8:FAIL 0} |
|
||||||
{8:FAIL 1} |
|
{8:FAIL 1} |
|
||||||
@@ -342,7 +340,7 @@ describe('TUI', function()
|
|||||||
screen:expect {
|
screen:expect {
|
||||||
grid = [[
|
grid = [[
|
||||||
:call ManyErr() |
|
:call ManyErr() |
|
||||||
{8:Error detected while processing function ManyErr:} |
|
{8:Error in function ManyErr:} |
|
||||||
{11:line 2:} |
|
{11:line 2:} |
|
||||||
{10:-- More --}^ |
|
{10:-- More --}^ |
|
||||||
{3:-- TERMINAL --} |
|
{3:-- TERMINAL --} |
|
||||||
@@ -353,7 +351,7 @@ describe('TUI', function()
|
|||||||
screen:expect {
|
screen:expect {
|
||||||
grid = [[
|
grid = [[
|
||||||
:call ManyErr() |
|
:call ManyErr() |
|
||||||
{8:Error detected while processing function ManyErr:} |
|
{8:Error in function ManyErr:} |
|
||||||
{11:line 2:} |
|
{11:line 2:} |
|
||||||
{8:FAIL 0} |
|
{8:FAIL 0} |
|
||||||
{8:FAIL 1} |
|
{8:FAIL 1} |
|
||||||
@@ -1413,11 +1411,10 @@ describe('TUI', function()
|
|||||||
feed_data('\027[200~line 1\nline 2\n')
|
feed_data('\027[200~line 1\nline 2\n')
|
||||||
screen:expect([[
|
screen:expect([[
|
||||||
foo |
|
foo |
|
||||||
|
|
^ |
|
||||||
{5: }|
|
{4:~ }|*2
|
||||||
{8:paste: Error executing lua: [string "<nvim>"]:4: f}|
|
{5:[No Name] [+] }|
|
||||||
{8:ake fail} |
|
{8:paste: Lua: [string "<nvim>"]:4: fake fail} |
|
||||||
{10:Press ENTER or type command to continue}^ |
|
|
||||||
{3:-- TERMINAL --} |
|
{3:-- TERMINAL --} |
|
||||||
]])
|
]])
|
||||||
-- Remaining chunks are discarded after vim.paste() failure.
|
-- Remaining chunks are discarded after vim.paste() failure.
|
||||||
@@ -1518,8 +1515,8 @@ describe('TUI', function()
|
|||||||
|
|
|
|
||||||
{4:~ }|
|
{4:~ }|
|
||||||
{5: }|
|
{5: }|
|
||||||
{8:paste: Error executing lua: Vim:E21: Cannot make c}|
|
{8:paste: Lua: Vim:E21: Cannot make changes, 'modifia}|
|
||||||
{8:hanges, 'modifiable' is off} |
|
{8:ble' is off} |
|
||||||
{10:Press ENTER or type command to continue}^ |
|
{10:Press ENTER or type command to continue}^ |
|
||||||
{3:-- TERMINAL --} |
|
{3:-- TERMINAL --} |
|
||||||
]])
|
]])
|
||||||
|
@@ -686,7 +686,7 @@ describe('Ex commands coloring', function()
|
|||||||
{EOB:~ }|*2
|
{EOB:~ }|*2
|
||||||
{MSEP: }|
|
{MSEP: }|
|
||||||
:# |
|
:# |
|
||||||
{ERR:Error detected while processing :} |
|
{ERR:Error in :} |
|
||||||
{ERR:E605: Exception not caught: 42} |
|
{ERR:E605: Exception not caught: 42} |
|
||||||
:#^ |
|
:#^ |
|
||||||
]])
|
]])
|
||||||
@@ -696,16 +696,13 @@ describe('Ex commands coloring', function()
|
|||||||
{EOB:~ }|
|
{EOB:~ }|
|
||||||
{MSEP: }|
|
{MSEP: }|
|
||||||
:# |
|
:# |
|
||||||
{ERR:Error detected while processing :} |
|
{ERR:Error in :} |
|
||||||
{ERR:E605: Exception not caught: 42} |
|
{ERR:E605: Exception not caught: 42} |
|
||||||
{ERR:E749: Empty buffer} |
|
{ERR:E749: Empty buffer} |
|
||||||
{PE:Press ENTER or type command to continue}^ |
|
{PE:Press ENTER or type command to continue}^ |
|
||||||
]])
|
]])
|
||||||
feed('<CR>')
|
feed('<CR>')
|
||||||
eq(
|
eq('Error in :\nE605: Exception not caught: 42\nE749: Empty buffer', exec_capture('messages'))
|
||||||
'Error detected while processing :\nE605: Exception not caught: 42\nE749: Empty buffer',
|
|
||||||
exec_capture('messages')
|
|
||||||
)
|
|
||||||
end)
|
end)
|
||||||
it('errors out when failing to get callback', function()
|
it('errors out when failing to get callback', function()
|
||||||
api.nvim_set_var('Nvim_color_cmdline', 42)
|
api.nvim_set_var('Nvim_color_cmdline', 42)
|
||||||
|
@@ -872,15 +872,15 @@ describe('decoration_providers', function()
|
|||||||
]])
|
]])
|
||||||
screen:expect([[
|
screen:expect([[
|
||||||
{3: }|
|
{3: }|
|
||||||
{9:Error in decoration provider "start" (ns=ns1):} |
|
{9:Decoration provider "start" (ns=ns1):} |
|
||||||
{9:Error executing lua: [string "<nvim>"]:4: Foo} |
|
{9:Lua: [string "<nvim>"]:4: Foo} |
|
||||||
{9:stack traceback:} |
|
{9:stack traceback:} |
|
||||||
{9: [C]: in function 'error'} |
|
{9: [C]: in function 'error'} |
|
||||||
{9: [string "<nvim>"]:4: in function <[string "<nvim>"]:3>} |
|
{9: [string "<nvim>"]:4: in function <[string "<nvim>"]:3>} |
|
||||||
{6:Press ENTER or type command to continue}^ |
|
{6:Press ENTER or type command to continue}^ |
|
||||||
]])
|
]])
|
||||||
t.assert_log('Error in decoration provider "start" %(ns=ns1%):', testlog, 100)
|
t.assert_log('Error in decoration provider "start" %(ns=ns1%):', testlog, 100)
|
||||||
t.assert_log('Error executing lua: %[string "<nvim>"%]:4: Foo', testlog, 100)
|
t.assert_log('Lua: %[string "<nvim>"%]:4: Foo', testlog, 100)
|
||||||
n.check_close()
|
n.check_close()
|
||||||
os.remove(testlog)
|
os.remove(testlog)
|
||||||
end)
|
end)
|
||||||
|
@@ -41,7 +41,7 @@ local function test_embed(ext_linegrid)
|
|||||||
screen:expect([[
|
screen:expect([[
|
||||||
|*4
|
|*4
|
||||||
{102: }|
|
{102: }|
|
||||||
{9:Error detected while processing pre-vimrc command line:} |
|
{9:Error in pre-vimrc command line:} |
|
||||||
{9:E121: Undefined variable: invalid} |
|
{9:E121: Undefined variable: invalid} |
|
||||||
{6:Press ENTER or type command to continue}^ |
|
{6:Press ENTER or type command to continue}^ |
|
||||||
]])
|
]])
|
||||||
@@ -62,7 +62,7 @@ local function test_embed(ext_linegrid)
|
|||||||
screen:expect([[
|
screen:expect([[
|
||||||
|*3
|
|*3
|
||||||
{102: }|
|
{102: }|
|
||||||
{9:Error detected while processing pre-vimrc command line:} |
|
{9:Error in pre-vimrc command line:} |
|
||||||
{9:foo} |
|
{9:foo} |
|
||||||
{101:bar} |
|
{101:bar} |
|
||||||
{100:Press ENTER or type command to continue}^ |
|
{100:Press ENTER or type command to continue}^ |
|
||||||
@@ -75,7 +75,7 @@ local function test_embed(ext_linegrid)
|
|||||||
grid = [[
|
grid = [[
|
||||||
|*3
|
|*3
|
||||||
{102: }|
|
{102: }|
|
||||||
{9:Error detected while processing pre-vimrc command line:} |
|
{9:Error in pre-vimrc command line:} |
|
||||||
{9:foo} |
|
{9:foo} |
|
||||||
{9:bar} |
|
{9:bar} |
|
||||||
{6:Press ENTER or type command to continue}^ |
|
{6:Press ENTER or type command to continue}^ |
|
||||||
|
@@ -182,7 +182,7 @@ describe('ui/ext_messages', function()
|
|||||||
messages = {
|
messages = {
|
||||||
{
|
{
|
||||||
content = {
|
content = {
|
||||||
{ 'Error detected while processing :\nE605: Exception not caught: foo', 9, 6 },
|
{ 'Error in :\nE605: Exception not caught: foo', 9, 6 },
|
||||||
},
|
},
|
||||||
history = true,
|
history = true,
|
||||||
kind = 'emsg',
|
kind = 'emsg',
|
||||||
@@ -1250,7 +1250,7 @@ describe('ui/ext_messages', function()
|
|||||||
{
|
{
|
||||||
content = {
|
content = {
|
||||||
{
|
{
|
||||||
[[E5108: Error executing lua [string ":lua"]:1: such
|
[[E5108: Lua: [string ":lua"]:1: such
|
||||||
multiline
|
multiline
|
||||||
error
|
error
|
||||||
stack traceback:
|
stack traceback:
|
||||||
@@ -1279,7 +1279,7 @@ stack traceback:
|
|||||||
messages = {
|
messages = {
|
||||||
{
|
{
|
||||||
content = {
|
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,
|
history = true,
|
||||||
kind = 'rpc_error',
|
kind = 'rpc_error',
|
||||||
@@ -1699,7 +1699,7 @@ describe('ui/builtin messages', function()
|
|||||||
screen:expect {
|
screen:expect {
|
||||||
grid = [[
|
grid = [[
|
||||||
{3: }|
|
{3: }|
|
||||||
{9:Error invoking 'test_method' on channel 1:} |
|
{9:Invoking 'test_method' on channel 1:} |
|
||||||
{9:complete} |
|
{9:complete} |
|
||||||
{9:error} |
|
{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")<cr>')
|
feed(':set colorcolumn=5 | lua error("x\\n\\nx")<cr>')
|
||||||
screen:expect {
|
screen:expect {
|
||||||
grid = [[
|
grid = [[
|
||||||
{9:E5108: Error executing lua [string ":lua"]:1: x} |
|
{9:E5108: Lua: [string ":lua"]:1: x} |
|
||||||
|
|
|
|
||||||
{9:x} |
|
{9:x} |
|
||||||
{9:stack traceback:} |
|
{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")<cr>')
|
feed(':set colorcolumn=5 | lua error("x\\n\\n\\nx")<cr>')
|
||||||
screen:expect {
|
screen:expect {
|
||||||
grid = [[
|
grid = [[
|
||||||
{9:E5108: Error executing lua [string ":lua"]:1: x} |
|
{9:E5108: Lua: [string ":lua"]:1: x} |
|
||||||
|*2
|
|*2
|
||||||
{9:x} |
|
{9:x} |
|
||||||
{9:stack traceback:} |
|
{9:stack traceback:} |
|
||||||
@@ -2686,76 +2686,66 @@ aliquip ex ea commodo consequat.]]
|
|||||||
|
|
||||||
it('handles wrapped lines with line scroll', function()
|
it('handles wrapped lines with line scroll', function()
|
||||||
feed(':lua error(_G.x)<cr>')
|
feed(':lua error(_G.x)<cr>')
|
||||||
screen:expect {
|
screen:expect([[
|
||||||
grid = [[
|
{2:E5108: Lua: [string ":lua"]:1: Lore}|
|
||||||
{2:E5108: Error executing lua [string }|
|
{2:m ipsum dolor sit amet, consectetur}|
|
||||||
{2:":lua"]:1: Lorem ipsum dolor sit am}|
|
|
|
||||||
{2:et, consectetur} |
|
|
||||||
{2:adipisicing elit, sed do eiusmod te}|
|
{2:adipisicing elit, sed do eiusmod te}|
|
||||||
{2:mpor} |
|
{2:mpor} |
|
||||||
{2:incididunt ut labore et dolore magn}|
|
{2:incididunt ut labore et dolore magn}|
|
||||||
{2:a aliqua.} |
|
{2:a aliqua.} |
|
||||||
{4:-- More --}^ |
|
{4:-- More --}^ |
|
||||||
]],
|
]])
|
||||||
}
|
|
||||||
|
|
||||||
feed('j')
|
feed('j')
|
||||||
screen:expect {
|
screen:expect([[
|
||||||
grid = [[
|
{2:m ipsum dolor sit amet, consectetur}|
|
||||||
{2:":lua"]:1: Lorem ipsum dolor sit am}|
|
|
|
||||||
{2:et, consectetur} |
|
|
||||||
{2:adipisicing elit, sed do eiusmod te}|
|
{2:adipisicing elit, sed do eiusmod te}|
|
||||||
{2:mpor} |
|
{2:mpor} |
|
||||||
{2:incididunt ut labore et dolore magn}|
|
{2:incididunt ut labore et dolore magn}|
|
||||||
{2:a aliqua.} |
|
{2:a aliqua.} |
|
||||||
{2:Ut enim ad minim veniam, quis nostr}|
|
{2:Ut enim ad minim veniam, quis nostr}|
|
||||||
{4:-- More --}^ |
|
{4:-- More --}^ |
|
||||||
]],
|
]])
|
||||||
}
|
|
||||||
|
|
||||||
feed('k')
|
feed('k')
|
||||||
screen:expect {
|
screen:expect([[
|
||||||
grid = [[
|
{2:E5108: Lua: [string ":lua"]:1: Lore}|
|
||||||
{2:E5108: Error executing lua [string }|
|
{2:m ipsum dolor sit amet, consectetur}|
|
||||||
{2:":lua"]:1: Lorem ipsum dolor sit am}|
|
|
|
||||||
{2:et, consectetur} |
|
|
||||||
{2:adipisicing elit, sed do eiusmod te}|
|
{2:adipisicing elit, sed do eiusmod te}|
|
||||||
{2:mpor} |
|
{2:mpor} |
|
||||||
{2:incididunt ut labore et dolore magn}|
|
{2:incididunt ut labore et dolore magn}|
|
||||||
{2:a aliqua.} |
|
{2:a aliqua.} |
|
||||||
{4:-- More --}^ |
|
{4:-- More --}^ |
|
||||||
]],
|
]])
|
||||||
}
|
|
||||||
|
|
||||||
feed('j')
|
feed('j')
|
||||||
screen:expect {
|
screen:expect([[
|
||||||
grid = [[
|
{2:m ipsum dolor sit amet, consectetur}|
|
||||||
{2:":lua"]:1: Lorem ipsum dolor sit am}|
|
|
|
||||||
{2:et, consectetur} |
|
|
||||||
{2:adipisicing elit, sed do eiusmod te}|
|
{2:adipisicing elit, sed do eiusmod te}|
|
||||||
{2:mpor} |
|
{2:mpor} |
|
||||||
{2:incididunt ut labore et dolore magn}|
|
{2:incididunt ut labore et dolore magn}|
|
||||||
{2:a aliqua.} |
|
{2:a aliqua.} |
|
||||||
{2:Ut enim ad minim veniam, quis nostr}|
|
{2:Ut enim ad minim veniam, quis nostr}|
|
||||||
{4:-- More --}^ |
|
{4:-- More --}^ |
|
||||||
]],
|
]])
|
||||||
}
|
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('handles wrapped lines with page scroll', function()
|
it('handles wrapped lines with page scroll', function()
|
||||||
feed(':lua error(_G.x)<cr>')
|
feed(':lua error(_G.x)<cr>')
|
||||||
screen:expect {
|
screen:expect([[
|
||||||
grid = [[
|
{2:E5108: Lua: [string ":lua"]:1: Lore}|
|
||||||
{2:E5108: Error executing lua [string }|
|
{2:m ipsum dolor sit amet, consectetur}|
|
||||||
{2:":lua"]:1: Lorem ipsum dolor sit am}|
|
|
|
||||||
{2:et, consectetur} |
|
|
||||||
{2:adipisicing elit, sed do eiusmod te}|
|
{2:adipisicing elit, sed do eiusmod te}|
|
||||||
{2:mpor} |
|
{2:mpor} |
|
||||||
{2:incididunt ut labore et dolore magn}|
|
{2:incididunt ut labore et dolore magn}|
|
||||||
{2:a aliqua.} |
|
{2:a aliqua.} |
|
||||||
{4:-- More --}^ |
|
{4:-- More --}^ |
|
||||||
]],
|
]])
|
||||||
}
|
|
||||||
feed('d')
|
feed('d')
|
||||||
screen:expect {
|
screen:expect {
|
||||||
grid = [[
|
grid = [[
|
||||||
@@ -2770,18 +2760,16 @@ aliquip ex ea commodo consequat.]]
|
|||||||
]],
|
]],
|
||||||
}
|
}
|
||||||
feed('u')
|
feed('u')
|
||||||
screen:expect {
|
screen:expect([[
|
||||||
grid = [[
|
{2:E5108: Lua: [string ":lua"]:1: Lore}|
|
||||||
{2:E5108: Error executing lua [string }|
|
{2:m ipsum dolor sit amet, consectetur}|
|
||||||
{2:":lua"]:1: Lorem ipsum dolor sit am}|
|
|
|
||||||
{2:et, consectetur} |
|
|
||||||
{2:adipisicing elit, sed do eiusmod te}|
|
{2:adipisicing elit, sed do eiusmod te}|
|
||||||
{2:mpor} |
|
{2:mpor} |
|
||||||
{2:incididunt ut labore et dolore magn}|
|
{2:incididunt ut labore et dolore magn}|
|
||||||
{2:a aliqua.} |
|
{2:a aliqua.} |
|
||||||
{4:-- More --}^ |
|
{4:-- More --}^ |
|
||||||
]],
|
]])
|
||||||
}
|
|
||||||
feed('d')
|
feed('d')
|
||||||
screen:expect {
|
screen:expect {
|
||||||
grid = [[
|
grid = [[
|
||||||
@@ -2801,77 +2789,67 @@ aliquip ex ea commodo consequat.]]
|
|||||||
command('hi MsgArea guisp=Yellow')
|
command('hi MsgArea guisp=Yellow')
|
||||||
|
|
||||||
feed(':lua error(_G.x)<cr>')
|
feed(':lua error(_G.x)<cr>')
|
||||||
screen:expect {
|
screen:expect([[
|
||||||
grid = [[
|
{3:E5108: Lua: [string ":lua"]:1: Lore}|
|
||||||
{3:E5108: Error executing lua [string }|
|
{3:m ipsum dolor sit amet, consectetur}|
|
||||||
{3:":lua"]:1: Lorem ipsum dolor sit am}|
|
{5: }|
|
||||||
{3:et, consectetur}{5: }|
|
|
||||||
{3:adipisicing elit, sed do eiusmod te}|
|
{3:adipisicing elit, sed do eiusmod te}|
|
||||||
{3:mpor}{5: }|
|
{3:mpor}{5: }|
|
||||||
{3:incididunt ut labore et dolore magn}|
|
{3:incididunt ut labore et dolore magn}|
|
||||||
{3:a aliqua.}{5: }|
|
{3:a aliqua.}{5: }|
|
||||||
{6:-- More --}{5:^ }|
|
{6:-- More --}{5:^ }|
|
||||||
]],
|
]])
|
||||||
}
|
|
||||||
|
|
||||||
feed('j')
|
feed('j')
|
||||||
screen:expect {
|
screen:expect([[
|
||||||
grid = [[
|
{3:m ipsum dolor sit amet, consectetur}|
|
||||||
{3:":lua"]:1: Lorem ipsum dolor sit am}|
|
{5: }|
|
||||||
{3:et, consectetur}{5: }|
|
|
||||||
{3:adipisicing elit, sed do eiusmod te}|
|
{3:adipisicing elit, sed do eiusmod te}|
|
||||||
{3:mpor}{5: }|
|
{3:mpor}{5: }|
|
||||||
{3:incididunt ut labore et dolore magn}|
|
{3:incididunt ut labore et dolore magn}|
|
||||||
{3:a aliqua.}{5: }|
|
{3:a aliqua.}{5: }|
|
||||||
{3:Ut enim ad minim veniam, quis nostr}|
|
{3:Ut enim ad minim veniam, quis nostr}|
|
||||||
{6:-- More --}{5:^ }|
|
{6:-- More --}{5:^ }|
|
||||||
]],
|
]])
|
||||||
}
|
|
||||||
|
|
||||||
feed('k')
|
feed('k')
|
||||||
screen:expect {
|
screen:expect([[
|
||||||
grid = [[
|
{3:E5108: Lua: [string ":lua"]:1: Lore}|
|
||||||
{3:E5108: Error executing lua [string }|
|
{3:m ipsum dolor sit amet, consectetur}|
|
||||||
{3:":lua"]:1: Lorem ipsum dolor sit am}|
|
{5: }|
|
||||||
{3:et, consectetur}{5: }|
|
|
||||||
{3:adipisicing elit, sed do eiusmod te}|
|
{3:adipisicing elit, sed do eiusmod te}|
|
||||||
{3:mpor}{5: }|
|
{3:mpor}{5: }|
|
||||||
{3:incididunt ut labore et dolore magn}|
|
{3:incididunt ut labore et dolore magn}|
|
||||||
{3:a aliqua.}{5: }|
|
{3:a aliqua.}{5: }|
|
||||||
{6:-- More --}{5:^ }|
|
{6:-- More --}{5:^ }|
|
||||||
]],
|
]])
|
||||||
}
|
|
||||||
|
|
||||||
feed('j')
|
feed('j')
|
||||||
screen:expect {
|
screen:expect([[
|
||||||
grid = [[
|
{3:m ipsum dolor sit amet, consectetur}|
|
||||||
{3:":lua"]:1: Lorem ipsum dolor sit am}|
|
{5: }|
|
||||||
{3:et, consectetur}{5: }|
|
|
||||||
{3:adipisicing elit, sed do eiusmod te}|
|
{3:adipisicing elit, sed do eiusmod te}|
|
||||||
{3:mpor}{5: }|
|
{3:mpor}{5: }|
|
||||||
{3:incididunt ut labore et dolore magn}|
|
{3:incididunt ut labore et dolore magn}|
|
||||||
{3:a aliqua.}{5: }|
|
{3:a aliqua.}{5: }|
|
||||||
{3:Ut enim ad minim veniam, quis nostr}|
|
{3:Ut enim ad minim veniam, quis nostr}|
|
||||||
{6:-- More --}{5:^ }|
|
{6:-- More --}{5:^ }|
|
||||||
]],
|
]])
|
||||||
}
|
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('handles wrapped lines with page scroll and MsgArea highlight', function()
|
it('handles wrapped lines with page scroll and MsgArea highlight', function()
|
||||||
command('hi MsgArea guisp=Yellow')
|
command('hi MsgArea guisp=Yellow')
|
||||||
feed(':lua error(_G.x)<cr>')
|
feed(':lua error(_G.x)<cr>')
|
||||||
screen:expect {
|
screen:expect([[
|
||||||
grid = [[
|
{3:E5108: Lua: [string ":lua"]:1: Lore}|
|
||||||
{3:E5108: Error executing lua [string }|
|
{3:m ipsum dolor sit amet, consectetur}|
|
||||||
{3:":lua"]:1: Lorem ipsum dolor sit am}|
|
{5: }|
|
||||||
{3:et, consectetur}{5: }|
|
|
||||||
{3:adipisicing elit, sed do eiusmod te}|
|
{3:adipisicing elit, sed do eiusmod te}|
|
||||||
{3:mpor}{5: }|
|
{3:mpor}{5: }|
|
||||||
{3:incididunt ut labore et dolore magn}|
|
{3:incididunt ut labore et dolore magn}|
|
||||||
{3:a aliqua.}{5: }|
|
{3:a aliqua.}{5: }|
|
||||||
{6:-- More --}{5:^ }|
|
{6:-- More --}{5:^ }|
|
||||||
]],
|
]])
|
||||||
}
|
|
||||||
feed('d')
|
feed('d')
|
||||||
screen:expect {
|
screen:expect {
|
||||||
grid = [[
|
grid = [[
|
||||||
@@ -2886,18 +2864,16 @@ aliquip ex ea commodo consequat.]]
|
|||||||
]],
|
]],
|
||||||
}
|
}
|
||||||
feed('u')
|
feed('u')
|
||||||
screen:expect {
|
screen:expect([[
|
||||||
grid = [[
|
{3:E5108: Lua: [string ":lua"]:1: Lore}|
|
||||||
{3:E5108: Error executing lua [string }|
|
{3:m ipsum dolor sit amet, consectetur}|
|
||||||
{3:":lua"]:1: Lorem ipsum dolor sit am}|
|
{5: }|
|
||||||
{3:et, consectetur}{5: }|
|
|
||||||
{3:adipisicing elit, sed do eiusmod te}|
|
{3:adipisicing elit, sed do eiusmod te}|
|
||||||
{3:mpor}{5: }|
|
{3:mpor}{5: }|
|
||||||
{3:incididunt ut labore et dolore magn}|
|
{3:incididunt ut labore et dolore magn}|
|
||||||
{3:a aliqua.}{5: }|
|
{3:a aliqua.}{5: }|
|
||||||
{6:-- More --}{5:^ }|
|
{6:-- More --}{5:^ }|
|
||||||
]],
|
]])
|
||||||
}
|
|
||||||
feed('d')
|
feed('d')
|
||||||
screen:expect {
|
screen:expect {
|
||||||
grid = [[
|
grid = [[
|
||||||
@@ -3059,18 +3035,16 @@ aliquip ex ea commodo consequat.]]
|
|||||||
|
|
||||||
it('can be resized', function()
|
it('can be resized', function()
|
||||||
feed(':lua error(_G.x)<cr>')
|
feed(':lua error(_G.x)<cr>')
|
||||||
screen:expect {
|
screen:expect([[
|
||||||
grid = [[
|
{2:E5108: Lua: [string ":lua"]:1: Lore}|
|
||||||
{2:E5108: Error executing lua [string }|
|
{2:m ipsum dolor sit amet, consectetur}|
|
||||||
{2:":lua"]:1: Lorem ipsum dolor sit am}|
|
|
|
||||||
{2:et, consectetur} |
|
|
||||||
{2:adipisicing elit, sed do eiusmod te}|
|
{2:adipisicing elit, sed do eiusmod te}|
|
||||||
{2:mpor} |
|
{2:mpor} |
|
||||||
{2:incididunt ut labore et dolore magn}|
|
{2:incididunt ut labore et dolore magn}|
|
||||||
{2:a aliqua.} |
|
{2:a aliqua.} |
|
||||||
{4:-- More --}^ |
|
{4:-- More --}^ |
|
||||||
]],
|
]])
|
||||||
}
|
|
||||||
|
|
||||||
-- responds to resize, but text is not reflown
|
-- responds to resize, but text is not reflown
|
||||||
screen:try_resize(45, 5)
|
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.
|
-- can create empty space, as the command hasn't output the text below yet.
|
||||||
-- text is not reflown; existing lines get cut
|
-- text is not reflown; existing lines get cut
|
||||||
screen:try_resize(30, 12)
|
screen:try_resize(30, 12)
|
||||||
screen:expect {
|
screen:expect([[
|
||||||
grid = [[
|
|
||||||
:lua error(_G.x) |
|
:lua error(_G.x) |
|
||||||
{2:E5108: Error executing lua [st}|
|
{2:E5108: Lua: [string ":lua"]:1:}|
|
||||||
{2:":lua"]:1: Lorem ipsum dolor s}|
|
{2:m ipsum dolor sit amet, consec}|
|
||||||
{2:et, consectetur} |
|
{2:tetur} |
|
||||||
{2:adipisicing elit, sed do eiusm}|
|
{2:adipisicing elit, sed do eiusm}|
|
||||||
{2:mpore} |
|
{2:mpore} |
|
||||||
{2:incididunt ut labore et dolore}|
|
{2:incididunt ut labore et dolore}|
|
||||||
{2:a aliqua.} |
|
{2:a aliqua.} |
|
||||||
|*3
|
|*3
|
||||||
{4:-- More --}^ |
|
{4:-- More --}^ |
|
||||||
]],
|
]])
|
||||||
}
|
|
||||||
|
|
||||||
-- continues in a mostly consistent state, but only new lines are
|
-- continues in a mostly consistent state, but only new lines are
|
||||||
-- wrapped at the new screen size.
|
-- wrapped at the new screen size.
|
||||||
feed('<cr>')
|
feed('<cr>')
|
||||||
screen:expect {
|
screen:expect([[
|
||||||
grid = [[
|
{2:E5108: Lua: [string ":lua"]:1:}|
|
||||||
{2:E5108: Error executing lua [st}|
|
{2:m ipsum dolor sit amet, consec}|
|
||||||
{2:":lua"]:1: Lorem ipsum dolor s}|
|
{2:tetur} |
|
||||||
{2:et, consectetur} |
|
|
||||||
{2:adipisicing elit, sed do eiusm}|
|
{2:adipisicing elit, sed do eiusm}|
|
||||||
{2:mpore} |
|
{2:mpore} |
|
||||||
{2:incididunt ut labore et dolore}|
|
{2:incididunt ut labore et dolore}|
|
||||||
@@ -3119,14 +3090,12 @@ aliquip ex ea commodo consequat.]]
|
|||||||
{2:ullamco laboris nisi ut} |
|
{2:ullamco laboris nisi ut} |
|
||||||
{2:aliquip ex ea commodo consequa}|
|
{2:aliquip ex ea commodo consequa}|
|
||||||
{4:-- More --}^ |
|
{4:-- More --}^ |
|
||||||
]],
|
]])
|
||||||
}
|
|
||||||
|
|
||||||
feed('<cr>')
|
feed('<cr>')
|
||||||
screen:expect {
|
screen:expect([[
|
||||||
grid = [[
|
{2:m ipsum dolor sit amet, consec}|
|
||||||
{2:":lua"]:1: Lorem ipsum dolor s}|
|
{2:tetur} |
|
||||||
{2:et, consectetur} |
|
|
||||||
{2:adipisicing elit, sed do eiusm}|
|
{2:adipisicing elit, sed do eiusm}|
|
||||||
{2:mpore} |
|
{2:mpore} |
|
||||||
{2:incididunt ut labore et dolore}|
|
{2:incididunt ut labore et dolore}|
|
||||||
@@ -3137,8 +3106,7 @@ aliquip ex ea commodo consequat.]]
|
|||||||
{2:aliquip ex ea commodo consequa}|
|
{2:aliquip ex ea commodo consequa}|
|
||||||
{2:t.} |
|
{2:t.} |
|
||||||
{4:-- More --}^ |
|
{4:-- More --}^ |
|
||||||
]],
|
]])
|
||||||
}
|
|
||||||
|
|
||||||
feed('q')
|
feed('q')
|
||||||
screen:expect {
|
screen:expect {
|
||||||
|
@@ -892,7 +892,7 @@ describe('ext_multigrid', function()
|
|||||||
|
|
|
|
||||||
{1:~ }|*4
|
{1:~ }|*4
|
||||||
## grid 3
|
## grid 3
|
||||||
{14:Error detected while processing function ErrMsg:} |
|
{14:Error in function ErrMsg:} |
|
||||||
{19:line 2:} |
|
{19:line 2:} |
|
||||||
{14:error 0} |
|
{14:error 0} |
|
||||||
{14:error 1} |
|
{14:error 1} |
|
||||||
|
@@ -193,21 +193,19 @@ describe('uncaught exception', function()
|
|||||||
end
|
end
|
||||||
]])
|
]])
|
||||||
feed(':try\rlua _G.Oops()\rendtry\r')
|
feed(':try\rlua _G.Oops()\rendtry\r')
|
||||||
screen:expect {
|
screen:expect([[
|
||||||
grid = [[
|
|
||||||
{3: }|
|
{3: }|
|
||||||
:try |
|
:try |
|
||||||
: lua _G.Oops() |
|
: lua _G.Oops() |
|
||||||
: endtry |
|
: endtry |
|
||||||
{9:Error detected while processing :} |
|
{9:Error in :} |
|
||||||
{9:E5108: Error executing lua [string "<nvim>"]:2: oops} |
|
{9:E5108: Lua: [string "<nvim>"]:2: oops} |
|
||||||
{9:stack traceback:} |
|
{9:stack traceback:} |
|
||||||
{9: [C]: in function 'error'} |
|
{9: [C]: in function 'error'} |
|
||||||
{9: [string "<nvim>"]:2: in function 'Oops'} |
|
{9: [string "<nvim>"]:2: in function 'Oops'} |
|
||||||
{9: [string ":lua"]:1: in main chunk} |
|
{9: [string ":lua"]:1: in main chunk} |
|
||||||
{6:Press ENTER or type command to continue}^ |
|
{6:Press ENTER or type command to continue}^ |
|
||||||
]],
|
]])
|
||||||
}
|
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
@@ -214,9 +214,9 @@ describe('execute()', function()
|
|||||||
-- echoerr does not set did_emsg
|
-- echoerr does not set did_emsg
|
||||||
-- "ef" was overwritten since msg_col was recovered wrongly
|
-- "ef" was overwritten since msg_col was recovered wrongly
|
||||||
screen:expect([[
|
screen:expect([[
|
||||||
|
{3: }|
|
||||||
1234 |
|
1234 |
|
||||||
{9:Error detected while processing function}|
|
{9:Error in function Test4:} |
|
||||||
{9: Test4:} |
|
|
||||||
{8:line 2:} |
|
{8:line 2:} |
|
||||||
{9:abcd}ABCD |
|
{9:abcd}ABCD |
|
||||||
{6:Press ENTER or type command to continue}^ |
|
{6:Press ENTER or type command to continue}^ |
|
||||||
@@ -232,9 +232,9 @@ describe('execute()', function()
|
|||||||
|
|
||||||
feed([[:call Test6()<cr>]])
|
feed([[:call Test6()<cr>]])
|
||||||
screen:expect([[
|
screen:expect([[
|
||||||
|
{3: }|
|
||||||
|
|
|
|
||||||
{9:Error detected while processing function}|
|
{9:Error in function Test6:} |
|
||||||
{9: Test6:} |
|
|
||||||
{8:line 2:} |
|
{8:line 2:} |
|
||||||
{9:E121}ABCD |
|
{9:E121}ABCD |
|
||||||
{6:Press ENTER or type command to continue}^ |
|
{6:Press ENTER or type command to continue}^ |
|
||||||
@@ -242,8 +242,8 @@ describe('execute()', function()
|
|||||||
|
|
||||||
feed([[:call Test7()<cr>]])
|
feed([[:call Test7()<cr>]])
|
||||||
screen:expect([[
|
screen:expect([[
|
||||||
{9:Error detected while processing function}|
|
|
|
||||||
{9: Test6:} |
|
{9:Error in function Test6:} |
|
||||||
{8:line 2:} |
|
{8:line 2:} |
|
||||||
{9:E121}ABCD |
|
{9:E121}ABCD |
|
||||||
ABCD |
|
ABCD |
|
||||||
|
@@ -129,7 +129,7 @@ func Test_Debugger()
|
|||||||
call RunDbgCmd(buf, 'step')
|
call RunDbgCmd(buf, 'step')
|
||||||
call RunDbgCmd(buf, 'frame 2')
|
call RunDbgCmd(buf, 'frame 2')
|
||||||
call RunDbgCmd(buf, 'echo var3', [
|
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:',
|
\ 'line 4:',
|
||||||
\ 'E121: Undefined variable: var3'])
|
\ 'E121: Undefined variable: var3'])
|
||||||
|
|
||||||
@@ -149,7 +149,7 @@ func Test_Debugger()
|
|||||||
|
|
||||||
" Undefined var2
|
" Undefined var2
|
||||||
call RunDbgCmd(buf, 'echo var2', [
|
call RunDbgCmd(buf, 'echo var2', [
|
||||||
\ 'Error detected while processing function Foo[2]..Bar:',
|
\ 'Error in function Foo[2]..Bar:',
|
||||||
\ 'line 3:',
|
\ 'line 3:',
|
||||||
\ 'E121: Undefined variable: var2'])
|
\ 'E121: Undefined variable: var2'])
|
||||||
|
|
||||||
@@ -268,7 +268,7 @@ func Test_Debugger()
|
|||||||
|
|
||||||
" Check for error cases
|
" Check for error cases
|
||||||
call RunDbgCmd(buf, 'breakadd abcd', [
|
call RunDbgCmd(buf, 'breakadd abcd', [
|
||||||
\ 'Error detected while processing function Bazz:',
|
\ 'Error in function Bazz:',
|
||||||
\ 'line 5:',
|
\ 'line 5:',
|
||||||
\ 'E475: Invalid argument: abcd'])
|
\ 'E475: Invalid argument: abcd'])
|
||||||
call RunDbgCmd(buf, 'breakadd func', ['E475: Invalid argument: func'])
|
call RunDbgCmd(buf, 'breakadd func', ['E475: Invalid argument: func'])
|
||||||
|
@@ -268,7 +268,7 @@ function M.pcall_err_withtrace(fn, ...)
|
|||||||
return (
|
return (
|
||||||
errmsg
|
errmsg
|
||||||
:gsub('^%.%.%./testnvim%.lua:0: ', '')
|
:gsub('^%.%.%./testnvim%.lua:0: ', '')
|
||||||
:gsub('^Error executing lua:- ', '')
|
:gsub('^Lua:- ', '')
|
||||||
:gsub('^%[string "<nvim>"%]:0: ', '')
|
:gsub('^%[string "<nvim>"%]:0: ', '')
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
Reference in New Issue
Block a user