sign_spec.lua 1.3 KB

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