From c5aa8f8dec9611828b6972bc1a72cc8571eab36a Mon Sep 17 00:00:00 2001 From: mitchell <70453897+orbitalquark@users.noreply.github.com> Date: Fri, 22 Jan 2021 15:06:14 -0500 Subject: Added `textadept.run.test()` and `textadept.run.test_commands`. This enables the running of project tests. --- test/test.lua | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'test/test.lua') 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 -- cgit v1.2.3