diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2024-09-03 02:18:17 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-03 02:18:17 -0700 |
commit | ea2d9493514a82bb5077e73957a22648cb5d7d14 (patch) | |
tree | ad7254108729759fe2e27746179c212d0a58089a /test/functional | |
parent | ae9674704ac5586438f60c883e918d448ef0e237 (diff) | |
download | rneovim-ea2d9493514a82bb5077e73957a22648cb5d7d14.tar.gz rneovim-ea2d9493514a82bb5077e73957a22648cb5d7d14.tar.bz2 rneovim-ea2d9493514a82bb5077e73957a22648cb5d7d14.zip |
test: tmpname(create:boolean) #30242
Problem:
137f98cf6428 added the `create` parameter to `tmpname()` but didn't
fully implement it.
Solution:
- Update impl for the `os.tmpname()` codepath.
- Inspect all usages of `tmpname()`, update various tests.
Diffstat (limited to 'test/functional')
-rw-r--r-- | test/functional/core/fileio_spec.lua | 2 | ||||
-rw-r--r-- | test/functional/lua/watch_spec.lua | 3 | ||||
-rw-r--r-- | test/functional/plugin/man_spec.lua | 2 | ||||
-rw-r--r-- | test/functional/vimscript/server_spec.lua | 3 |
4 files changed, 3 insertions, 7 deletions
diff --git a/test/functional/core/fileio_spec.lua b/test/functional/core/fileio_spec.lua index 1c4f42eb43..073041fced 100644 --- a/test/functional/core/fileio_spec.lua +++ b/test/functional/core/fileio_spec.lua @@ -325,7 +325,7 @@ describe('tmpdir', function() before_each(function() -- Fake /tmp dir so that we can mess it up. - os_tmpdir = vim.uv.fs_mkdtemp(vim.fs.dirname(t.tmpname()) .. '/nvim_XXXXXXXXXX') + os_tmpdir = vim.uv.fs_mkdtemp(vim.fs.dirname(t.tmpname(false)) .. '/nvim_XXXXXXXXXX') end) after_each(function() diff --git a/test/functional/lua/watch_spec.lua b/test/functional/lua/watch_spec.lua index 3d2dda716e..ab6b1416aa 100644 --- a/test/functional/lua/watch_spec.lua +++ b/test/functional/lua/watch_spec.lua @@ -12,7 +12,6 @@ local skip = t.skip -- events which can happen with some backends on some platforms local function touch(path) local tmp = t.tmpname() - io.open(tmp, 'w'):close() assert(vim.uv.fs_rename(tmp, path)) end @@ -42,7 +41,7 @@ describe('vim._watch', function() ) end - local root_dir = vim.uv.fs_mkdtemp(vim.fs.dirname(t.tmpname()) .. '/nvim_XXXXXXXXXX') + local root_dir = vim.uv.fs_mkdtemp(vim.fs.dirname(t.tmpname(false)) .. '/nvim_XXXXXXXXXX') local expected_events = 0 diff --git a/test/functional/plugin/man_spec.lua b/test/functional/plugin/man_spec.lua index c0256d1c63..057748f51d 100644 --- a/test/functional/plugin/man_spec.lua +++ b/test/functional/plugin/man_spec.lua @@ -8,7 +8,6 @@ local exec_lua = n.exec_lua local fn = n.fn local nvim_prog = n.nvim_prog local matches = t.matches -local write_file = t.write_file local tmpname = t.tmpname local eq = t.eq local pesc = vim.pesc @@ -226,7 +225,6 @@ describe(':Man', function() local actual_file = tmpname() -- actual_file must be an absolute path to an existent file for us to test against it matches('^/.+', actual_file) - write_file(actual_file, '') local args = { nvim_prog, '--headless', '+:Man ' .. actual_file, '+q' } matches( ('Error detected while processing command line:\r\n' .. 'man.lua: "no manual entry for %s"'):format( diff --git a/test/functional/vimscript/server_spec.lua b/test/functional/vimscript/server_spec.lua index 836d841f69..2dabe1afc1 100644 --- a/test/functional/vimscript/server_spec.lua +++ b/test/functional/vimscript/server_spec.lua @@ -188,8 +188,7 @@ describe('startup --listen', function() return end matches(expected, output) - cmd = vim.list_extend({ unpack(n.nvim_argv) }, args) - matches(expected, fn.system(cmd)) + matches(expected, fn.system(vim.list_extend({ unpack(n.nvim_argv) }, args))) end _test({ '--listen' }, 'nvim.*: Argument missing after: "%-%-listen"') |