Skip to content

Commit 27342cb

Browse files
committed
Add a collect_into tuple test case
1 parent 9cebcba commit 27342cb

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

library/core/tests/iter/traits/iterator.rs

+13
Original file line numberDiff line numberDiff line change
@@ -617,6 +617,19 @@ fn test_next_chunk() {
617617
assert_eq!(it.next_chunk::<0>().unwrap(), []);
618618
}
619619

620+
#[test]
621+
fn test_collect_into_tuples() {
622+
let a = vec![(1, 2, 3), (4, 5, 6), (7, 8, 9)];
623+
let b = vec![1, 4, 7];
624+
let c = vec![2, 5, 8];
625+
let d = vec![3, 6, 9];
626+
let mut e = (Vec::new(), Vec::new(), Vec::new());
627+
a.iter().cloned().collect_into(&mut e);
628+
assert!(e.0 == b);
629+
assert!(e.1 == c);
630+
assert!(e.2 == d);
631+
}
632+
620633
// just tests by whether or not this compiles
621634
fn _empty_impl_all_auto_traits<T>() {
622635
use std::panic::{RefUnwindSafe, UnwindSafe};

0 commit comments

Comments
 (0)