This is where "pure functions" can live, which can be shared by Nvim and
test logic which may not have a running Nvim instance available.
If in the future we use Nvim itself as the Lua engine for tests, then
these functions could be moved directly onto the `vim` Lua module.
closes#6580
Automatically include all "global helper" util functions in the
unit.helpers and functional.helpers and modules. So tests don't need to
expicitly do:
local global_helpers = require('test.helpers')
Note: the test fails on non-Windows CI (Travis linux, Quickbuild bsd):
even on master before the env.c changes in this patch-series.
Maybe the unix part of printenv-test.c needs to be revisited.
Signed-off-by: Justin M. Keyes <justinkz@gmail.com>
tmpdir_get() may be an absolute path, but we invoke glob() with
a relative `initial_path`.
That can lead to this error:
[ ERROR ] test/functional/helpers.lua @ 752: after_each
test/helpers.lua:95: cannot open ./Xtest-tmpdir/nvim8jKCjR: No such file or directory
stack traceback:
test/helpers.lua:95: in function 'glob'
test/helpers.lua:273: in function 'check_cores'
test/functional/helpers.lua:757: in function <test/functional/helpers.lua:752>
closes#8362
Vim's code calls `call_shell` directly from `get_system_output_as_rettv`
whereas in Nvim this function has been rewritten to not call `call_shell` but to call
`os_system` via `do_os_system`, losing the support for profiling and verbose.
Changing the code to call `call_shell` from `get_system_output_as_rettv`
seems to be too complicated to be worth it on the current version of the
code. So this commit duplicates the relevant code.
It was added in the parent commit, but ended up not being used. And
I can't think of a case where it will be used: instead we would probably
want to generalize expect_msg_seq() if necessary.
First intended to provide %r functionality like in Python (and also support for
%*.*s, but this was not checked), second adds nice table formatting for use in
cases similar to screen:snapshot_util().
Avoids this error:
./test/helpers.lua:27: cannot open ./Xtest-tmpdir/nvimfqH9dL: No such file or directory
stack traceback:
./test/helpers.lua:27: in function 'glob'
./test/helpers.lua:195: in function 'check_cores'
./test/functional/helpers.lua:628: in function <./test/functional/helpers.lua:626>