Merge pull request #39371 from justinmk/release

backport test: curbuf initialized in describe-block
This commit is contained in:
Justin M. Keyes
2026-04-24 15:00:08 -04:00
committed by GitHub
3 changed files with 6 additions and 9 deletions

View File

@@ -71,8 +71,7 @@ describe(':trust', function()
command('edit ' .. empty_file)
matches('^Allowed in trust database%: ".*' .. empty_file .. '"$', exec_capture('trust'))
local trust = t.read_file(fn.stdpath('state') .. pathsep .. 'trust')
eq(string.format('%s %s', hash, cwd .. pathsep .. empty_file), vim.trim(trust))
assert_trust_entry(('%s %s'):format(hash, osjoin(cwd, empty_file)))
end)
it('deny then trust then remove a file using current buffer', function()

View File

@@ -334,12 +334,11 @@ describe('vim.secure', function()
it('trust an empty file using bufnr', function()
local cwd = fn.getcwd()
local hash = fn.sha256(assert(read_file(empty_file)))
local full_path = cwd .. pathsep .. empty_file
local full_path = osjoin(cwd, empty_file)
command('edit ' .. empty_file)
eq({ true, full_path }, exec_lua([[return {vim.secure.trust({action='allow', bufnr=0})}]]))
local trust = assert(read_file(stdpath('state') .. pathsep .. 'trust'))
eq(string.format('%s %s', hash, full_path), vim.trim(trust))
assert_trust_entry(('%s %s'):format(hash, full_path))
end)
it('deny then trust then remove a file using bufnr', function()

View File

@@ -1403,16 +1403,15 @@ describe('vim.lsp.util', function()
feed('9i<CR><Esc>G4k')
curbuf = api.nvim_get_current_buf()
end)
local var_name = 'lsp_floating_preview'
it('clean bufvar after fclose', function()
exec_lua(function()
vim.lsp.util.open_floating_preview({ 'test' }, '', { height = 5, width = 2 })
end)
eq(true, api.nvim_win_is_valid(api.nvim_buf_get_var(curbuf, var_name)))
eq(true, api.nvim_win_is_valid(api.nvim_buf_get_var(0, var_name)))
command('fclose')
eq('Key not found: lsp_floating_preview', pcall_err(api.nvim_buf_get_var, curbuf, var_name))
eq('Key not found: lsp_floating_preview', pcall_err(api.nvim_buf_get_var, 0, var_name))
end)
it('clean bufvar after CursorMoved', function()
@@ -1424,7 +1423,7 @@ describe('vim.lsp.util', function()
return result
end)
eq(true, result)
eq('Key not found: lsp_floating_preview', pcall_err(api.nvim_buf_get_var, curbuf, var_name))
eq('Key not found: lsp_floating_preview', pcall_err(api.nvim_buf_get_var, 0, var_name))
end)
end)