view src/testdir/test_syn_attr.vim @ 8905:9200836eee15 v7.4.1739

commit https://github.com/vim/vim/commit/bea1ede1c59a11ca5bf9d91cd30b7b2937b9fb41 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Apr 14 19:44:36 2016 +0200 patch 7.4.1739 Problem: Messages test fails on MS-Windows. Solution: Adjust the asserts. Skip the "messages maintainer" line if not showing all messages.
author Christian Brabandt <cb@256bit.org>
date Thu, 14 Apr 2016 19:45:04 +0200
parents 24ac80377d86
children 35422e34815f
line wrap: on
line source

" Test syntax highlighting functions.

func Test_missing_attr()
  hi Mine term=bold cterm=italic
  call assert_equal('Mine', synIDattr(hlID("Mine"), "name"))
  call assert_equal('', synIDattr(hlID("Mine"), "bg", 'term'))
  call assert_equal('1', synIDattr(hlID("Mine"), "bold", 'term'))
  call assert_equal('1', synIDattr(hlID("Mine"), "italic", 'cterm'))
  hi Mine term=reverse cterm=inverse
  call assert_equal('1', synIDattr(hlID("Mine"), "reverse", 'term'))
  call assert_equal('1', synIDattr(hlID("Mine"), "inverse", 'cterm'))
  hi Mine term=underline cterm=standout gui=undercurl
  call assert_equal('1', synIDattr(hlID("Mine"), "underline", 'term'))
  call assert_equal('1', synIDattr(hlID("Mine"), "standout", 'cterm'))
  call assert_equal('1', synIDattr(hlID("Mine"), "undercurl", 'gui'))
  hi Mine term=NONE cterm=NONE gui=NONE
  call assert_equal('', synIDattr(hlID("Mine"), "bold", 'term'))
  call assert_equal('', synIDattr(hlID("Mine"), "italic", 'cterm'))
  call assert_equal('', synIDattr(hlID("Mine"), "reverse", 'term'))
  call assert_equal('', synIDattr(hlID("Mine"), "inverse", 'cterm'))
  call assert_equal('', synIDattr(hlID("Mine"), "underline", 'term'))
  call assert_equal('', synIDattr(hlID("Mine"), "standout", 'cterm'))
  call assert_equal('', synIDattr(hlID("Mine"), "undercurl", 'gui'))

  if has('gui')
    let fontname = getfontname()
    if fontname == ''
      let fontname = 'something'
    endif
    exe 'hi Mine guifg=blue guibg=red font=' . escape(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