aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/test.lua
diff options
context:
space:
mode:
authorGravatar mitchell <70453897+orbitalquark@users.noreply.github.com>2021-01-22 15:06:14 -0500
committerGravatar mitchell <70453897+orbitalquark@users.noreply.github.com>2021-01-22 15:06:14 -0500
commitc5aa8f8dec9611828b6972bc1a72cc8571eab36a (patch)
tree378495ef33fcb848782e1a5b6492c9751affa262 /test/test.lua
parent3cca0f2b2af03e7df8ec28231582bb3bf08042fc (diff)
Added `textadept.run.test()` and `textadept.run.test_commands`.
This enables the running of project tests.
Diffstat (limited to 'test/test.lua')
-rw-r--r--test/test.lua12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/test.lua b/test/test.lua
index 5a0fae05..8503615d 100644
--- a/test/test.lua
+++ b/test/test.lua
@@ -3120,6 +3120,18 @@ function test_run_build()
-- TODO: project whose makefile is autodetected.
end
+function test_run_test()
+ textadept.run.test_commands[_HOME] = function()
+ return 'lua modules/textadept/run/test.lua', _HOME .. '/test/' -- intentional trailing '/'
+ end
+ textadept.run.test(_HOME)
+ if #_VIEWS > 1 then view:unsplit() end
+ ui.update() -- process output
+ assert(buffer:get_text():find('test%.lua'), 'did not run test command')
+ assert(buffer:get_text():find('assertion failed!'), 'assertion failure not detected')
+ buffer:close()
+end
+
function test_run_goto_internal_lua_error()
xpcall(error, function(message) events.emit(events.ERROR, debug.traceback(message)) end, 'internal error', 2)
if #_VIEWS > 1 then view:unsplit() end