diff options
author | bfredl <bjorn.linse@gmail.com> | 2023-01-31 23:35:04 +0100 |
---|---|---|
committer | bfredl <bjorn.linse@gmail.com> | 2023-02-10 20:19:04 +0100 |
commit | d6279f9392073cb1422d76c57baf3fd283ed954e (patch) | |
tree | 744661e70dd843edb434c662355cc3062de2d78a /test/functional/helpers.lua | |
parent | e5d8220179f932ab9c9ef59996cab357a25eaaf8 (diff) | |
download | rneovim-d6279f9392073cb1422d76c57baf3fd283ed954e.tar.gz rneovim-d6279f9392073cb1422d76c57baf3fd283ed954e.tar.bz2 rneovim-d6279f9392073cb1422d76c57baf3fd283ed954e.zip |
refactor(tests): move lua-client into core and use it for functionaltests
Eliminates lua-client and non-static libluv as test time dependencies
Note: the API for a public lua-client is not yet finished.
The interface needs to be adjusted to work in the embedded loop
of a nvim instance (to use it to talk between instances)
Diffstat (limited to 'test/functional/helpers.lua')
-rw-r--r-- | test/functional/helpers.lua | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/test/functional/helpers.lua b/test/functional/helpers.lua index 6400db9f87..cd6b535477 100644 --- a/test/functional/helpers.lua +++ b/test/functional/helpers.lua @@ -1,14 +1,11 @@ -require('coxpcall') local luv = require('luv') local lfs = require('lfs') -local mpack = require('mpack') local global_helpers = require('test.helpers') --- nvim client: Found in .deps/usr/share/lua/<version>/nvim/ if "bundled". -local Session = require('nvim.session') -local TcpStream = require('nvim.tcp_stream') -local SocketStream = require('nvim.socket_stream') -local ChildProcessStream = require('nvim.child_process_stream') +local Session = require('test.client.session') +local uv_stream = require('test.client.uv_stream') +local SocketStream = uv_stream.SocketStream +local ChildProcessStream = uv_stream.ChildProcessStream local check_cores = global_helpers.check_cores local check_logs = global_helpers.check_logs @@ -23,7 +20,6 @@ local tbl_contains = global_helpers.tbl_contains local fail = global_helpers.fail local module = { - NIL = mpack.NIL, mkdir = lfs.mkdir, } @@ -202,7 +198,7 @@ function module.expect_msg_seq(...) end local function call_and_stop_on_error(lsession, ...) - local status, result = copcall(...) -- luacheck: ignore + local status, result = Session.safe_pcall(...) -- luacheck: ignore if not status then lsession:stop() last_error = result @@ -428,7 +424,7 @@ end -- Creates a new Session connected by domain socket (named pipe) or TCP. function module.connect(file_or_address) local addr, port = string.match(file_or_address, "(.*):(%d+)") - local stream = (addr and port) and TcpStream.open(addr, port) or + local stream = (addr and port) and SocketStream.connect(addr, port) or SocketStream.open(file_or_address) return Session.new(stream) end |