diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2022-06-30 13:16:46 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-30 04:16:46 -0700 |
commit | f50135a32e11c535e1dc3a8e9460c5b4e640ee86 (patch) | |
tree | 4531a75f5f099877cb8d672743abf03004171f4f /test/unit | |
parent | 514e76e4b2903530922529c60bfbf32cadd257a3 (diff) | |
download | rneovim-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/unit')
-rw-r--r-- | test/unit/os/env_spec.lua | 2 | ||||
-rw-r--r-- | test/unit/os/users_spec.lua | 12 | ||||
-rw-r--r-- | test/unit/tempfile_spec.lua | 12 |
3 files changed, 11 insertions, 15 deletions
diff --git a/test/unit/os/env_spec.lua b/test/unit/os/env_spec.lua index c039b95d16..71177f4c65 100644 --- a/test/unit/os/env_spec.lua +++ b/test/unit/os/env_spec.lua @@ -266,7 +266,7 @@ describe('env.c', function() itp('does not crash #3725', function() local name_out = ffi.new('char[100]') - cimp.os_get_user_name(name_out, 100) + cimp.os_get_username(name_out, 100) local curuser = ffi.string(name_out) local src = to_cstr("~"..curuser.."/Vcs/django-rest-framework/rest_framework/renderers.py") diff --git a/test/unit/os/users_spec.lua b/test/unit/os/users_spec.lua index f92413c7de..679e76fae1 100644 --- a/test/unit/os/users_spec.lua +++ b/test/unit/os/users_spec.lua @@ -48,10 +48,10 @@ describe('users function', function() end) end) - describe('os_get_user_name', function() + describe('os_get_username', function() itp('should write the username into the buffer and return OK', function() local name_out = ffi.new('char[100]') - eq(OK, users.os_get_user_name(name_out, 100)) + eq(OK, users.os_get_username(name_out, 100)) eq(current_username, ffi.string(name_out)) end) end) @@ -73,18 +73,18 @@ describe('users function', function() end) end) - describe('os_get_user_directory', function() + describe('os_get_userdir', function() itp('should return NULL if called with NULL', function() - eq(NULL, users.os_get_user_directory(NULL)) + eq(NULL, users.os_get_userdir(NULL)) end) itp('should return $HOME for the current user', function() local home = os.getenv('HOME') - eq(home, ffi.string((users.os_get_user_directory(current_username)))) + eq(home, ffi.string((users.os_get_userdir(current_username)))) end) itp('should return NULL if the user is not found', function() - eq(NULL, users.os_get_user_directory('neovim_user_not_found_test')) + eq(NULL, users.os_get_userdir('neovim_user_not_found_test')) end) end) end) diff --git a/test/unit/tempfile_spec.lua b/test/unit/tempfile_spec.lua index c05abfd640..44bd19c1d2 100644 --- a/test/unit/tempfile_spec.lua +++ b/test/unit/tempfile_spec.lua @@ -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) |