Mercurial > vim
comparison src/testdir/test_diffmode.vim @ 24683:05c199ea8295 v8.2.2880
patch 8.2.2880: unified diff fails if actually used
Commit: https://github.com/vim/vim/commit/ad5c178a191cf2cf37a27c2a789d7afda3879831
Author: glacambre <code@lacamb.re>
Date: Mon May 24 14:20:53 2021 +0200
patch 8.2.2880: unified diff fails if actually used
Problem: Unified diff fails if actually used.
Solution: Invoke :diffupdate in the test. Fix the check for working external
diff. (Ghjuvan Lacambre, Christian Brabandt, closes #8197)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Mon, 24 May 2021 14:30:03 +0200 |
parents | f51ea1b6d512 |
children | 13812db714fa |
comparison
equal
deleted
inserted
replaced
24682:e303bc0bda84 | 24683:05c199ea8295 |
---|---|
794 endif | 794 endif |
795 endfor | 795 endfor |
796 | 796 |
797 " also test unified diff | 797 " also test unified diff |
798 call term_sendkeys(a:buf, ":call SetupUnified()\<CR>:") | 798 call term_sendkeys(a:buf, ":call SetupUnified()\<CR>:") |
799 call term_sendkeys(a:buf, ":redraw!\<CR>:") | |
799 call VerifyScreenDump(a:buf, a:dumpfile, {}, 'unified') | 800 call VerifyScreenDump(a:buf, a:dumpfile, {}, 'unified') |
800 call term_sendkeys(a:buf, ":call StopUnified()\<CR>:") | 801 call term_sendkeys(a:buf, ":call StopUnified()\<CR>:") |
801 endfunc | 802 endfunc |
802 | 803 |
803 " Verify a screendump with the internal diff only. | 804 " Verify a screendump with the internal diff only. |
815 | 816 |
816 let lines =<< trim END | 817 let lines =<< trim END |
817 func UnifiedDiffExpr() | 818 func UnifiedDiffExpr() |
818 " Prepend some text to check diff type detection | 819 " Prepend some text to check diff type detection |
819 call writefile(['warning', ' message'], v:fname_out) | 820 call writefile(['warning', ' message'], v:fname_out) |
820 silent exe '!diff -u ' .. v:fname_in .. ' ' .. v:fname_new .. '>>' .. v:fname_out | 821 silent exe '!diff -U0 ' .. v:fname_in .. ' ' .. v:fname_new .. '>>' .. v:fname_out |
821 endfunc | 822 endfunc |
822 func SetupUnified() | 823 func SetupUnified() |
823 set diffexpr=UnifiedDiffExpr() | 824 set diffexpr=UnifiedDiffExpr() |
825 diffupdate | |
824 endfunc | 826 endfunc |
825 func StopUnified() | 827 func StopUnified() |
826 set diffexpr= | 828 set diffexpr= |
827 endfunc | 829 endfunc |
828 END | 830 END |
1216 " clean up | 1218 " clean up |
1217 call StopVimInTerminal(buf) | 1219 call StopVimInTerminal(buf) |
1218 call delete('Xtest_diff_cuc') | 1220 call delete('Xtest_diff_cuc') |
1219 endfunc | 1221 endfunc |
1220 | 1222 |
1223 | |
1221 " vim: shiftwidth=2 sts=2 expandtab | 1224 " vim: shiftwidth=2 sts=2 expandtab |