From 674375e78d29ec6abf3c0ae8ba230c619229c7ce Mon Sep 17 00:00:00 2001 From: mitchell <70453897+667e-11@users.noreply.github.com> Date: Mon, 23 Mar 2020 15:44:43 -0400 Subject: Added unit tests for core code in textadept.c. Most of the core is exercised by the Lua test suite, but coverage lapses can be uncovered using the GCC compiler flags "-fprofile-arcs -ftest-coverage".. --- src/textadept.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/textadept.c') diff --git a/src/textadept.c b/src/textadept.c index a2e663ba..ac9743f7 100644 --- a/src/textadept.c +++ b/src/textadept.c @@ -230,7 +230,9 @@ static int emit(lua_State *L, const char *name, ...) { } va_end(ap); if (lua_pcall(L, n, 1, 0) != LUA_OK) { - emit(L, "error", LUA_TSTRING, lua_tostring(L, -1), -1); + // An error occurred within `events.emit()` itself, not an event handler. + const char *argv[] = {"--title", "Error", "--text", lua_tostring(L, -1)}; + free(gtdialog(GTDIALOG_TEXTBOX, 4, argv)); return (lua_pop(L, 2), FALSE); // result, events } ret = lua_toboolean(L, -1); @@ -1413,7 +1415,7 @@ static int run_file(lua_State *L, const char *filename) { const char *argv[] = { "--title", "Initialization Error", "--text", lua_tostring(L, -1) }; - free(gtdialog(GTDIALOG_TEXTBOX, 7, argv)); + free(gtdialog(GTDIALOG_TEXTBOX, 4, argv)); lua_settop(L, 0); } free(file); -- cgit v1.2.3