feat: stdpath('run'), /tmp/nvim.user/ #18993

Problem:
- Since c57f6b28d7 #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
This commit is contained in:
Justin M. Keyes
2022-06-30 13:16:46 +02:00
committed by GitHub
parent 514e76e4b2
commit f50135a32e
24 changed files with 281 additions and 105 deletions

View File

@@ -24,7 +24,7 @@ describe('tempfile related functions', function()
end
describe('vim_gettempdir', function()
itp('returns path to Neovim own temp directory', function()
itp('returns path to Nvim own temp directory', function()
local dir = vim_gettempdir()
assert.True(dir ~= nil and dir:len() > 0)
-- os_file_is_writable returns 2 for a directory which we have rights
@@ -36,9 +36,7 @@ describe('tempfile related functions', function()
end)
itp('returns the same directory on each call', function()
local dir1 = vim_gettempdir()
local dir2 = vim_gettempdir()
eq(dir1, dir2)
eq(vim_gettempdir(), vim_gettempdir())
end)
end)
@@ -54,12 +52,10 @@ describe('tempfile related functions', function()
end)
itp('generate different names on each call', function()
local fst = vim_tempname()
local snd = vim_tempname()
neq(fst, snd)
neq(vim_tempname(), vim_tempname())
end)
itp('generate file name in Neovim own temp directory', function()
itp('generate file name in Nvim own temp directory', function()
local dir = vim_gettempdir()
local file = vim_tempname()
eq(string.sub(file, 1, string.len(dir)), dir)