Skip to content

Commit aeb661e

Browse files
committed
patch 8.0.0381: diff mode is not sufficiently tested
Problem: Diff mode is not sufficiently tested. Solution: Add more diff mode tests. (Dominique Pelle, closes #1515)
1 parent 38632fa commit aeb661e

File tree

2 files changed

+77
-0
lines changed

2 files changed

+77
-0
lines changed

src/testdir/test_diffmode.vim

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,3 +272,78 @@ func Test_setting_cursor()
272272
call delete('Xtest1')
273273
call delete('Xtest2')
274274
endfunc
275+
276+
func Test_diff_move_to()
277+
new
278+
call setline(1, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10])
279+
diffthis
280+
vnew
281+
call setline(1, [1, '2x', 3, 4, 4, 5, '6x', 7, '8x', 9, '10x'])
282+
diffthis
283+
norm ]c
284+
call assert_equal(2, line('.'))
285+
norm 3]c
286+
call assert_equal(9, line('.'))
287+
norm 10]c
288+
call assert_equal(11, line('.'))
289+
norm [c
290+
call assert_equal(9, line('.'))
291+
norm 2[c
292+
call assert_equal(5, line('.'))
293+
norm 10[c
294+
call assert_equal(2, line('.'))
295+
%bwipe!
296+
endfunc
297+
298+
func Test_diffpatch()
299+
" The patch program on MS-Windows may fail or hang.
300+
if !executable('patch') || !has('unix')
301+
return
302+
endif
303+
new
304+
insert
305+
***************
306+
*** 1,3 ****
307+
1
308+
! 2
309+
3
310+
--- 1,4 ----
311+
1
312+
! 2x
313+
3
314+
+ 4
315+
.
316+
saveas Xpatch
317+
bwipe!
318+
new
319+
call assert_fails('diffpatch Xpatch', 'E816:')
320+
call setline(1, ['1', '2', '3'])
321+
diffpatch Xpatch
322+
call assert_equal(['1', '2x', '3', '4'], getline(1, '$'))
323+
call delete('Xpatch')
324+
bwipe!
325+
endfunc
326+
327+
func Test_diff_too_many_buffers()
328+
for i in range(1, 8)
329+
exe "new Xtest" . i
330+
diffthis
331+
endfor
332+
new Xtest9
333+
call assert_fails('diffthis', 'E96:')
334+
%bwipe!
335+
endfunc
336+
337+
func Test_diff_nomodifiable()
338+
new
339+
call setline(1, [1, 2, 3, 4])
340+
setl nomodifiable
341+
diffthis
342+
vnew
343+
call setline(1, ['1x', 2, 3, 3, 4])
344+
diffthis
345+
call assert_fails('norm dp', 'E793:')
346+
setl nomodifiable
347+
call assert_fails('norm do', 'E21:')
348+
%bwipe!
349+
endfunc

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -764,6 +764,8 @@ static char *(features[]) =
764764

765765
static int included_patches[] =
766766
{ /* Add new patch number below this line */
767+
/**/
768+
381,
767769
/**/
768770
380,
769771
/**/

0 commit comments

Comments
 (0)