comparison 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
comparison
equal deleted inserted replaced
26056:977bbbf36908 26057:92c424550367
932 call assert_equal(hlTestLinkPre, hlTestLinkPost) 932 call assert_equal(hlTestLinkPre, hlTestLinkPost)
933 call assert_equal(hlTestHiPre, hlTestHiPost) 933 call assert_equal(hlTestHiPre, hlTestHiPost)
934 hi clear 934 hi clear
935 endfunc 935 endfunc
936 936
937 func Test_colornames_assignment_and_lookup()
938 " Ensure highlight command can find custom color.
939 let v:colornames['a redish white'] = '#ffeedd'
940 highlight Normal guifg='a redish white'
941 highlight clear
942 endfunc
943
944 func Test_colornames_default_list()
945 " Ensure default lists are loaded automatically and can be used for all gui fields.
946 highlight Normal guifg='rebecca purple' guibg='rebecca purple' guisp='rebecca purple'
947 highlight clear
948 endfunc
949
950 func Test_colornames_overwrite_default()
951 " Ensure entries in v:colornames can be overwritten.
952 " Load default color scheme to trigger default color list loading.
953 colorscheme default
954 let old_rebecca_purple = v:colornames['rebecca purple']
955 highlight Normal guifg='rebecca purple' guibg='rebecca purple'
956 let v:colornames['rebecca purple'] = '#550099'
957 highlight Normal guifg='rebecca purple' guibg='rebecca purple'
958 let v:colornames['rebecca purple'] = old_rebecca_purple
959 highlight clear
960 endfunc
961
962 func Test_colornames_assignment_and_unassignment()
963 " Ensure we cannot overwrite the v:colornames dict.
964 call assert_fails("let v:colornames = {}", 'E46:')
965
966 " Ensure we can delete entries from the v:colornames dict.
967 let v:colornames['x1'] = '#111111'
968 call assert_equal(v:colornames['x1'], '#111111')
969 unlet v:colornames['x1']
970 call assert_fails("echo v:colornames['x1']")
971 endfunc
972
937 " vim: shiftwidth=2 sts=2 expandtab 973 " vim: shiftwidth=2 sts=2 expandtab