highlight_spec.lua 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. local Screen = require('test.functional.ui.screen')
  2. local helpers = require("test.functional.helpers")(after_each)
  3. local eq, command = helpers.eq, helpers.command
  4. local clear = helpers.clear
  5. local eval, exc_exec = helpers.eval, helpers.exc_exec
  6. describe(':highlight', function()
  7. local screen
  8. before_each(function()
  9. clear()
  10. screen = Screen.new()
  11. screen:attach()
  12. end)
  13. it('invalid color name', function()
  14. eq('Vim(highlight):E421: Color name or number not recognized: ctermfg=#181818',
  15. exc_exec("highlight normal ctermfg=#181818"))
  16. eq('Vim(highlight):E421: Color name or number not recognized: ctermbg=#181818',
  17. exc_exec("highlight normal ctermbg=#181818"))
  18. end)
  19. it('invalid group name', function()
  20. eq('Vim(highlight):E411: highlight group not found: foo',
  21. exc_exec("highlight foo"))
  22. end)
  23. it('"Normal" foreground with red', function()
  24. eq('', eval('synIDattr(hlID("Normal"), "fg", "cterm")'))
  25. command('highlight normal ctermfg=red')
  26. eq('9', eval('synIDattr(hlID("Normal"), "fg", "cterm")'))
  27. end)
  28. it('"Normal" background with red', function()
  29. eq('', eval('synIDattr(hlID("Normal"), "bg", "cterm")'))
  30. command('highlight normal ctermbg=red')
  31. eq('9', eval('synIDattr(hlID("Normal"), "bg", "cterm")'))
  32. end)
  33. end)