diff options
author | 2021-01-22 15:06:14 -0500 | |
---|---|---|
committer | 2021-01-22 15:06:14 -0500 | |
commit | c5aa8f8dec9611828b6972bc1a72cc8571eab36a (patch) | |
tree | 378495ef33fcb848782e1a5b6492c9751affa262 /test | |
parent | 3cca0f2b2af03e7df8ec28231582bb3bf08042fc (diff) |
Added `textadept.run.test()` and `textadept.run.test_commands`.
This enables the running of project tests.
Diffstat (limited to 'test')
-rw-r--r-- | test/modules/textadept/run/test.lua | 1 | ||||
-rw-r--r-- | test/test.lua | 12 |
2 files changed, 13 insertions, 0 deletions
diff --git a/test/modules/textadept/run/test.lua b/test/modules/textadept/run/test.lua new file mode 100644 index 00000000..7e275ac2 --- /dev/null +++ b/test/modules/textadept/run/test.lua @@ -0,0 +1 @@ +print('test.lua:1: assertion failed!') 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 |