diff options
| author | Sebastian Hahn <sebastian@torproject.org> | 2024-10-31 01:48:37 +0100 |
|---|---|---|
| committer | Sebastian Hahn <sebastian@torproject.org> | 2024-10-31 01:48:37 +0100 |
| commit | 27342cbb1fef4ab2a1b7347b38c09c079f7dc838 (patch) | |
| tree | 41a29906f558b81fd5ef286cd2a9a32c9ddef95c | |
| parent | 9cebcbad1846f6b5448e386a6a6647484adf7e8f (diff) | |
| download | rust-27342cbb1fef4ab2a1b7347b38c09c079f7dc838.tar.gz rust-27342cbb1fef4ab2a1b7347b38c09c079f7dc838.zip | |
Add a `collect_into` tuple test case
| -rw-r--r-- | library/core/tests/iter/traits/iterator.rs | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/library/core/tests/iter/traits/iterator.rs b/library/core/tests/iter/traits/iterator.rs index 93ef9c0812b..76f1e3319d4 100644 --- a/library/core/tests/iter/traits/iterator.rs +++ b/library/core/tests/iter/traits/iterator.rs @@ -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}; |
