aboutsummaryrefslogtreecommitdiff
path: root/test/functional/vimscript/server_spec.lua
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2022-06-30 13:16:46 +0200
committerGitHub <noreply@github.com>2022-06-30 04:16:46 -0700
commitf50135a32e11c535e1dc3a8e9460c5b4e640ee86 (patch)
tree4531a75f5f099877cb8d672743abf03004171f4f /test/functional/vimscript/server_spec.lua
parent514e76e4b2903530922529c60bfbf32cadd257a3 (diff)
downloadrneovim-f50135a32e11c535e1dc3a8e9460c5b4e640ee86.tar.gz
rneovim-f50135a32e11c535e1dc3a8e9460c5b4e640ee86.tar.bz2
rneovim-f50135a32e11c535e1dc3a8e9460c5b4e640ee86.zip
feat: stdpath('run'), /tmp/nvim.user/ #18993
Problem: - Since c57f6b28d71d #8519, sockets are created in ~/.local/… but XDG spec says: "XDG_RUNTIME_DIR: Must be on the local filesystem", which implies that XDG_STATE_DIR is potentially non-local. - Not easy to inspect Nvim-created temp files (for debugging etc). Solution: - Store sockets in stdpath('run') ($XDG_RUNTIME_DIR). - Establish "/tmp/nvim.user/" as the tempdir root shared by all Nvims. - Make ok() actually useful. - Introduce assert_nolog(). closes #3517 closes #17093
Diffstat (limited to 'test/functional/vimscript/server_spec.lua')
-rw-r--r--test/functional/vimscript/server_spec.lua17
1 files changed, 16 insertions, 1 deletions
diff --git a/test/functional/vimscript/server_spec.lua b/test/functional/vimscript/server_spec.lua
index ea07be231d..6e95459630 100644
--- a/test/functional/vimscript/server_spec.lua
+++ b/test/functional/vimscript/server_spec.lua
@@ -5,6 +5,7 @@ local iswin = helpers.iswin
local ok = helpers.ok
local matches = helpers.matches
local pcall_err = helpers.pcall_err
+local mkdir = helpers.mkdir
local function clear_serverlist()
for _, server in pairs(funcs.serverlist()) do
@@ -13,9 +14,19 @@ local function clear_serverlist()
end
describe('server', function()
- before_each(clear)
+ it('serverstart() stores sockets in $XDG_RUNTIME_DIR', function()
+ local dir = 'Xtest_xdg_run'
+ mkdir(dir)
+ clear({ env={ XDG_RUNTIME_DIR=dir } })
+ matches(dir, funcs.stdpath('run'))
+ if not iswin() then
+ matches(dir, funcs.serverstart())
+ end
+ end)
+
it('serverstart(), serverstop() does not set $NVIM', function()
+ clear()
local s = eval('serverstart()')
assert(s ~= nil and s:len() > 0, "serverstart() returned empty")
eq('', eval('$NVIM'))
@@ -34,6 +45,7 @@ describe('server', function()
end)
it('sets v:servername at startup or if all servers were stopped', function()
+ clear()
local initial_server = meths.get_vvar('servername')
assert(initial_server ~= nil and initial_server:len() > 0,
'v:servername was not initialized')
@@ -62,11 +74,13 @@ describe('server', function()
end)
it('serverstop() returns false for invalid input', function()
+ clear()
eq(0, eval("serverstop('')"))
eq(0, eval("serverstop('bogus-socket-name')"))
end)
it('parses endpoints', function()
+ clear()
clear_serverlist()
eq({}, funcs.serverlist())
@@ -111,6 +125,7 @@ describe('server', function()
end)
it('serverlist() returns the list of servers', function()
+ clear()
-- There should already be at least one server.
local n = eval('len(serverlist())')