test_syn_attr.vim 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. " Test syntax highlighting functions.
  2. func Test_missing_attr()
  3. throw 'Skipped: use test/functional/legacy/syn_attr_spec.lua'
  4. hi Mine term=bold cterm=italic
  5. call assert_equal('Mine', synIDattr(hlID("Mine"), "name"))
  6. call assert_equal('', synIDattr("Mine"->hlID(), "bg", 'term'))
  7. call assert_equal('', synIDattr("Mine"->hlID(), "fg", 'term'))
  8. call assert_equal('', synIDattr("Mine"->hlID(), "sp", 'term'))
  9. call assert_equal('1', synIDattr(hlID("Mine"), "bold", 'term'))
  10. call assert_equal('1', synIDattr(hlID("Mine"), "italic", 'cterm'))
  11. hi Mine term=reverse cterm=inverse
  12. call assert_equal('1', synIDattr(hlID("Mine"), "reverse", 'term'))
  13. call assert_equal('1', synIDattr(hlID("Mine"), "inverse", 'cterm'))
  14. hi Mine term=underline cterm=standout gui=undercurl
  15. call assert_equal('1', synIDattr(hlID("Mine"), "underline", 'term'))
  16. call assert_equal('1', synIDattr(hlID("Mine"), "standout", 'cterm'))
  17. call assert_equal('1', synIDattr("Mine"->hlID(), "undercurl", 'gui'))
  18. hi Mine term=underdouble cterm=underdotted gui=underdashed
  19. call assert_equal('1', synIDattr(hlID("Mine"), "underdouble", 'term'))
  20. call assert_equal('1', synIDattr(hlID("Mine"), "underdotted", 'cterm'))
  21. call assert_equal('1', synIDattr("Mine"->hlID(), "underdashed", 'gui'))
  22. hi Mine term=nocombine gui=strikethrough
  23. call assert_equal('1', synIDattr(hlID("Mine"), "strikethrough", 'gui'))
  24. call assert_equal('1', synIDattr(hlID("Mine"), "nocombine", 'term'))
  25. call assert_equal('', synIDattr(hlID("Mine"), "nocombine", 'gui'))
  26. hi Mine term=NONE cterm=NONE gui=NONE
  27. call assert_equal('', synIDattr(hlID("Mine"), "bold", 'term'))
  28. call assert_equal('', synIDattr(hlID("Mine"), "italic", 'cterm'))
  29. call assert_equal('', synIDattr(hlID("Mine"), "reverse", 'term'))
  30. call assert_equal('', synIDattr(hlID("Mine"), "inverse", 'cterm'))
  31. call assert_equal('', synIDattr(hlID("Mine"), "underline", 'term'))
  32. call assert_equal('', synIDattr(hlID("Mine"), "standout", 'cterm'))
  33. call assert_equal('', synIDattr(hlID("Mine"), "undercurl", 'gui'))
  34. call assert_equal('', synIDattr(hlID("Mine"), "strikethrough", 'gui'))
  35. if has('gui')
  36. let fontname = getfontname()
  37. if fontname == ''
  38. let fontname = 'something'
  39. endif
  40. exe "hi Mine guifg=blue guibg=red font='" . fontname . "'"
  41. call assert_equal('blue', synIDattr(hlID("Mine"), "fg", 'gui'))
  42. call assert_equal('red', synIDattr(hlID("Mine"), "bg", 'gui'))
  43. call assert_equal(fontname, synIDattr(hlID("Mine"), "font", 'gui'))
  44. endif
  45. endfunc