To: vim_dev@googlegroups.com Subject: Patch 8.2.2869 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.2869 Problem: Using unified diff is not tested. Solution: Test all cases also with unified diff. (issue #8197) Files: src/testdir/test_diffmode.vim *** ../vim-8.2.2868/src/testdir/test_diffmode.vim 2021-02-10 13:18:14.071747031 +0100 --- src/testdir/test_diffmode.vim 2021-05-18 19:04:14.964673930 +0200 *************** *** 624,630 **** CheckExecutable diff func DiffExpr() ! " Prepent some text to check diff type detection call writefile(['warning', ' message'], v:fname_out) silent exe '!diff ' . v:fname_in . ' ' . v:fname_new . '>>' . v:fname_out endfunc --- 624,630 ---- CheckExecutable diff func DiffExpr() ! " Prepend some text to check diff type detection call writefile(['warning', ' message'], v:fname_out) silent exe '!diff ' . v:fname_in . ' ' . v:fname_new . '>>' . v:fname_out endfunc *************** *** 789,797 **** for cmd in [":set diffopt=filler" . a:extra . "\:", ":set diffopt+=internal\:"] call term_sendkeys(a:buf, cmd) if VerifyScreenDump(a:buf, a:dumpfile, {}, cmd =~ 'internal' ? 'internal' : 'external') ! break " don't let the next iteration overwrite the "failed" file. endif endfor endfunc " Verify a screendump with the internal diff only. --- 789,803 ---- for cmd in [":set diffopt=filler" . a:extra . "\:", ":set diffopt+=internal\:"] call term_sendkeys(a:buf, cmd) if VerifyScreenDump(a:buf, a:dumpfile, {}, cmd =~ 'internal' ? 'internal' : 'external') ! " don't let the next iteration overwrite the "failed" file. ! return endif endfor + + " also test unified diff + call term_sendkeys(a:buf, ":call SetupUnified()\:") + call VerifyScreenDump(a:buf, a:dumpfile, {}, 'unified') + call term_sendkeys(a:buf, ":call StopUnified()\:") endfunc " Verify a screendump with the internal diff only. *************** *** 807,819 **** CheckScreendump CheckFeature menu " clean up already existing swap files, just in case call delete('.Xfile1.swp') call delete('.Xfile2.swp') " Test 1: Add a line in beginning of file 2 call WriteDiffFiles(0, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) ! let buf = RunVimInTerminal('-d Xfile1 Xfile2', {}) " Set autoread mode, so that Vim won't complain once we re-write the test " files call term_sendkeys(buf, ":set autoread\\w:set autoread\\w") --- 813,840 ---- CheckScreendump CheckFeature menu + let lines =<< trim END + func UnifiedDiffExpr() + " Prepend some text to check diff type detection + call writefile(['warning', ' message'], v:fname_out) + silent exe '!diff -u ' .. v:fname_in .. ' ' .. v:fname_new .. '>>' .. v:fname_out + endfunc + func SetupUnified() + set diffexpr=UnifiedDiffExpr() + endfunc + func StopUnified() + set diffexpr= + endfunc + END + call writefile(lines, 'XdiffSetup') + " clean up already existing swap files, just in case call delete('.Xfile1.swp') call delete('.Xfile2.swp') " Test 1: Add a line in beginning of file 2 call WriteDiffFiles(0, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) ! let buf = RunVimInTerminal('-d -S XdiffSetup Xfile1 Xfile2', {}) " Set autoread mode, so that Vim won't complain once we re-write the test " files call term_sendkeys(buf, ":set autoread\\w:set autoread\\w") *************** *** 933,938 **** --- 954,960 ---- call StopVimInTerminal(buf) call delete('Xfile1') call delete('Xfile2') + call delete('XdiffSetup') endfunc func Test_diff_with_cursorline() *** ../vim-8.2.2868/src/version.c 2021-05-18 17:49:55.372503123 +0200 --- src/version.c 2021-05-18 19:14:07.938128448 +0200 *************** *** 752,753 **** --- 752,755 ---- { /* Add new patch number below this line */ + /**/ + 2869, /**/ -- TALL KNIGHT: We shall say Ni! again to you if you do not appease us. ARTHUR: All right! What do you want? TALL KNIGHT: We want ... a shrubbery! "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///