2024-04-09 04:26:16 -07:00
|
|
|
local t = require('test.functional.testutil')()
|
2024-04-08 02:03:20 -07:00
|
|
|
local clear, eq, assert_alive = t.clear, t.eq, t.assert_alive
|
|
|
|
local command = t.command
|
|
|
|
local api = t.api
|
2014-10-27 13:29:44 -07:00
|
|
|
|
|
|
|
describe('sign', function()
|
2015-03-28 08:03:13 -07:00
|
|
|
before_each(clear)
|
2014-10-27 13:29:44 -07:00
|
|
|
describe('unplace {id}', function()
|
|
|
|
describe('without specifying buffer', function()
|
|
|
|
it('deletes the sign from all buffers', function()
|
|
|
|
-- place a sign with id 34 to first buffer
|
2024-01-12 06:11:28 -07:00
|
|
|
command('sign define Foo text=+ texthl=Delimiter linehl=Comment numhl=Number')
|
2024-01-12 10:59:57 -07:00
|
|
|
local buf1 = api.nvim_eval('bufnr("%")')
|
2024-01-12 06:11:28 -07:00
|
|
|
command('sign place 34 line=3 name=Foo buffer=' .. buf1)
|
2014-10-27 13:29:44 -07:00
|
|
|
-- create a second buffer and place the sign on it as well
|
2024-01-12 06:11:28 -07:00
|
|
|
command('new')
|
2024-01-12 10:59:57 -07:00
|
|
|
local buf2 = api.nvim_eval('bufnr("%")')
|
2024-01-12 06:11:28 -07:00
|
|
|
command('sign place 34 line=3 name=Foo buffer=' .. buf2)
|
2014-10-27 13:29:44 -07:00
|
|
|
-- now unplace without specifying a buffer
|
2024-01-12 06:11:28 -07:00
|
|
|
command('sign unplace 34')
|
2024-01-12 10:59:57 -07:00
|
|
|
eq('--- Signs ---\n', api.nvim_exec('sign place buffer=' .. buf1, true))
|
|
|
|
eq('--- Signs ---\n', api.nvim_exec('sign place buffer=' .. buf2, true))
|
2014-10-27 13:29:44 -07:00
|
|
|
end)
|
|
|
|
end)
|
|
|
|
end)
|
2022-06-23 23:29:15 -07:00
|
|
|
|
|
|
|
describe('define {id}', function()
|
|
|
|
it('does not leak memory when specifying multiple times the same argument', function()
|
2024-01-12 06:11:28 -07:00
|
|
|
command('sign define Foo culhl=Normal culhl=Normal')
|
2022-06-23 23:29:15 -07:00
|
|
|
assert_alive()
|
|
|
|
end)
|
|
|
|
end)
|
2014-10-27 13:29:44 -07:00
|
|
|
end)
|