robin/laufey

git clone https://git.robinwobin.dev/robin/laufey

dundargoctest: move oldtests to test directory (#22536)af23d17388

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