• R/O
  • SSH

vim: Commit

Mirror of the Vim source from https://github.com/vim/vim


Commit MetaInfo

Revisionf6eb0c468ae4ae1373f25dd6819e7aad3cf32351 (tree)
Zeit2020-07-01 02:00:04
AutorBram Moolenaar <Bram@vim....>
CommiterBram Moolenaar

Log Message

patch 8.2.1097: highlight code not sufficiently tested

Commit: https://github.com/vim/vim/commit/de8f0f47f653ff10bd8cc12b3e0817ed5bdf64ea
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Jun 30 18:45:43 2020 +0200

patch 8.2.1097: highlight code not sufficiently tested
Problem: Highlight code not sufficiently tested.
Solution: Add a few more tests. (Yegappan Lakshmanan, closes https://github.com/vim/vim/issues/6359)

Ändern Zusammenfassung

Diff

diff -r be4aa55f87a6 -r f6eb0c468ae4 src/testdir/test_filter_cmd.vim
--- a/src/testdir/test_filter_cmd.vim Tue Jun 30 13:45:07 2020 +0200
+++ b/src/testdir/test_filter_cmd.vim Tue Jun 30 19:00:04 2020 +0200
@@ -146,6 +146,11 @@
146146 let res = split(execute("filter /\.c$/ marks"), "\n")[1:]
147147 call assert_equal([" A 1 0 file.c"], res)
148148
149+ " Test filtering :highlight command
150+ highlight MyHlGroup ctermfg=10
151+ let res = split(execute("filter /MyHlGroup/ highlight"), "\n")
152+ call assert_equal(["MyHlGroup xxx ctermfg=10"], res)
153+
149154 call setline(1, ['one', 'two', 'three'])
150155 1mark a
151156 2mark b
diff -r be4aa55f87a6 -r f6eb0c468ae4 src/testdir/test_highlight.vim
--- a/src/testdir/test_highlight.vim Tue Jun 30 13:45:07 2020 +0200
+++ b/src/testdir/test_highlight.vim Tue Jun 30 19:00:04 2020 +0200
@@ -761,4 +761,47 @@
761761 hi clear
762762 endfunc
763763
764+" Test for using default highlighting group
765+func Test_highlight_default()
766+ highlight MySearch ctermfg=7
767+ highlight default MySearch ctermfg=5
768+ let hlSearch = HighlightArgs('MySearch')
769+ call assert_match('ctermfg=7', hlSearch)
770+
771+ highlight default QFName ctermfg=3
772+ call assert_match('ctermfg=3', HighlightArgs('QFName'))
773+ hi clear
774+endfunc
775+
776+" Test for 'ctermul in a highlight group
777+func Test_highlight_ctermul()
778+ CheckNotGui
779+ call assert_notmatch('ctermul=', HighlightArgs('Normal'))
780+ highlight Normal ctermul=3
781+ call assert_match('ctermul=3', HighlightArgs('Normal'))
782+ highlight Normal ctermul=NONE
783+endfunc
784+
785+" Test for specifying 'start' and 'stop' in a highlight group
786+func Test_highlight_start_stop()
787+ hi HlGrp1 start=<Esc>[27h;<Esc>[<Space>r;
788+ call assert_match("start=^[[27h;^[[ r;", HighlightArgs('HlGrp1'))
789+ hi HlGrp1 start=NONE
790+ call assert_notmatch("start=", HighlightArgs('HlGrp1'))
791+ hi HlGrp2 stop=<Esc>[27h;<Esc>[<Space>r;
792+ call assert_match("stop=^[[27h;^[[ r;", HighlightArgs('HlGrp2'))
793+ hi HlGrp2 stop=NONE
794+ call assert_notmatch("stop=", HighlightArgs('HlGrp2'))
795+ hi clear
796+endfunc
797+
798+" Test for setting various 'term' attributes
799+func Test_highlight_term_attr()
800+ hi HlGrp3 term=bold,underline,undercurl,strikethrough,reverse,italic,standout
801+ call assert_equal('hi HlGrp3 term=bold,standout,underline,undercurl,italic,reverse,strikethrough', HighlightArgs('HlGrp3'))
802+ hi HlGrp3 term=NONE
803+ call assert_equal('hi HlGrp3 cleared', HighlightArgs('HlGrp3'))
804+ hi clear
805+endfunc
806+
764807 " vim: shiftwidth=2 sts=2 expandtab
diff -r be4aa55f87a6 -r f6eb0c468ae4 src/version.c
--- a/src/version.c Tue Jun 30 13:45:07 2020 +0200
+++ b/src/version.c Tue Jun 30 19:00:04 2020 +0200
@@ -755,6 +755,8 @@
755755 static int included_patches[] =
756756 { /* Add new patch number below this line */
757757 /**/
758+ 1097,
759+/**/
758760 1096,
759761 /**/
760762 1095,
Show on old repository browser