mirror of
https://github.com/vim/vim.git
synced 2025-07-26 11:04:33 -04:00
patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Problem: No tests for diff_hlID() and diff_filler(). Solution: Add tests. (Dominique Pelle, closes #2156)
This commit is contained in:
parent
2a02745709
commit
97fbc404fc
@ -501,7 +501,7 @@ func Test_diffpatch()
|
|||||||
3
|
3
|
||||||
+ 4
|
+ 4
|
||||||
.
|
.
|
||||||
saveas Xpatch
|
saveas! Xpatch
|
||||||
bwipe!
|
bwipe!
|
||||||
new
|
new
|
||||||
call assert_fails('diffpatch Xpatch', 'E816:')
|
call assert_fails('diffpatch Xpatch', 'E816:')
|
||||||
@ -547,6 +547,47 @@ func Test_diff_nomodifiable()
|
|||||||
%bwipe!
|
%bwipe!
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
func Test_diff_hlID()
|
||||||
|
new
|
||||||
|
call setline(1, [1, 2, 3])
|
||||||
|
diffthis
|
||||||
|
vnew
|
||||||
|
call setline(1, ['1x', 2, 'x', 3])
|
||||||
|
diffthis
|
||||||
|
redraw
|
||||||
|
|
||||||
|
call assert_equal(synIDattr(diff_hlID(-1, 1), "name"), "")
|
||||||
|
|
||||||
|
call assert_equal(synIDattr(diff_hlID(1, 1), "name"), "DiffChange")
|
||||||
|
call assert_equal(synIDattr(diff_hlID(1, 2), "name"), "DiffText")
|
||||||
|
call assert_equal(synIDattr(diff_hlID(2, 1), "name"), "")
|
||||||
|
call assert_equal(synIDattr(diff_hlID(3, 1), "name"), "DiffAdd")
|
||||||
|
call assert_equal(synIDattr(diff_hlID(4, 1), "name"), "")
|
||||||
|
|
||||||
|
wincmd w
|
||||||
|
call assert_equal(synIDattr(diff_hlID(1, 1), "name"), "DiffChange")
|
||||||
|
call assert_equal(synIDattr(diff_hlID(2, 1), "name"), "")
|
||||||
|
call assert_equal(synIDattr(diff_hlID(3, 1), "name"), "")
|
||||||
|
|
||||||
|
%bwipe!
|
||||||
|
endfunc
|
||||||
|
|
||||||
|
func Test_diff_filler()
|
||||||
|
new
|
||||||
|
call setline(1, [1, 2, 3, 'x', 4])
|
||||||
|
diffthis
|
||||||
|
vnew
|
||||||
|
call setline(1, [1, 2, 'y', 'y', 3, 4])
|
||||||
|
diffthis
|
||||||
|
redraw
|
||||||
|
|
||||||
|
call assert_equal([0, 0, 0, 0, 0, 0, 0, 1, 0], map(range(-1, 7), 'diff_filler(v:val)'))
|
||||||
|
wincmd w
|
||||||
|
call assert_equal([0, 0, 0, 0, 2, 0, 0, 0], map(range(-1, 6), 'diff_filler(v:val)'))
|
||||||
|
|
||||||
|
%bwipe!
|
||||||
|
endfunc
|
||||||
|
|
||||||
func Test_diff_lastline()
|
func Test_diff_lastline()
|
||||||
enew!
|
enew!
|
||||||
only!
|
only!
|
||||||
|
@ -761,6 +761,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
1153,
|
||||||
/**/
|
/**/
|
||||||
1152,
|
1152,
|
||||||
/**/
|
/**/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user