mirror of
https://github.com/vim/vim.git
synced 2025-10-04 05:25:06 -04:00
patch 8.2.2869: using unified diff is not tested
Problem: Using unified diff is not tested. Solution: Test all cases also with unified diff. (issue #8197)
This commit is contained in:
@@ -624,7 +624,7 @@ func Test_diffexpr()
|
|||||||
CheckExecutable diff
|
CheckExecutable diff
|
||||||
|
|
||||||
func DiffExpr()
|
func DiffExpr()
|
||||||
" Prepent some text to check diff type detection
|
" Prepend some text to check diff type detection
|
||||||
call writefile(['warning', ' message'], v:fname_out)
|
call writefile(['warning', ' message'], v:fname_out)
|
||||||
silent exe '!diff ' . v:fname_in . ' ' . v:fname_new . '>>' . v:fname_out
|
silent exe '!diff ' . v:fname_in . ' ' . v:fname_new . '>>' . v:fname_out
|
||||||
endfunc
|
endfunc
|
||||||
@@ -789,9 +789,15 @@ func VerifyBoth(buf, dumpfile, extra)
|
|||||||
for cmd in [":set diffopt=filler" . a:extra . "\<CR>:", ":set diffopt+=internal\<CR>:"]
|
for cmd in [":set diffopt=filler" . a:extra . "\<CR>:", ":set diffopt+=internal\<CR>:"]
|
||||||
call term_sendkeys(a:buf, cmd)
|
call term_sendkeys(a:buf, cmd)
|
||||||
if VerifyScreenDump(a:buf, a:dumpfile, {}, cmd =~ 'internal' ? 'internal' : 'external')
|
if VerifyScreenDump(a:buf, a:dumpfile, {}, cmd =~ 'internal' ? 'internal' : 'external')
|
||||||
break " don't let the next iteration overwrite the "failed" file.
|
" don't let the next iteration overwrite the "failed" file.
|
||||||
|
return
|
||||||
endif
|
endif
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
|
" also test unified diff
|
||||||
|
call term_sendkeys(a:buf, ":call SetupUnified()\<CR>:")
|
||||||
|
call VerifyScreenDump(a:buf, a:dumpfile, {}, 'unified')
|
||||||
|
call term_sendkeys(a:buf, ":call StopUnified()\<CR>:")
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
" Verify a screendump with the internal diff only.
|
" Verify a screendump with the internal diff only.
|
||||||
@@ -807,13 +813,28 @@ func Test_diff_screen()
|
|||||||
CheckScreendump
|
CheckScreendump
|
||||||
CheckFeature menu
|
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
|
" clean up already existing swap files, just in case
|
||||||
call delete('.Xfile1.swp')
|
call delete('.Xfile1.swp')
|
||||||
call delete('.Xfile2.swp')
|
call delete('.Xfile2.swp')
|
||||||
|
|
||||||
" Test 1: Add a line in beginning of file 2
|
" 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])
|
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', {})
|
let buf = RunVimInTerminal('-d -S XdiffSetup Xfile1 Xfile2', {})
|
||||||
" Set autoread mode, so that Vim won't complain once we re-write the test
|
" Set autoread mode, so that Vim won't complain once we re-write the test
|
||||||
" files
|
" files
|
||||||
call term_sendkeys(buf, ":set autoread\<CR>\<c-w>w:set autoread\<CR>\<c-w>w")
|
call term_sendkeys(buf, ":set autoread\<CR>\<c-w>w:set autoread\<CR>\<c-w>w")
|
||||||
@@ -933,6 +954,7 @@ func Test_diff_screen()
|
|||||||
call StopVimInTerminal(buf)
|
call StopVimInTerminal(buf)
|
||||||
call delete('Xfile1')
|
call delete('Xfile1')
|
||||||
call delete('Xfile2')
|
call delete('Xfile2')
|
||||||
|
call delete('XdiffSetup')
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_diff_with_cursorline()
|
func Test_diff_with_cursorline()
|
||||||
|
@@ -750,6 +750,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
2869,
|
||||||
/**/
|
/**/
|
||||||
2868,
|
2868,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user