diff options
author | zeertzjq <zeertzjq@outlook.com> | 2023-01-15 09:34:21 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-15 09:34:21 +0800 |
commit | 6134c1e8a39a5e61d0593613343a5923a86e3545 (patch) | |
tree | f8aab73024ac318d0aff9325ddb6c49b07497d78 /test/functional/helpers.lua | |
parent | 2f32b1996744b8ad4ab00f11e09f17c27ad7d866 (diff) | |
download | rneovim-6134c1e8a39a5e61d0593613343a5923a86e3545.tar.gz rneovim-6134c1e8a39a5e61d0593613343a5923a86e3545.tar.bz2 rneovim-6134c1e8a39a5e61d0593613343a5923a86e3545.zip |
test(fileio_spec): avoid expect_exit() without calling clear() (#21810)
Since before_each() doesn't call clear() in these tests, after_each()
may call expect_exit() without calling clear() if a test is skipped,
causing frequent test failures on Cirrus CI. Close the session instead.
Diffstat (limited to 'test/functional/helpers.lua')
-rw-r--r-- | test/functional/helpers.lua | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/test/functional/helpers.lua b/test/functional/helpers.lua index a14bedbbbd..4e8bf1a323 100644 --- a/test/functional/helpers.lua +++ b/test/functional/helpers.lua @@ -397,9 +397,12 @@ local function remove_args(args, args_rm) return new_args end -function module.check_close(old_session) +function module.check_close() + if not session then + return + end local start_time = luv.now() - old_session:close() + session:close() luv.update_time() -- Update cached value of luv.now() (libuv: uv_now()). local end_time = luv.now() local delta = end_time - start_time @@ -408,12 +411,13 @@ function module.check_close(old_session) "This indicates a likely problem with the test even if it passed!\n") io.stdout:flush() end + session = nil end --- @param io_extra used for stdin_fd, see :help ui-option function module.spawn(argv, merge, env, keep, io_extra) - if session and not keep then - module.check_close(session) + if not keep then + module.check_close() end local child_stream = ChildProcessStream.spawn( |