Mercurial > vim
diff src/testdir/test_highlight.vim @ 26057:92c424550367 v8.2.3562
patch 8.2.3562: cannot add color names
Commit: https://github.com/vim/vim/commit/e30d10253fa634c4f60daa798d029245f4eed393
Author: Drew Vogel <dvogel@github>
Date: Sun Oct 24 20:35:07 2021 +0100
patch 8.2.3562: cannot add color names
Problem: Cannot add color names.
Solution: Add the v:colornames dictionary. (Drew Vogel, closes https://github.com/vim/vim/issues/8761)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 24 Oct 2021 21:45:04 +0200 |
parents | f07068ed0d3d |
children | c544eacaf066 |
line wrap: on
line diff
--- a/src/testdir/test_highlight.vim +++ b/src/testdir/test_highlight.vim @@ -934,4 +934,40 @@ func Test_highlight_default_colorscheme_ 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