summaryrefslogtreecommitdiff
path: root/src/testdir/test_highlight.vim
diff options
context:
space:
mode:
Diffstat (limited to 'src/testdir/test_highlight.vim')
-rw-r--r--src/testdir/test_highlight.vim34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/testdir/test_highlight.vim b/src/testdir/test_highlight.vim
index 5ad0c9414..a1c80cde6 100644
--- a/src/testdir/test_highlight.vim
+++ b/src/testdir/test_highlight.vim
@@ -3,6 +3,7 @@
source view_util.vim
source screendump.vim
source check.vim
+source script_util.vim
func Test_highlight()
" basic test if ":highlight" doesn't crash
@@ -870,6 +871,39 @@ func Test_highlight_clear_restores_links()
call assert_equal(HighlightArgs('aaa'), hl_aaa_ddd)
endfunc
+func Test_highlight_clear_restores_context()
+ func FuncContextDefault()
+ hi def link Context ContextDefault
+ endfun
+
+ func FuncContextRelink()
+ " Dummy line
+ hi link Context ContextRelink
+ endfunc
+
+ let scriptContextDefault = MakeScript("FuncContextDefault")
+ let scriptContextRelink = MakeScript("FuncContextRelink")
+ let patContextDefault = fnamemodify(scriptContextDefault, ':t') .. ' line 1'
+ let patContextRelink = fnamemodify(scriptContextRelink, ':t') .. ' line 2'
+
+ exec "source" scriptContextDefault
+ let hlContextDefault = execute("verbose hi Context")
+ call assert_match(patContextDefault, hlContextDefault)
+
+ exec "source" scriptContextRelink
+ let hlContextRelink = execute("verbose hi Context")
+ call assert_match(patContextRelink, hlContextRelink)
+
+ hi clear
+ let hlContextAfterClear = execute("verbose hi Context")
+ call assert_match(patContextDefault, hlContextAfterClear)
+
+ delfunc FuncContextDefault
+ delfunc FuncContextRelink
+ call delete(scriptContextDefault)
+ call delete(scriptContextRelink)
+endfunc
+
func Test_highlight_default_colorscheme_restores_links()
hi link TestLink Identifier
hi TestHi ctermbg=red