| 631 | |
| 632 | #[crate::test] |
| 633 | fn test_single_empty_segment() { |
| 634 | let s = SegmentedBytes::from(Vec::<u8>::new()); |
| 635 | |
| 636 | // Everything should comeback empty. |
| 637 | assert_eq!(s.len(), 0); |
| 638 | assert_eq!(s.remaining(), 0); |
| 639 | assert!(s.chunk().is_empty()); |
| 640 | |
| 641 | let mut reader = s.reader(); |
| 642 | |
| 643 | // Reading shouldn't fail, but it also shouldn't yield any bytes. |
| 644 | let mut buf = [0; 4]; |
| 645 | let bytes_read = reader.read(&mut buf).unwrap(); |
| 646 | assert_eq!(bytes_read, 0); |
| 647 | assert_eq!(buf, [0, 0, 0, 0]); |
| 648 | } |
| 649 | |
| 650 | #[crate::test] |
| 651 | fn test_middle_segment_empty() { |