@@ -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' )
0 commit comments