To: vim_dev@googlegroups.com Subject: Patch 8.0.1153 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.0.1153 Problem: No tests for diff_hlID() and diff_filler(). Solution: Add tests. (Dominique Pelle, closes #2156) Files: src/testdir/test_diffmode.vim *** ../vim-8.0.1152/src/testdir/test_diffmode.vim 2017-09-02 18:01:46.422018216 +0200 --- src/testdir/test_diffmode.vim 2017-09-26 19:40:04.355867701 +0200 *************** *** 420,426 **** new Xtest2 put =range(1,100) wq ! tabe Xtest2 $ diffsp Xtest1 --- 420,426 ---- new Xtest2 put =range(1,100) wq ! tabe Xtest2 $ diffsp Xtest1 *************** *** 501,507 **** 3 + 4 . ! saveas Xpatch bwipe! new call assert_fails('diffpatch Xpatch', 'E816:') --- 501,507 ---- 3 + 4 . ! saveas! Xpatch bwipe! new call assert_fails('diffpatch Xpatch', 'E816:') *************** *** 547,552 **** --- 547,593 ---- %bwipe! 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() enew! only! *** ../vim-8.0.1152/src/version.c 2017-09-26 19:10:33.494859477 +0200 --- src/version.c 2017-09-26 19:41:11.919448504 +0200 *************** *** 763,764 **** --- 763,766 ---- { /* Add new patch number below this line */ + /**/ + 1153, /**/ -- hundred-and-one symptoms of being an internet addict: 203. You're an active member of more than 20 newsgroups. /// Bram Moolenaar -- Bram@Moolenaar.net -- 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 ///