@@ -5,17 +5,17 @@ use crate::util::{Dir, TestCommand};
5
5
// bug report: https://github.com/BurntSushi/ripgrep/issues/306
6
6
7
7
// Our haystack is the first 500 lines of Gutenberg's copy of "A Study in
8
- // Scarlet," with a NUL byte at line 237 : `abcdef\x00`.
8
+ // Scarlet," with a NUL byte at line 1898 : `abcdef\x00`.
9
9
//
10
10
// The position and size of the haystack is, unfortunately, significant. In
11
11
// particular, the NUL byte is specifically inserted at some point *after* the
12
- // first 8192 bytes, which corresponds to the initial capacity of the buffer
12
+ // first 65,536 bytes, which corresponds to the initial capacity of the buffer
13
13
// that ripgrep uses to read files. (grep for DEFAULT_BUFFER_CAPACITY.) The
14
14
// position of the NUL byte ensures that we can execute some search on the
15
15
// initial buffer contents without ever detecting any binary data. Moreover,
16
- // when using a memory map for searching, only the first 8192 bytes are
16
+ // when using a memory map for searching, only the first 65,536 bytes are
17
17
// scanned for a NUL byte, so no binary bytes are detected at all when using
18
- // a memory map (unless our query matches line 237 ).
18
+ // a memory map (unless our query matches line 1898 ).
19
19
//
20
20
// One last note: in the tests below, we use --no-mmap heavily because binary
21
21
// detection with memory maps is a bit different. Namely, NUL bytes are only
@@ -40,7 +40,7 @@ rgtest!(after_match1_implicit, |dir: Dir, mut cmd: TestCommand| {
40
40
41
41
let expected = "\
42
42
hay:1:The Project Gutenberg EBook of A Study In Scarlet, by Arthur Conan Doyle
43
- hay: WARNING: stopped searching binary file after match (found \" \\ 0\" byte around offset 9741 )
43
+ hay: WARNING: stopped searching binary file after match (found \" \\ 0\" byte around offset 77041 )
44
44
" ;
45
45
eqnice!( expected, cmd. stdout( ) ) ;
46
46
} ) ;
@@ -53,7 +53,7 @@ rgtest!(after_match1_explicit, |dir: Dir, mut cmd: TestCommand| {
53
53
54
54
let expected = "\
55
55
1:The Project Gutenberg EBook of A Study In Scarlet, by Arthur Conan Doyle
56
- binary file matches (found \" \\ 0\" byte around offset 9741 )
56
+ binary file matches (found \" \\ 0\" byte around offset 77041 )
57
57
" ;
58
58
eqnice!( expected, cmd. stdout( ) ) ;
59
59
} ) ;
@@ -64,7 +64,7 @@ rgtest!(after_match1_stdin, |_: Dir, mut cmd: TestCommand| {
64
64
65
65
let expected = "\
66
66
1:The Project Gutenberg EBook of A Study In Scarlet, by Arthur Conan Doyle
67
- binary file matches (found \" \\ 0\" byte around offset 9741 )
67
+ binary file matches (found \" \\ 0\" byte around offset 77041 )
68
68
" ;
69
69
eqnice!( expected, cmd. pipe( HAY ) ) ;
70
70
} ) ;
@@ -85,7 +85,7 @@ rgtest!(after_match1_implicit_binary, |dir: Dir, mut cmd: TestCommand| {
85
85
86
86
let expected = "\
87
87
hay:1:The Project Gutenberg EBook of A Study In Scarlet, by Arthur Conan Doyle
88
- hay: binary file matches (found \" \\ 0\" byte around offset 9741 )
88
+ hay: binary file matches (found \" \\ 0\" byte around offset 77041 )
89
89
" ;
90
90
eqnice!( expected, cmd. stdout( ) ) ;
91
91
} ) ;
@@ -200,7 +200,7 @@ rgtest!(after_match2_implicit, |dir: Dir, mut cmd: TestCommand| {
200
200
201
201
let expected = "\
202
202
hay:1:The Project Gutenberg EBook of A Study In Scarlet, by Arthur Conan Doyle
203
- hay: WARNING: stopped searching binary file after match (found \" \\ 0\" byte around offset 9741 )
203
+ hay: WARNING: stopped searching binary file after match (found \" \\ 0\" byte around offset 77041 )
204
204
" ;
205
205
eqnice!( expected, cmd. stdout( ) ) ;
206
206
} ) ;
@@ -220,7 +220,7 @@ rgtest!(after_match2_implicit_text, |dir: Dir, mut cmd: TestCommand| {
220
220
221
221
let expected = "\
222
222
hay:1:The Project Gutenberg EBook of A Study In Scarlet, by Arthur Conan Doyle
223
- hay:236 :\" And yet you say he is not a medical student?\"
223
+ hay:1867 :\" And yet you say he is not a medical student?\"
224
224
" ;
225
225
eqnice!( expected, cmd. stdout( ) ) ;
226
226
} ) ;
@@ -240,7 +240,7 @@ rgtest!(before_match1_explicit, |dir: Dir, mut cmd: TestCommand| {
240
240
cmd. args( & [ "--no-mmap" , "-n" , "Heaven" , "hay" ] ) ;
241
241
242
242
let expected = "\
243
- binary file matches (found \" \\ 0\" byte around offset 9741 )
243
+ binary file matches (found \" \\ 0\" byte around offset 77041 )
244
244
" ;
245
245
eqnice!( expected, cmd. stdout( ) ) ;
246
246
} ) ;
@@ -253,7 +253,7 @@ rgtest!(before_match1_implicit_binary, |dir: Dir, mut cmd: TestCommand| {
253
253
cmd. args( & [ "--no-mmap" , "-n" , "--binary" , "Heaven" , "-g" , "hay" ] ) ;
254
254
255
255
let expected = "\
256
- hay: binary file matches (found \" \\ 0\" byte around offset 9741 )
256
+ hay: binary file matches (found \" \\ 0\" byte around offset 77041 )
257
257
" ;
258
258
eqnice!( expected, cmd. stdout( ) ) ;
259
259
} ) ;
@@ -265,7 +265,7 @@ rgtest!(before_match1_implicit_text, |dir: Dir, mut cmd: TestCommand| {
265
265
cmd. args( & [ "--no-mmap" , "-n" , "--text" , "Heaven" , "-g" , "hay" ] ) ;
266
266
267
267
let expected = "\
268
- hay:238 :\" No. Heaven knows what the objects of his studies are. But here we
268
+ hay:1871 :\" No. Heaven knows what the objects of his studies are. But here we
269
269
" ;
270
270
eqnice!( expected, cmd. stdout( ) ) ;
271
271
} ) ;
@@ -288,7 +288,7 @@ rgtest!(before_match2_explicit, |dir: Dir, mut cmd: TestCommand| {
288
288
cmd. args( & [ "--no-mmap" , "-n" , "a medical student" , "hay" ] ) ;
289
289
290
290
let expected = "\
291
- binary file matches (found \" \\ 0\" byte around offset 9741 )
291
+ binary file matches (found \" \\ 0\" byte around offset 77041 )
292
292
" ;
293
293
eqnice!( expected, cmd. stdout( ) ) ;
294
294
} ) ;
@@ -300,7 +300,7 @@ rgtest!(before_match2_implicit_text, |dir: Dir, mut cmd: TestCommand| {
300
300
cmd. args( & [ "--no-mmap" , "-n" , "--text" , "a medical student" , "-g" , "hay" ] ) ;
301
301
302
302
let expected = "\
303
- hay:236 :\" And yet you say he is not a medical student?\"
303
+ hay:1867 :\" And yet you say he is not a medical student?\"
304
304
" ;
305
305
eqnice!( expected, cmd. stdout( ) ) ;
306
306
} ) ;
0 commit comments