aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/testdir
diff options
context:
space:
mode:
authorStéphane Campinas <stephane.campinas@gmail.com>2016-09-10 20:35:47 +0100
committerJustin M. Keyes <justinkz@gmail.com>2016-09-16 14:00:10 +0200
commitbc1a5db6cc103f125a3705970d0018fb145aca4a (patch)
tree1199832617fddcbd61f6c2f3c8e523ff437a2665 /src/nvim/testdir
parent6e9f329d051cf6bf6d83dbe5335f86a1752ec45a (diff)
downloadrneovim-bc1a5db6cc103f125a3705970d0018fb145aca4a.tar.gz
rneovim-bc1a5db6cc103f125a3705970d0018fb145aca4a.tar.bz2
rneovim-bc1a5db6cc103f125a3705970d0018fb145aca4a.zip
vim-patch:7.4.1547 #5326
Problem: Getting a cterm highlight attribute that is not set results in the string "-1". Solution: Return an empty string. (Taro Muraoka) https://github.com/vim/vim/commit/385111bd86e0b38667879c3e89506ca1ae98e1df
Diffstat (limited to 'src/nvim/testdir')
-rw-r--r--src/nvim/testdir/test_alot.vim1
-rw-r--r--src/nvim/testdir/test_syn_attr.vim31
2 files changed, 32 insertions, 0 deletions
diff --git a/src/nvim/testdir/test_alot.vim b/src/nvim/testdir/test_alot.vim
index e5214971b4..f0efd6e4ed 100644
--- a/src/nvim/testdir/test_alot.vim
+++ b/src/nvim/testdir/test_alot.vim
@@ -8,4 +8,5 @@ source test_cmdline.vim
source test_menu.vim
source test_popup.vim
source test_regexp_utf8.vim
+source test_syn_attr.vim
source test_unlet.vim
diff --git a/src/nvim/testdir/test_syn_attr.vim b/src/nvim/testdir/test_syn_attr.vim
new file mode 100644
index 0000000000..20e9b17c46
--- /dev/null
+++ b/src/nvim/testdir/test_syn_attr.vim
@@ -0,0 +1,31 @@
+" 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')
+ hi Mine guifg=blue guibg=red font=something
+ call assert_equal('blue', synIDattr(hlID("Mine"), "fg", 'gui'))
+ call assert_equal('red', synIDattr(hlID("Mine"), "bg", 'gui'))
+ call assert_equal('something', synIDattr(hlID("Mine"), "font", 'gui'))
+ endif
+endfunc