Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove commented tests for Bytes::unsplit #677

Merged
merged 1 commit into from
Mar 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
91 changes: 0 additions & 91 deletions tests/test_bytes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -710,97 +710,6 @@ fn partial_eq_bytesmut() {
assert!(bytesmut != bytes2);
}

/*
#[test]
fn bytes_unsplit_basic() {
let buf = Bytes::from(&b"aaabbbcccddd"[..]);

let splitted = buf.split_off(6);
assert_eq!(b"aaabbb", &buf[..]);
assert_eq!(b"cccddd", &splitted[..]);

buf.unsplit(splitted);
assert_eq!(b"aaabbbcccddd", &buf[..]);
}

#[test]
fn bytes_unsplit_empty_other() {
let buf = Bytes::from(&b"aaabbbcccddd"[..]);

// empty other
let other = Bytes::new();

buf.unsplit(other);
assert_eq!(b"aaabbbcccddd", &buf[..]);
}

#[test]
fn bytes_unsplit_empty_self() {
// empty self
let mut buf = Bytes::new();

let mut other = Bytes::with_capacity(64);
other.extend_from_slice(b"aaabbbcccddd");

buf.unsplit(other);
assert_eq!(b"aaabbbcccddd", &buf[..]);
}

#[test]
fn bytes_unsplit_arc_different() {
let mut buf = Bytes::with_capacity(64);
buf.extend_from_slice(b"aaaabbbbeeee");

buf.split_off(8); //arc

let mut buf2 = Bytes::with_capacity(64);
buf2.extend_from_slice(b"ccccddddeeee");

buf2.split_off(8); //arc

buf.unsplit(buf2);
assert_eq!(b"aaaabbbbccccdddd", &buf[..]);
}

#[test]
fn bytes_unsplit_arc_non_contiguous() {
let mut buf = Bytes::with_capacity(64);
buf.extend_from_slice(b"aaaabbbbeeeeccccdddd");

let mut buf2 = buf.split_off(8); //arc

let buf3 = buf2.split_off(4); //arc

buf.unsplit(buf3);
assert_eq!(b"aaaabbbbccccdddd", &buf[..]);
}

#[test]
fn bytes_unsplit_two_split_offs() {
let mut buf = Bytes::with_capacity(64);
buf.extend_from_slice(b"aaaabbbbccccdddd");

let mut buf2 = buf.split_off(8); //arc
let buf3 = buf2.split_off(4); //arc

buf2.unsplit(buf3);
buf.unsplit(buf2);
assert_eq!(b"aaaabbbbccccdddd", &buf[..]);
}

#[test]
fn bytes_unsplit_overlapping_references() {
let mut buf = Bytes::with_capacity(64);
buf.extend_from_slice(b"abcdefghijklmnopqrstuvwxyz");
let mut buf0010 = buf.slice(0..10);
let buf1020 = buf.slice(10..20);
let buf0515 = buf.slice(5..15);
buf0010.unsplit(buf1020);
assert_eq!(b"abcdefghijklmnopqrst", &buf0010[..]);
assert_eq!(b"fghijklmno", &buf0515[..]);
}
*/

#[test]
fn bytes_mut_unsplit_basic() {
let mut buf = BytesMut::with_capacity(64);
Expand Down