diff options
author | mitchell <70453897+orbitalquark@users.noreply.github.com> | 2021-01-22 12:06:36 -0500 |
---|---|---|
committer | mitchell <70453897+orbitalquark@users.noreply.github.com> | 2021-01-22 12:06:36 -0500 |
commit | 6bb9274855236473226bdb2999b4143d78a37bcc (patch) | |
tree | 43b4c7db6d2f9bfadd277e0d77ff75e95a77e56d /test | |
parent | 8e530becaaa31eb5dcc7b8595c4b4bcb6c8bb958 (diff) |
Compile, run, and build command functions can also return environment tables.
Diffstat (limited to 'test')
-rw-r--r-- | test/test.lua | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/test/test.lua b/test/test.lua index 25aff22a..5a0fae05 100644 --- a/test/test.lua +++ b/test/test.lua @@ -3130,6 +3130,25 @@ function test_run_goto_internal_lua_error() buffer:close() end +function test_run_commands_function() + local filename = os.tmpname() + io.open_file(filename) + textadept.run.run_commands.text = function() + return [[lua -e 'print(os.getenv("FOO"))']], '/tmp', {FOO = 'bar'} + end + textadept.run.run() + assert_equal(#_BUFFERS, 3) -- including [Test Output] + assert_equal(buffer._type, _L['[Message Buffer]']) + ui.update() -- process output + assert(buffer:get_text():find('> cd /tmp'), 'cwd not set properly') + assert(buffer:get_text():find('bar'), 'env not set properly') + if #_VIEWS > 1 then view:unsplit() end + buffer:close() + buffer:close() + textadept.run.run_commands.text = nil -- reset + os.remove(filename) +end + -- TODO: test textadept.run.run_in_background function test_session_save() |