aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/testdir/test_syn_attr.vim
blob: fa0b08fde5bc5942470efb86b80e62e2f09311a9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
" Test syntax highlighting functions.

func Test_missing_attr()
  hi Mine cterm=italic
  call assert_equal('Mine', synIDattr(hlID("Mine"), "name"))
  call assert_equal('1', synIDattr(hlID("Mine"), "italic", 'cterm'))
  hi Mine cterm=inverse
  call assert_equal('1', synIDattr(hlID("Mine"), "inverse", 'cterm'))
  hi Mine cterm=standout gui=undercurl
  call assert_equal('1', synIDattr(hlID("Mine"), "standout", 'cterm'))
  call assert_equal('1', synIDattr("Mine"->hlID(), "undercurl", 'gui'))
  hi Mine gui=strikethrough
  call assert_equal('1', synIDattr(hlID("Mine"), "strikethrough", 'gui'))
  hi Mine cterm=NONE gui=NONE
  call assert_equal('', synIDattr(hlID("Mine"), "italic", 'cterm'))
  call assert_equal('', synIDattr(hlID("Mine"), "inverse", 'cterm'))
  call assert_equal('', synIDattr(hlID("Mine"), "standout", 'cterm'))
  call assert_equal('', synIDattr(hlID("Mine"), "undercurl", 'gui'))
  call assert_equal('', synIDattr(hlID("Mine"), "strikethrough", 'gui'))

  if has('gui')
    let fontname = getfontname()
    if fontname == ''
      let fontname = 'something'
    endif
    exe "hi Mine guifg=blue guibg=red font='" . fontname . "'"
    call assert_equal('blue', synIDattr(hlID("Mine"), "fg", 'gui'))
    call assert_equal('red', synIDattr(hlID("Mine"), "bg", 'gui'))
    call assert_equal(fontname, synIDattr(hlID("Mine"), "font", 'gui'))
  endif
endfunc