diff options
author | Daniel Hahler <git@thequod.de> | 2019-09-16 19:16:39 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-09-16 19:16:39 +0200 |
commit | 4df38ec9df4764d4b2ae0b12c1b62c34889f1aa5 (patch) | |
tree | f6036c99a34122e188eadf789db52315b445034f | |
parent | 8f3d0276ee8ff0d35e07d3767e7dc5ace9d2b2d0 (diff) | |
download | rneovim-4df38ec9df4764d4b2ae0b12c1b62c34889f1aa5.tar.gz rneovim-4df38ec9df4764d4b2ae0b12c1b62c34889f1aa5.tar.bz2 rneovim-4df38ec9df4764d4b2ae0b12c1b62c34889f1aa5.zip |
server_requests_spec: fix assertion, pass Lua paths via args (#10875)
This makes it pick up the nvim Luarocks module properly when not
installed via third-party.
-rw-r--r-- | test/functional/api/rpc_fixture.lua | 14 | ||||
-rw-r--r-- | test/functional/api/server_requests_spec.lua | 16 |
2 files changed, 17 insertions, 13 deletions
diff --git a/test/functional/api/rpc_fixture.lua b/test/functional/api/rpc_fixture.lua index 87f5a91115..94df751363 100644 --- a/test/functional/api/rpc_fixture.lua +++ b/test/functional/api/rpc_fixture.lua @@ -1,12 +1,8 @@ -local deps_prefix = (os.getenv('DEPS_PREFIX') and os.getenv('DEPS_PREFIX') - or './.deps/usr') - -package.path = deps_prefix .. '/share/lua/5.1/?.lua;' .. - deps_prefix .. '/share/lua/5.1/?/init.lua;' .. - package.path - -package.cpath = deps_prefix .. '/lib/lua/5.1/?.so;' .. - package.cpath +--- RPC server fixture. +-- +-- Lua's paths are passed as arguments to reflect the path in the test itself. +package.path = arg[1] +package.cpath = arg[2] local mpack = require('mpack') local StdioStream = require('nvim.stdio_stream') diff --git a/test/functional/api/server_requests_spec.lua b/test/functional/api/server_requests_spec.lua index e275d8cd35..5a9ef7dd40 100644 --- a/test/functional/api/server_requests_spec.lua +++ b/test/functional/api/server_requests_spec.lua @@ -241,10 +241,14 @@ describe('server -> client', function() \ 'rpc': v:true \ } ]]) - meths.set_var("args", {helpers.test_lua_prg, - 'test/functional/api/rpc_fixture.lua'}) + meths.set_var("args", { + helpers.test_lua_prg, + 'test/functional/api/rpc_fixture.lua', + package.path, + package.cpath, + }) jobid = eval("jobstart(g:args, g:job_opts)") - neq(0, 'jobid') + neq(0, jobid) end) after_each(function() @@ -254,7 +258,11 @@ describe('server -> client', function() if helpers.pending_win32(pending) then return end it('rpc and text stderr can be combined', function() - eq("ok",funcs.rpcrequest(jobid, "poll")) + local status, rv = pcall(funcs.rpcrequest, jobid, 'poll') + if not status then + error(string.format('missing nvim Lua module? (%s)', rv)) + end + eq('ok', rv) funcs.rpcnotify(jobid, "ping") eq({'notification', 'pong', {}}, next_msg()) eq("done!",funcs.rpcrequest(jobid, "write_stderr", "fluff\n")) |