Skip to content

Commit

Permalink
Add a collect_into tuple test case
Browse files Browse the repository at this point in the history
  • Loading branch information
shahn committed Oct 31, 2024
1 parent 9cebcba commit 27342cb
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions library/core/tests/iter/traits/iterator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -617,6 +617,19 @@ fn test_next_chunk() {
assert_eq!(it.next_chunk::<0>().unwrap(), []);
}

#[test]
fn test_collect_into_tuples() {
let a = vec![(1, 2, 3), (4, 5, 6), (7, 8, 9)];
let b = vec![1, 4, 7];
let c = vec![2, 5, 8];
let d = vec![3, 6, 9];
let mut e = (Vec::new(), Vec::new(), Vec::new());
a.iter().cloned().collect_into(&mut e);
assert!(e.0 == b);
assert!(e.1 == c);
assert!(e.2 == d);
}

// just tests by whether or not this compiles
fn _empty_impl_all_auto_traits<T>() {
use std::panic::{RefUnwindSafe, UnwindSafe};
Expand Down

0 comments on commit 27342cb

Please sign in to comment.