comparison src/testdir/test_diffmode.vim @ 12549:62e8cef76508 v8.0.1153

patch 8.0.1153: no tests for diff_hlID() and diff_filler() commit https://github.com/vim/vim/commit/97fbc404fc56f76df12b2d2658b1d6efda28d5dd Author: Bram Moolenaar <Bram@vim.org> Date: Tue Sep 26 19:41:46 2017 +0200 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 https://github.com/vim/vim/issues/2156)
author Christian Brabandt <cb@256bit.org>
date Tue, 26 Sep 2017 19:45:04 +0200
parents 40ee9f3d265f
children 1fad9675d8fd
comparison
equal deleted inserted replaced
12548:6080d29645ae 12549:62e8cef76508
418 put =range(1,90) 418 put =range(1,90)
419 wq 419 wq
420 new Xtest2 420 new Xtest2
421 put =range(1,100) 421 put =range(1,100)
422 wq 422 wq
423 423
424 tabe Xtest2 424 tabe Xtest2
425 $ 425 $
426 diffsp Xtest1 426 diffsp Xtest1
427 tabclose 427 tabclose
428 428
499 1 499 1
500 ! 2x 500 ! 2x
501 3 501 3
502 + 4 502 + 4
503 . 503 .
504 saveas Xpatch 504 saveas! Xpatch
505 bwipe! 505 bwipe!
506 new 506 new
507 call assert_fails('diffpatch Xpatch', 'E816:') 507 call assert_fails('diffpatch Xpatch', 'E816:')
508 508
509 for name in ['Xpatch', 'Xpatch$HOME', 'Xpa''tch'] 509 for name in ['Xpatch', 'Xpatch$HOME', 'Xpa''tch']
545 setl nomodifiable 545 setl nomodifiable
546 call assert_fails('norm do', 'E21:') 546 call assert_fails('norm do', 'E21:')
547 %bwipe! 547 %bwipe!
548 endfunc 548 endfunc
549 549
550 func Test_diff_hlID()
551 new
552 call setline(1, [1, 2, 3])
553 diffthis
554 vnew
555 call setline(1, ['1x', 2, 'x', 3])
556 diffthis
557 redraw
558
559 call assert_equal(synIDattr(diff_hlID(-1, 1), "name"), "")
560
561 call assert_equal(synIDattr(diff_hlID(1, 1), "name"), "DiffChange")
562 call assert_equal(synIDattr(diff_hlID(1, 2), "name"), "DiffText")
563 call assert_equal(synIDattr(diff_hlID(2, 1), "name"), "")
564 call assert_equal(synIDattr(diff_hlID(3, 1), "name"), "DiffAdd")
565 call assert_equal(synIDattr(diff_hlID(4, 1), "name"), "")
566
567 wincmd w
568 call assert_equal(synIDattr(diff_hlID(1, 1), "name"), "DiffChange")
569 call assert_equal(synIDattr(diff_hlID(2, 1), "name"), "")
570 call assert_equal(synIDattr(diff_hlID(3, 1), "name"), "")
571
572 %bwipe!
573 endfunc
574
575 func Test_diff_filler()
576 new
577 call setline(1, [1, 2, 3, 'x', 4])
578 diffthis
579 vnew
580 call setline(1, [1, 2, 'y', 'y', 3, 4])
581 diffthis
582 redraw
583
584 call assert_equal([0, 0, 0, 0, 0, 0, 0, 1, 0], map(range(-1, 7), 'diff_filler(v:val)'))
585 wincmd w
586 call assert_equal([0, 0, 0, 0, 2, 0, 0, 0], map(range(-1, 6), 'diff_filler(v:val)'))
587
588 %bwipe!
589 endfunc
590
550 func Test_diff_lastline() 591 func Test_diff_lastline()
551 enew! 592 enew!
552 only! 593 only!
553 call setline(1, ['This is a ', 'line with five ', 'rows']) 594 call setline(1, ['This is a ', 'line with five ', 'rows'])
554 diffthis 595 diffthis