neovim

Neovim text editor
git clone https://git.dasho.dev/neovim.git
Log | Files | Refs | README

sign_spec.lua (1345B)


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