mirror of
https://github.com/tokio-rs/bytes.git
synced 2026-08-13 00:00:32 +02:00
Flesh out ToBytes, ByteStr::concat, and ByteStr eq
This commit is contained in:
+15
-1
@@ -69,7 +69,7 @@ pub fn test_rope_concat_two_byte_str() {
|
||||
let left = Rope::from_slice(TEST_BYTES_1);
|
||||
let right = Rope::from_slice(TEST_BYTES_2);
|
||||
|
||||
let both = left.concat(right);
|
||||
let both = left.concat(&right);
|
||||
|
||||
assert_eq!(both.len(), TEST_BYTES_1.len() + TEST_BYTES_2.len());
|
||||
|
||||
@@ -88,3 +88,17 @@ pub fn test_slice_parity() {
|
||||
|
||||
// stuff
|
||||
}
|
||||
|
||||
#[test]
|
||||
pub fn test_rope_equality() {
|
||||
let a = &b"Mary had a little lamb, its fleece was white as snow; ".to_bytes()
|
||||
.concat(&b"And everywhere that Mary went, the lamb was sure to go.".to_bytes());
|
||||
|
||||
let b = &b"Mary had a little lamb, ".to_bytes()
|
||||
.concat(&b"its fleece was white as snow; ".to_bytes())
|
||||
.concat(
|
||||
&b"And everywhere that Mary went, ".to_bytes()
|
||||
.concat(&b"the lamb was sure to go.".to_bytes()));
|
||||
|
||||
assert_eq!(a, b);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user