Patch 8.2.1077
Problem:    No enough test coverage for highlighting.
Solution:   Add more tests. (Yegappan Lakshmanan, closes #6351)
Files:      runtime/doc/syntax.txt, src/testdir/test_cmdline.vim,
            src/testdir/test_highlight.vim, src/testdir/test_match.vim


*** ../vim-8.2.1076/runtime/doc/syntax.txt      2020-05-31 19:48:49.314871091 
+0200
--- runtime/doc/syntax.txt      2020-06-28 13:06:27.859138302 +0200
***************
*** 5004,5010 ****
        console.  Example, for reverse video: >
            :highlight Visual ctermfg=bg ctermbg=fg
  <     Note that the colors are used that are valid at the moment this
!       command are given.  If the Normal group colors are changed later, the
        "fg" and "bg" colors will not be adjusted.
  
  
--- 5018,5024 ----
        console.  Example, for reverse video: >
            :highlight Visual ctermfg=bg ctermbg=fg
  <     Note that the colors are used that are valid at the moment this
!       command is given.  If the Normal group colors are changed later, the
        "fg" and "bg" colors will not be adjusted.
  
  
*** ../vim-8.2.1076/src/testdir/test_cmdline.vim        2020-06-24 
13:37:03.162425194 +0200
--- src/testdir/test_cmdline.vim        2020-06-28 13:06:27.859138302 +0200
***************
*** 191,196 ****
--- 191,200 ----
    call assert_equal('"hi default', getreg(':'))
    call feedkeys(":hi c\<S-Tab>\<Home>\"\<CR>", 'xt')
    call assert_equal('"hi clear', getreg(':'))
+   call feedkeys(":hi clear Aardig Aard\<Tab>\<C-B>\"\<CR>", 'xt')
+   call assert_equal('"hi clear Aardig Aardig', getreg(':'))
+   call feedkeys(":hi Aardig \<Tab>\<C-B>\"\<CR>", 'xt')
+   call assert_equal("\"hi Aardig \t", getreg(':'))
  
    " A cleared group does not show up in completions.
    hi Anders ctermfg=green
***************
*** 201,206 ****
--- 205,218 ----
    call assert_equal([], getcompletion('A', 'highlight'))
  endfunc
  
+ " Test for command-line expansion of "hi Ni " (easter egg)
+ func Test_highlight_easter_egg()
+   call test_override('ui_delay', 1)
+   call feedkeys(":hi Ni \<Tab>\<C-B>\"\<CR>", 'xt')
+   call assert_equal("\"hi Ni \<Tab>", @:)
+   call test_override('ALL', 0)
+ endfunc
+ 
  func Test_getcompletion()
    if !has('cmdline_compl')
      return
*** ../vim-8.2.1076/src/testdir/test_highlight.vim      2020-04-08 
21:50:18.872619665 +0200
--- src/testdir/test_highlight.vim      2020-06-28 13:06:27.859138302 +0200
***************
*** 701,708 ****
  func Test_highlight_cmd_errors()
    if has('gui_running')
      " This test doesn't fail in the MS-Windows console version.
!     call assert_fails('hi Xcomment ctermfg=fg', 'E419:')
      call assert_fails('hi Xcomment ctermfg=bg', 'E420:')
    endif
  
    " Try using a very long terminal code. Define a dummy terminal code for this
--- 701,709 ----
  func Test_highlight_cmd_errors()
    if has('gui_running')
      " This test doesn't fail in the MS-Windows console version.
!     call assert_fails('hi Xcomment ctermbg=fg', 'E419:')
      call assert_fails('hi Xcomment ctermfg=bg', 'E420:')
+     call assert_fails('hi Xcomment ctermfg=ul', 'E453:')
    endif
  
    " Try using a very long terminal code. Define a dummy terminal code for this
***************
*** 713,716 ****
--- 714,764 ----
    let &t_fo = ""
  endfunc
  
+ " Test for 'highlight' option
+ func Test_highlight_opt()
+   let save_hl = &highlight
+   call assert_fails('set highlight=j:b', 'E474:')
+   set highlight=f\ r
+   call assert_equal('f r', &highlight)
+   set highlight=fb
+   call assert_equal('fb', &highlight)
+   set highlight=fi
+   call assert_equal('fi', &highlight)
+   set highlight=f-
+   call assert_equal('f-', &highlight)
+   set highlight=fr
+   call assert_equal('fr', &highlight)
+   set highlight=fs
+   call assert_equal('fs', &highlight)
+   set highlight=fu
+   call assert_equal('fu', &highlight)
+   set highlight=fc
+   call assert_equal('fc', &highlight)
+   set highlight=ft
+   call assert_equal('ft', &highlight)
+   call assert_fails('set highlight=fr:Search', 'E474:')
+   set highlight=f:$#
+   call assert_match('W18:', v:statusmsg)
+   let &highlight = save_hl
+ endfunc
+ 
+ " Test for User group highlighting used in the statusline
+ func Test_highlight_User()
+   CheckNotGui
+   hi User1 ctermfg=12
+   redraw!
+   call assert_equal('12', synIDattr(synIDtrans(hlID('User1')), 'fg'))
+   hi clear
+ endfunc
+ 
+ " Test for using RGB color values in a highlight group
+ func Test_highlight_RGB_color()
+   CheckGui
+   hi MySearch guifg=#110000 guibg=#001100 guisp=#000011
+   call assert_equal('#110000', synIDattr(synIDtrans(hlID('MySearch')), 'fg#'))
+   call assert_equal('#001100', synIDattr(synIDtrans(hlID('MySearch')), 'bg#'))
+   call assert_equal('#000011', synIDattr(synIDtrans(hlID('MySearch')), 'sp#'))
+   hi clear
+ endfunc
+ 
  " vim: shiftwidth=2 sts=2 expandtab
*** ../vim-8.2.1076/src/testdir/test_match.vim  2020-05-31 21:27:58.331221914 
+0200
--- src/testdir/test_match.vim  2020-06-28 13:06:27.859138302 +0200
***************
*** 98,103 ****
--- 98,104 ----
    call assert_fails('call setmatches(0)', 'E714:')
    call assert_fails('call setmatches([0])', 'E474:')
    call assert_fails("call setmatches([{'wrong key': 'wrong value'}])", 
'E474:')
+   call assert_equal(-1, setmatches([{'group' : 'Search', 'priority' : 10, 
'id' : 5, 'pos1' : {}}]))
  
    call setline(1, 'abcdefghijklmnopq')
    call matchaddpos("MyGroup1", [[1, 5], [1, 8, 3]], 10, 3)
***************
*** 164,169 ****
--- 165,172 ----
    call assert_fails("call matchadd('Error', 'XXX', 1, 3)", 'E798:')
    call assert_fails("call matchadd('Error', 'XXX', 1, 0)", 'E799:')
    call assert_fails("call matchadd('Error', 'XXX', [], 0)", 'E745:')
+   call assert_equal(-1, matchadd('', 'pat'))
+   call assert_equal(-1, matchadd('Search', ''))
  endfunc
  
  func Test_matchaddpos()
***************
*** 202,207 ****
--- 205,218 ----
    call assert_equal(screenattr(2,2), screenattr(1,10))
    call assert_notequal(screenattr(2,2), screenattr(1,11))
  
+   " matchaddpos() with line number as 0
+   call clearmatches()
+   let id = matchaddpos('Search', [[0], [3], [0]])
+   call assert_equal([{'group' : 'Search', 'priority' : 10, 'id' : id, 'pos1' 
: [3]}], getmatches())
+   call clearmatches()
+   let id = matchaddpos('Search', [0, 3, 0])
+   call assert_equal([{'group' : 'Search', 'priority' : 10, 'id' : id, 'pos1' 
: [3]}], getmatches())
+ 
    nohl
    call clearmatches()
    syntax off
***************
*** 233,238 ****
--- 244,250 ----
  
    eval winid->clearmatches()
    call assert_equal([], getmatches(winid))
+   call assert_fails('echo getmatches(-1)', 'E957:')
  
    call setmatches(savematches, winid)
    call assert_equal(expect, savematches)
***************
*** 281,286 ****
--- 293,302 ----
    call assert_fails("call matchaddpos('Error', [{}])", 'E290:')
    call assert_equal(-1, matchaddpos('Error', test_null_list()))
    call assert_fails("call matchaddpos('Error', [1], [], 1)", 'E745:')
+   call assert_equal(-1, matchaddpos('Search', [[]]))
+   call assert_fails("call matchaddpos('Search', [[{}]])", 'E728:')
+   call assert_fails("call matchaddpos('Search', [[2, {}]])", 'E728:')
+   call assert_fails("call matchaddpos('Search', [[3, 4, {}]])", 'E728:')
  endfunc
  
  func OtherWindowCommon()
***************
*** 333,336 ****
--- 349,372 ----
    call delete('XscriptMatchCommon')
  endfunc
  
+ " Test for deleting matches outside of the screen redraw top/bottom lines
+ " This should cause a redraw of those lines.
+ func Test_matchdelete_redraw()
+   new
+   call setline(1, range(1, 500))
+   call cursor(250, 1)
+   let m1 = matchaddpos('Search', [[250]])
+   let m2 = matchaddpos('Search', [[10], [450]])
+   redraw!
+   let m3 = matchaddpos('Search', [[240], [260]])
+   call matchdelete(m2)
+   let m = getmatches()
+   call assert_equal(2, len(m))
+   call assert_equal([250], m[0].pos1)
+   redraw!
+   call matchdelete(m1)
+   call assert_equal(1, len(getmatches()))
+   bw!
+ endfunc
+ 
  " vim: shiftwidth=2 sts=2 expandtab
*** ../vim-8.2.1076/src/version.c       2020-06-27 23:07:31.959995377 +0200
--- src/version.c       2020-06-28 13:07:55.646750736 +0200
***************
*** 756,757 ****
--- 756,759 ----
  {   /* Add new patch number below this line */
+ /**/
+     1077,
  /**/

-- 
   [The rest of the ARMY stand around looking at a loss.]
INSPECTOR END OF FILM: (picks up megaphone) All right!  Clear off!  Go on!
                 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/202006281110.05SBAtRW316161%40masaka.moolenaar.net.

Raspunde prin e-mail lui