Skip to content

Commit 0eb220c

Browse files
committed
patch 8.1.0831: xxd test fails if man page has dos fileformat
Problem: Xxd test fails if man page has dos fileformat. Solution: Make a copy with unix fileformat.
1 parent e3d0654 commit 0eb220c

2 files changed

Lines changed: 17 additions & 6 deletions

File tree

src/testdir/test_xxd.vim

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,20 @@ func Test_xxd()
5353
call assert_equal(expected[2:], getline(1,'$'), s:Mess(s:test))
5454
endfor
5555

56+
" The following tests use the xxd man page.
57+
" For these tests to pass, the fileformat must be "unix".
58+
let man_copy = 'Xxd.1'
59+
let man_page = '../../runtime/doc/xxd.1'
60+
if has('win32') && !filereadable(man_page)
61+
let man_page = '../../doc/xxd.1'
62+
endif
63+
%d
64+
exe '0r ' man_page '| set ff=unix | $d | w' man_copy '| bwipe!' man_copy
65+
5666
" Test 5: Print 120 bytes as continuous hexdump with 20 octets per line
5767
let s:test += 1
5868
%d
59-
let fname = '../../runtime/doc/xxd.1'
60-
if has('win32') && !filereadable(fname)
61-
let fname = '../../doc/xxd.1'
62-
endif
63-
exe '0r! ' . s:xxd_cmd . ' -l 120 -ps -c20 ' . fname
69+
exe '0r! ' . s:xxd_cmd . ' -l 120 -ps -c20 ' . man_copy
6470
$d
6571
let expected = [
6672
\ '2e54482058584420312022417567757374203139',
@@ -75,11 +81,14 @@ func Test_xxd()
7581
let s:test += 1
7682
for arg in ['-l 13', '-l13', '-len 13']
7783
%d
78-
exe '0r! ' . s:xxd_cmd . ' -s 0x36 ' . arg . ' -cols 13 ' . fname
84+
exe '0r! ' . s:xxd_cmd . ' -s 0x36 ' . arg . ' -cols 13 ' . man_copy
7985
$d
8086
call assert_equal('00000036: 3231 7374 204d 6179 2031 3939 36 21st May 1996', getline(1), s:Mess(s:test))
8187
endfor
8288

89+
" Cleanup after tests 5 and 6
90+
call delete(man_copy)
91+
8392
" Test 7: Print C include
8493
let s:test += 1
8594
call writefile(['TESTabcd09'], 'XXDfile')

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -783,6 +783,8 @@ static char *(features[]) =
783783

784784
static int included_patches[] =
785785
{ /* Add new patch number below this line */
786+
/**/
787+
831,
786788
/**/
787789
830,
788790
/**/

0 commit comments

Comments
 (0)