diff options
| author | bfredl <bjorn.linse@gmail.com> | 2023-02-10 20:51:36 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-02-10 20:51:36 +0100 |
| commit | b8ad1bfe8bc23ed5ffbfe43df5fda3501f1d2802 (patch) | |
| tree | ea341bee19c2202cbe94ccefb2afeba953af713e /test/functional | |
| parent | 4c64cbe99f2616a1d1126257da8d40773f4adba1 (diff) | |
| parent | 0837980db4958baca96449869d31120f349f3500 (diff) | |
| download | rneovim-b8ad1bfe8bc23ed5ffbfe43df5fda3501f1d2802.tar.gz rneovim-b8ad1bfe8bc23ed5ffbfe43df5fda3501f1d2802.tar.bz2 rneovim-b8ad1bfe8bc23ed5ffbfe43df5fda3501f1d2802.zip | |
Merge pull request #22077 from bfredl/neolua_client
refactor(tests): integrate lua-client into core and use core for functionaltests
Diffstat (limited to 'test/functional')
| -rw-r--r-- | test/functional/api/rpc_fixture.lua | 7 | ||||
| -rw-r--r-- | test/functional/api/server_requests_spec.lua | 2 | ||||
| -rw-r--r-- | test/functional/api/vim_spec.lua | 2 | ||||
| -rw-r--r-- | test/functional/helpers.lua | 16 | ||||
| -rw-r--r-- | test/functional/shada/shada_spec.lua | 4 |
5 files changed, 13 insertions, 18 deletions
diff --git a/test/functional/api/rpc_fixture.lua b/test/functional/api/rpc_fixture.lua index 94df751363..c860a6da59 100644 --- a/test/functional/api/rpc_fixture.lua +++ b/test/functional/api/rpc_fixture.lua @@ -4,9 +4,8 @@ package.path = arg[1] package.cpath = arg[2] -local mpack = require('mpack') -local StdioStream = require('nvim.stdio_stream') -local Session = require('nvim.session') +local StdioStream = require'test.client.uv_stream'.StdioStream +local Session = require'test.client.session' local stdio_stream = StdioStream.open() local session = Session.new(stdio_stream) @@ -19,7 +18,7 @@ local function on_request(method, args) return "done!" elseif method == "exit" then session:stop() - return mpack.NIL + return vim.NIL end end diff --git a/test/functional/api/server_requests_spec.lua b/test/functional/api/server_requests_spec.lua index e6bfc6b64f..cb273aedba 100644 --- a/test/functional/api/server_requests_spec.lua +++ b/test/functional/api/server_requests_spec.lua @@ -237,7 +237,7 @@ describe('server -> client', function() \ } ]]) meths.set_var("args", { - helpers.test_lua_prg, + nvim_prog, '-ll', 'test/functional/api/rpc_fixture.lua', package.path, package.cpath, diff --git a/test/functional/api/vim_spec.lua b/test/functional/api/vim_spec.lua index 8fcdd9620b..fc550f5861 100644 --- a/test/functional/api/vim_spec.lua +++ b/test/functional/api/vim_spec.lua @@ -59,7 +59,7 @@ describe('API', function() -- XXX: This must be the last one, else next one will fail: -- "Packer instance already working. Use another Packer ..." - matches("can't serialize object$", + matches("can't serialize object of type .$", pcall_err(request, nil)) end) 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 diff --git a/test/functional/shada/shada_spec.lua b/test/functional/shada/shada_spec.lua index 88a99d9b55..7b1ce5d0ca 100644 --- a/test/functional/shada/shada_spec.lua +++ b/test/functional/shada/shada_spec.lua @@ -126,11 +126,11 @@ describe('ShaDa support code', function() wshada(s .. table.concat(msgpack, e .. s) .. e) eq(0, exc_exec('wshada ' .. shada_fname)) local found = 0 - local typ = mpack.unpack(s) + local typ = mpack.decode(s) for _, v in ipairs(read_shada_file(shada_fname)) do if v.type == typ then found = found + 1 - eq(mpack.unpack(msgpack[found]), v.timestamp) + eq(mpack.decode(msgpack[found]), v.timestamp) end end eq(#msgpack, found) |