summaryrefslogtreecommitdiff
path: root/src/testdir/test_highlight.vim
diff options
context:
space:
mode:
authorDrew Vogel <dvogel@github>2021-10-24 20:35:07 +0100
committerBram Moolenaar <Bram@vim.org>2021-10-24 20:35:07 +0100
commite30d10253fa634c4f60daa798d029245f4eed393 (patch)
tree57aca74b65dc4c3924ef23185b8cb2b6933996c2 /src/testdir/test_highlight.vim
parent3c5904d2a5d7861c227a4c3cd4ddcbc51014c838 (diff)
downloadvim-git-e30d10253fa634c4f60daa798d029245f4eed393.tar.gz
patch 8.2.3562: cannot add color namesv8.2.3562
Problem: Cannot add color names. Solution: Add the v:colornames dictionary. (Drew Vogel, closes #8761)
Diffstat (limited to 'src/testdir/test_highlight.vim')
-rw-r--r--src/testdir/test_highlight.vim36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/testdir/test_highlight.vim b/src/testdir/test_highlight.vim
index a4c7a7259..d3734b31f 100644
--- a/src/testdir/test_highlight.vim
+++ b/src/testdir/test_highlight.vim
@@ -934,4 +934,40 @@ func Test_highlight_default_colorscheme_restores_links()
hi clear
endfunc
+func Test_colornames_assignment_and_lookup()
+ " Ensure highlight command can find custom color.
+ let v:colornames['a redish white'] = '#ffeedd'
+ highlight Normal guifg='a redish white'
+ highlight clear
+endfunc
+
+func Test_colornames_default_list()
+ " Ensure default lists are loaded automatically and can be used for all gui fields.
+ highlight Normal guifg='rebecca purple' guibg='rebecca purple' guisp='rebecca purple'
+ highlight clear
+endfunc
+
+func Test_colornames_overwrite_default()
+ " Ensure entries in v:colornames can be overwritten.
+ " Load default color scheme to trigger default color list loading.
+ colorscheme default
+ let old_rebecca_purple = v:colornames['rebecca purple']
+ highlight Normal guifg='rebecca purple' guibg='rebecca purple'
+ let v:colornames['rebecca purple'] = '#550099'
+ highlight Normal guifg='rebecca purple' guibg='rebecca purple'
+ let v:colornames['rebecca purple'] = old_rebecca_purple
+ highlight clear
+endfunc
+
+func Test_colornames_assignment_and_unassignment()
+ " Ensure we cannot overwrite the v:colornames dict.
+ call assert_fails("let v:colornames = {}", 'E46:')
+
+ " Ensure we can delete entries from the v:colornames dict.
+ let v:colornames['x1'] = '#111111'
+ call assert_equal(v:colornames['x1'], '#111111')
+ unlet v:colornames['x1']
+ call assert_fails("echo v:colornames['x1']")
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab