diff --git a/tests/quick.rs b/tests/quick.rs index aa61e3c1e..5b8fd6a21 100644 --- a/tests/quick.rs +++ b/tests/quick.rs @@ -571,6 +571,14 @@ quickcheck! { let b = &b[..len]; itertools::equal(zip_eq(a, b), zip(a, b)) } + + #[should_panic] + fn zip_eq_panics(a: Vec, b: Vec) -> TestResult { + if a.len() == b.len() { return TestResult::discard(); } + zip_eq(a.iter(), b.iter()).for_each(|_| {}); + TestResult::passed() // won't come here + } + fn equal_positions(a: Vec) -> bool { let with_pos = a.iter().positions(|v| v % 2 == 0); let without = a.iter().enumerate().filter(|(_, v)| *v % 2 == 0).map(|(i, _)| i); diff --git a/tests/zip.rs b/tests/zip.rs index f2554d7a4..716ac20b3 100644 --- a/tests/zip.rs +++ b/tests/zip.rs @@ -1,4 +1,3 @@ -use itertools::free::zip_eq; use itertools::multizip; use itertools::EitherOrBoth::{Both, Left, Right}; use itertools::Itertools; @@ -55,21 +54,3 @@ fn test_double_ended_zip() { assert_eq!(it.next_back(), Some((1, 1))); assert_eq!(it.next_back(), None); } - -#[should_panic] -#[test] -fn zip_eq_panic1() { - let a = [1, 2]; - let b = [1, 2, 3]; - - zip_eq(&a, &b).count(); -} - -#[should_panic] -#[test] -fn zip_eq_panic2() { - let a: [i32; 0] = []; - let b = [1, 2, 3]; - - zip_eq(&a, &b).count(); -}