Skip to content

Commit 164268d

Browse files
committed
patch 8.0.1691: xxd test sometimes fails
Problem: Xxd test sometimes fails. Solution: Wipe out the XXDfile buffer.
1 parent 8dd1761 commit 164268d

2 files changed

Lines changed: 14 additions & 6 deletions

File tree

‎src/testdir/test_xxd.vim‎

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,20 @@ if empty($XXD) || !executable($XXD)
33
finish
44
endif
55

6-
func! PrepareBuffer(command)
7-
%d
8-
call append(0, a:command)
6+
func! PrepareBuffer(lines)
7+
new
8+
call append(0, a:lines)
99
$d
10-
w XXDfile
1110
endfunc
1211

1312
func! s:Mess(counter)
1413
return printf("Failed xxd test %d:", a:counter)
1514
endfunc
1615

1716
func! Test_xxd()
18-
new
1917
call PrepareBuffer(range(1,30))
18+
w XXDfile
19+
2020
" Test 1: simple, filter the result through xxd
2121
let s:test = 1
2222
%!$XXD %
@@ -28,6 +28,7 @@ func! Test_xxd()
2828
\ '00000040: 350a 3236 0a32 370a 3238 0a32 390a 3330 5.26.27.28.29.30',
2929
\ '00000050: 0a .']
3030
call assert_equal(expected, getline(1,'$'), s:Mess(s:test))
31+
3132
" Test 2: reverse the result
3233
let s:test += 1
3334
%!$XXD -r
@@ -56,12 +57,14 @@ func! Test_xxd()
5657
\ '20617574686f723a0a2e5c2220202020546f6e79',
5758
\ '204e7567656e74203c746f6e79407363746e7567']
5859
call assert_equal(expected, getline(1,'$'), s:Mess(s:test))
60+
5961
" Test 6: Print the date from xxd.1
6062
let s:test += 1
6163
%d
6264
0r! $XXD -s 0x36 -l 13 -c 13 ../../runtime/doc/xxd.1
6365
$d
6466
call assert_equal('00000036: 3231 7374 204d 6179 2031 3939 36 21st May 1996', getline(1), s:Mess(s:test))
67+
6568
" Test 7: Print C include
6669
let s:test += 1
6770
call writefile(['TESTabcd09'], 'XXDfile')
@@ -72,6 +75,7 @@ func! Test_xxd()
7275
\ ' 0x54, 0x45, 0x53, 0x54, 0x61, 0x62, 0x63, 0x64, 0x30, 0x39, 0x0a', '};',
7376
\ 'unsigned int XXDfile_len = 11;']
7477
call assert_equal(expected, getline(1,'$'), s:Mess(s:test))
78+
7579
" Test 8: Print C include capitalized
7680
let s:test += 1
7781
call writefile(['TESTabcd09'], 'XXDfile')
@@ -82,9 +86,11 @@ func! Test_xxd()
8286
\ ' 0x54, 0x45, 0x53, 0x54, 0x61, 0x62, 0x63, 0x64, 0x30, 0x39, 0x0a', '};',
8387
\ 'unsigned int XXDFILE_LEN = 11;']
8488
call assert_equal(expected, getline(1,'$'), s:Mess(s:test))
85-
" Test 9: Create a file with containing a single 'A'
89+
90+
" Test 9: Create a file with containing a single 'A'
8691
let s:test += 1
8792
call delete('XXDfile')
93+
bwipe! XXDfile
8894
call system('echo "010000: 41"|'.$XXD.' -r -s -0x10000 > XXDfile')
8995
call PrepareBuffer(readfile('XXDfile')[0])
9096
call assert_equal('A', getline(1), s:Mess(s:test))

‎src/version.c‎

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

763763
static int included_patches[] =
764764
{ /* Add new patch number below this line */
765+
/**/
766+
1691,
765767
/**/
766768
1690,
767769
/**/

0 commit comments

Comments
 (0)