additional specializations tests

This commit is contained in:
The8472 2019-11-23 14:34:58 +01:00
parent 00a32eb54f
commit 2b0b2ae9f6

View File

@ -785,6 +785,28 @@ fn test_from_iter_specialization() {
assert_eq!(srcptr, sinkptr);
}
#[test]
fn test_from_iter_partially_drained_in_place_specialization() {
let src: Vec<usize> = vec![0usize; 10];
let srcptr = src.as_ptr();
let mut iter = src.into_iter();
iter.next();
iter.next();
let sink = iter.collect::<Vec<_>>();
let sinkptr = sink.as_ptr();
assert_eq!(srcptr, sinkptr);
}
#[test]
fn test_extend_in_place_specialization() {
let src: Vec<usize> = vec![0usize; 1];
let srcptr = src.as_ptr();
let mut dst = Vec::new();
dst.extend(src.into_iter());
let dstptr = dst.as_ptr();
assert_eq!(srcptr, dstptr);
}
#[test]
fn test_from_iter_specialization_with_iterator_adapters() {
fn assert_in_place_trait<T: InPlaceIterable>(_: &T) {};