test: remove a few more redundant clear() calls (#35903)

This commit is contained in:
zeertzjq
2025-09-24 14:25:54 +08:00
committed by GitHub
parent b256e0476b
commit eb7c12d3e3
14 changed files with 13 additions and 40 deletions

View File

@@ -1171,8 +1171,6 @@ describe('autocmd api', function()
describe('nvim_create_augroup', function()
before_each(function()
clear()
api.nvim_set_var('executed', 0)
end)

View File

@@ -57,7 +57,6 @@ local function editoriginal(activate, lines)
lines = origlines
end
-- load up the file with the correct contents
clear()
return open(activate, lines)
end
@@ -507,8 +506,6 @@ describe('API: buffer events:', function()
end)
it('can notify several channels at once', function()
clear()
-- create several new sessions, in addition to our main API
local sessions = {}
local pipe = n.new_pipename()
@@ -781,8 +778,6 @@ describe('API: buffer events:', function()
end)
it('detaches if the buffer is unloaded/deleted/wiped', function()
-- start with a blank nvim
clear()
-- need to make a new window with a buffer because :bunload doesn't let you
-- unload the last buffer
for _, cmd in ipairs({ 'bunload', 'bdelete', 'bwipeout' }) do
@@ -798,20 +793,17 @@ describe('API: buffer events:', function()
end)
it('does not send the buffer content if not requested', function()
clear()
local b, tick = editoriginal(false)
ok(api.nvim_buf_attach(b, false, {}))
expectn('nvim_buf_changedtick_event', { b, tick })
end)
it('returns a proper error on nonempty options dict', function()
clear()
local b = editoriginal(false)
eq("Invalid key: 'builtin'", pcall_err(api.nvim_buf_attach, b, false, { builtin = 'asfd' }))
end)
it('nvim_buf_attach returns response after delay #8634', function()
clear()
sleep(250)
-- response
eq(true, n.request('nvim_buf_attach', 0, false, {}))

View File

@@ -48,8 +48,6 @@ describe("api_info()['version']", function()
end)
describe('api metadata', function()
before_each(clear)
local function name_table(entries)
local by_name = {}
for _, e in ipairs(entries) do
@@ -149,6 +147,8 @@ describe('api metadata', function()
clean_level_0(old_api[level])
end
end
-- No Nvim session will be used in the following tests.
n.check_close()
end)
it('functions are compatible with old metadata or have new level', function()