Mercurial > vim
comparison src/testdir/test_highlight.vim @ 22312:e06ba60fbbd8 v8.2.1705
patch 8.2.1705: "verbose hi Name" reports incorrect info after ":hi clear"
Commit: https://github.com/vim/vim/commit/e8df0104985af58ee501a6fbac8ac9f886e84e5a
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri Sep 18 19:40:45 2020 +0200
patch 8.2.1705: "verbose hi Name" reports incorrect info after ":hi clear"
Problem: "verbose hi Name" reports incorrect info after ":hi clear".
Solution: Store the script context. (Antony Scriven, closes https://github.com/vim/vim/issues/6975)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Fri, 18 Sep 2020 19:45:04 +0200 |
parents | 19e0784ef769 |
children | d275371fd1e7 |
comparison
equal
deleted
inserted
replaced
22311:fe6103bf9b0a | 22312:e06ba60fbbd8 |
---|---|
1 " Tests for ":highlight" and highlighting. | 1 " Tests for ":highlight" and highlighting. |
2 | 2 |
3 source view_util.vim | 3 source view_util.vim |
4 source screendump.vim | 4 source screendump.vim |
5 source check.vim | 5 source check.vim |
6 source script_util.vim | |
6 | 7 |
7 func Test_highlight() | 8 func Test_highlight() |
8 " basic test if ":highlight" doesn't crash | 9 " basic test if ":highlight" doesn't crash |
9 highlight | 10 highlight |
10 hi Search | 11 hi Search |
868 call assert_equal(synIDtrans(id_aaa), eee_id) | 869 call assert_equal(synIDtrans(id_aaa), eee_id) |
869 hi clear aaa | 870 hi clear aaa |
870 call assert_equal(HighlightArgs('aaa'), hl_aaa_ddd) | 871 call assert_equal(HighlightArgs('aaa'), hl_aaa_ddd) |
871 endfunc | 872 endfunc |
872 | 873 |
874 func Test_highlight_clear_restores_context() | |
875 func FuncContextDefault() | |
876 hi def link Context ContextDefault | |
877 endfun | |
878 | |
879 func FuncContextRelink() | |
880 " Dummy line | |
881 hi link Context ContextRelink | |
882 endfunc | |
883 | |
884 let scriptContextDefault = MakeScript("FuncContextDefault") | |
885 let scriptContextRelink = MakeScript("FuncContextRelink") | |
886 let patContextDefault = fnamemodify(scriptContextDefault, ':t') .. ' line 1' | |
887 let patContextRelink = fnamemodify(scriptContextRelink, ':t') .. ' line 2' | |
888 | |
889 exec "source" scriptContextDefault | |
890 let hlContextDefault = execute("verbose hi Context") | |
891 call assert_match(patContextDefault, hlContextDefault) | |
892 | |
893 exec "source" scriptContextRelink | |
894 let hlContextRelink = execute("verbose hi Context") | |
895 call assert_match(patContextRelink, hlContextRelink) | |
896 | |
897 hi clear | |
898 let hlContextAfterClear = execute("verbose hi Context") | |
899 call assert_match(patContextDefault, hlContextAfterClear) | |
900 | |
901 delfunc FuncContextDefault | |
902 delfunc FuncContextRelink | |
903 call delete(scriptContextDefault) | |
904 call delete(scriptContextRelink) | |
905 endfunc | |
906 | |
873 func Test_highlight_default_colorscheme_restores_links() | 907 func Test_highlight_default_colorscheme_restores_links() |
874 hi link TestLink Identifier | 908 hi link TestLink Identifier |
875 hi TestHi ctermbg=red | 909 hi TestHi ctermbg=red |
876 | 910 |
877 let hlTestLinkPre = HighlightArgs('TestLink') | 911 let hlTestLinkPre = HighlightArgs('TestLink') |