blob: 51674d0ee2ca790e6775d9be0b8a3c2efbe83e8b [file] [log] [blame]
Bram Moolenaar385111b2016-03-12 19:23:00 +01001" Test syntax highlighting functions.
2
3func Test_missing_attr()
4 hi Mine term=bold cterm=italic
5 call assert_equal('Mine', synIDattr(hlID("Mine"), "name"))
6 call assert_equal('', synIDattr(hlID("Mine"), "bg", 'term'))
7 call assert_equal('1', synIDattr(hlID("Mine"), "bold", 'term'))
8 call assert_equal('1', synIDattr(hlID("Mine"), "italic", 'cterm'))
9 hi Mine term=reverse cterm=inverse
10 call assert_equal('1', synIDattr(hlID("Mine"), "reverse", 'term'))
11 call assert_equal('1', synIDattr(hlID("Mine"), "inverse", 'cterm'))
12 hi Mine term=underline cterm=standout gui=undercurl
13 call assert_equal('1', synIDattr(hlID("Mine"), "underline", 'term'))
14 call assert_equal('1', synIDattr(hlID("Mine"), "standout", 'cterm'))
15 call assert_equal('1', synIDattr(hlID("Mine"), "undercurl", 'gui'))
16 hi Mine term=NONE cterm=NONE gui=NONE
17 call assert_equal('', synIDattr(hlID("Mine"), "bold", 'term'))
18 call assert_equal('', synIDattr(hlID("Mine"), "italic", 'cterm'))
19 call assert_equal('', synIDattr(hlID("Mine"), "reverse", 'term'))
20 call assert_equal('', synIDattr(hlID("Mine"), "inverse", 'cterm'))
21 call assert_equal('', synIDattr(hlID("Mine"), "underline", 'term'))
22 call assert_equal('', synIDattr(hlID("Mine"), "standout", 'cterm'))
23 call assert_equal('', synIDattr(hlID("Mine"), "undercurl", 'gui'))
24
25 if has('gui')
Bram Moolenaarc8352932016-03-12 20:15:21 +010026 let fontname = getfontname()
27 if fontname == ''
28 let fontname = 'something'
29 endif
30 exe 'hi Mine guifg=blue guibg=red font=' . escape(fontname, ' \')
Bram Moolenaar385111b2016-03-12 19:23:00 +010031 call assert_equal('blue', synIDattr(hlID("Mine"), "fg", 'gui'))
32 call assert_equal('red', synIDattr(hlID("Mine"), "bg", 'gui'))
Bram Moolenaarc8352932016-03-12 20:15:21 +010033 call assert_equal(fontname, synIDattr(hlID("Mine"), "font", 'gui'))
Bram Moolenaar385111b2016-03-12 19:23:00 +010034 endif
35endfunc