robin/laufey

git clone https://git.robinwobin.dev/robin/laufey

Justin M. KeyesMerge #40865 from justinmk/fixcif907614088

master
1.4 KiB36 linesraw
1local t = require('test.testutil')
2local n = require('test.functional.testnvim')()
3
4local describe, it, before_each = t.describe, t.it, t.before_each
5local clear, eq, assert_alive = n.clear, t.eq, n.assert_alive
6local command = n.command
7local api = n.api
8
9describe('sign', function()
10  before_each(clear)
11  describe('unplace {id}', function()
12    describe('without specifying buffer', function()
13      it('deletes the sign from all buffers', function()
14        -- place a sign with id 34 to first buffer
15        command('sign define Foo text=+ texthl=Delimiter linehl=Comment numhl=Number')
16        local buf1 = api.nvim_eval('bufnr("%")')
17        command('sign place 34 line=3 name=Foo buffer=' .. buf1)
18        -- create a second buffer and place the sign on it as well
19        command('new')
20        local buf2 = api.nvim_eval('bufnr("%")')
21        command('sign place 34 line=3 name=Foo buffer=' .. buf2)
22        -- now unplace without specifying a buffer
23        command('sign unplace 34')
24        eq('--- Signs ---', api.nvim_exec('sign place buffer=' .. buf1, true))
25        eq('--- Signs ---', api.nvim_exec('sign place buffer=' .. buf2, true))
26      end)
27    end)
28  end)
29
30  describe('define {id}', function()
31    it('does not leak memory when specifying multiple times the same argument', function()
32      command('sign define Foo culhl=Normal culhl=Normal')
33      assert_alive()
34    end)
35  end)
36end)