summaryrefslogtreecommitdiffstats
path: root/third_party/rust/itertools/tests/fold_specialization.rs
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/rust/itertools/tests/fold_specialization.rs')
-rw-r--r--third_party/rust/itertools/tests/fold_specialization.rs13
1 files changed, 13 insertions, 0 deletions
diff --git a/third_party/rust/itertools/tests/fold_specialization.rs b/third_party/rust/itertools/tests/fold_specialization.rs
new file mode 100644
index 0000000000..a984b40b8a
--- /dev/null
+++ b/third_party/rust/itertools/tests/fold_specialization.rs
@@ -0,0 +1,13 @@
+use itertools::Itertools;
+
+#[test]
+fn specialization_intersperse() {
+ let mut iter = (1..2).intersperse(0);
+ iter.clone().for_each(|x| assert_eq!(Some(x), iter.next()));
+
+ let mut iter = (1..3).intersperse(0);
+ iter.clone().for_each(|x| assert_eq!(Some(x), iter.next()));
+
+ let mut iter = (1..4).intersperse(0);
+ iter.clone().for_each(|x| assert_eq!(Some(x), iter.next()));
+}