0
0
mirror of https://github.com/vim/vim.git synced 2025-10-09 06:14:17 -04:00

patch 8.1.0823: not sufficient testing of xxd

Problem:    Not sufficient testing of xxd.
Solution:   Add some more test coverage.
This commit is contained in:
Bram Moolenaar
2019-01-26 14:11:19 +01:00
parent cb574f4154
commit 203651b9b2
2 changed files with 21 additions and 1 deletions

View File

@@ -75,7 +75,7 @@ func Test_xxd()
let s:test += 1
for arg in ['-l 13', '-l13', '-len 13']
%d
exe '0r! ' . s:xxd_cmd . ' -s 0x36 -l 13 -cols 13 ' . fname
exe '0r! ' . s:xxd_cmd . ' -s 0x36 ' . arg . ' -cols 13 ' . fname
$d
call assert_equal('00000036: 3231 7374 204d 6179 2031 3939 36 21st May 1996', getline(1), s:Mess(s:test))
endfor
@@ -131,6 +131,24 @@ func Test_xxd()
call delete('XXDfile')
endfor
" Test 11: reverse with CR, hex upper, Postscript style with a TAB
let s:test += 1
call writefile([" 54455354\t610B6364 30390A TESTa\0x0bcd09.\r"], 'Xinput')
silent exe '!' . s:xxd_cmd . ' -r -p < Xinput > XXDfile'
let blob = readfile('XXDfile', 'B')
call assert_equal(0z54455354.610B6364.30390A, blob)
call delete('Xinput')
call delete('XXDfile')
" Test 12: reverse with seek
let s:test += 1
call writefile(["00000000: 54455354\t610B6364 30390A TESTa\0x0bcd09.\r"], 'Xinput')
silent exe '!' . s:xxd_cmd . ' -r -seek 5 < Xinput > XXDfile'
let blob = readfile('XXDfile', 'B')
call assert_equal(0z0000000000.54455354.610B6364.30390A, blob)
call delete('Xinput')
call delete('XXDfile')
" TODO:
" -o -offset

View File

@@ -787,6 +787,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
823,
/**/
822,
/**/