mirror of
https://github.com/tokio-rs/bytes.git
synced 2026-08-14 00:00:13 +02:00
Tweak Sink / Source
This commit is contained in:
+1
-1
@@ -54,6 +54,6 @@ fn test_vec_sink_capacity() {
|
||||
sink.reserve(16);
|
||||
assert!(sink.capacity() >= 16, "Capacity {} must be at least 16", sink.capacity());
|
||||
let mut source = Cursor::new(b"0123456789abcdef0123456789abcdef");
|
||||
sink.copy_from(&mut source);
|
||||
sink.sink(&mut source);
|
||||
assert!(sink.len() <= sink.capacity(), "Length {} must be less than or equal to capacity {}", sink.len(), sink.capacity());
|
||||
}
|
||||
|
||||
@@ -38,12 +38,14 @@ pub fn test_rope_slice() {
|
||||
let left = bytes.slice_to(250);
|
||||
assert_eq!(250, left.len());
|
||||
|
||||
dst.clear();
|
||||
left.buf().copy_to(&mut dst);
|
||||
assert_eq!(dst, &TEST_BYTES_1[..250]);
|
||||
|
||||
let right = bytes.slice_from(250);
|
||||
assert_eq!(TEST_BYTES_1.len() - 250, right.len());
|
||||
|
||||
dst.clear();
|
||||
right.buf().copy_to(&mut dst);
|
||||
// assert_eq!(dst, &TEST_BYTES_1[250..]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user