File tree 2 files changed +28
-28
lines changed
2 files changed +28
-28
lines changed Original file line number Diff line number Diff line change @@ -400,34 +400,6 @@ fn test_read_until() {
400
400
assert_eq ! ( v, [ ] ) ;
401
401
}
402
402
403
- #[ test]
404
- fn test_skip_until ( ) {
405
- let bytes: & [ u8 ] = b"read\0 ignore\0 read\0 ignore\0 read\0 ignore" ;
406
- let mut reader = BufReader :: new ( bytes) ;
407
-
408
- // read from the bytes, alternating between
409
- // consuming `read\0`s and skipping `ignore\0`s
410
- loop {
411
- // consume `read\0`
412
- let mut out = Vec :: new ( ) ;
413
- let read = reader. read_until ( 0 , & mut out) . unwrap ( ) ;
414
- if read == 0 {
415
- // eof
416
- break ;
417
- } else {
418
- assert_eq ! ( out, b"read\0 " ) ;
419
- }
420
-
421
- // skip past `ignore\0`
422
- reader. skip_until ( 0 ) . unwrap ( ) ;
423
- }
424
-
425
- // ensure we are at the end of the byte slice and that we can skip no further
426
- // also ensure skip_until matches the behavior of read_until at EOF
427
- let skipped = reader. skip_until ( 0 ) . unwrap ( ) ;
428
- assert_eq ! ( skipped, 0 ) ;
429
- }
430
-
431
403
#[ test]
432
404
fn test_line_buffer ( ) {
433
405
let mut writer = LineWriter :: new ( Vec :: new ( ) ) ;
Original file line number Diff line number Diff line change @@ -25,6 +25,34 @@ fn read_until() {
25
25
assert_eq ! ( v, [ ] ) ;
26
26
}
27
27
28
+ #[ test]
29
+ fn skip_until ( ) {
30
+ let bytes: & [ u8 ] = b"read\0 ignore\0 read\0 ignore\0 read\0 ignore" ;
31
+ let mut reader = BufReader :: new ( bytes) ;
32
+
33
+ // read from the bytes, alternating between
34
+ // consuming `read\0`s and skipping `ignore\0`s
35
+ loop {
36
+ // consume `read\0`
37
+ let mut out = Vec :: new ( ) ;
38
+ let read = reader. read_until ( 0 , & mut out) . unwrap ( ) ;
39
+ if read == 0 {
40
+ // eof
41
+ break ;
42
+ } else {
43
+ assert_eq ! ( out, b"read\0 " ) ;
44
+ }
45
+
46
+ // skip past `ignore\0`
47
+ reader. skip_until ( 0 ) . unwrap ( ) ;
48
+ }
49
+
50
+ // ensure we are at the end of the byte slice and that we can skip no further
51
+ // also ensure skip_until matches the behavior of read_until at EOF
52
+ let skipped = reader. skip_until ( 0 ) . unwrap ( ) ;
53
+ assert_eq ! ( skipped, 0 ) ;
54
+ }
55
+
28
56
#[ test]
29
57
fn split ( ) {
30
58
let buf = Cursor :: new ( & b"12" [ ..] ) ;
You can’t perform that action at this time.
0 commit comments