File tree 2 files changed +8
-19
lines changed
2 files changed +8
-19
lines changed Original file line number Diff line number Diff line change @@ -571,6 +571,14 @@ quickcheck! {
571
571
let b = & b[ ..len] ;
572
572
itertools:: equal( zip_eq( a, b) , zip( a, b) )
573
573
}
574
+
575
+ #[ should_panic]
576
+ fn zip_eq_panics( a: Vec <u8 >, b: Vec <u8 >) -> TestResult {
577
+ if a. len( ) == b. len( ) { return TestResult :: discard( ) ; }
578
+ zip_eq( a. iter( ) , b. iter( ) ) . for_each( |_| { } ) ;
579
+ TestResult :: passed( ) // won't come here
580
+ }
581
+
574
582
fn equal_positions( a: Vec <i32 >) -> bool {
575
583
let with_pos = a. iter( ) . positions( |v| v % 2 == 0 ) ;
576
584
let without = a. iter( ) . enumerate( ) . filter( |( _, v) | * v % 2 == 0 ) . map( |( i, _) | i) ;
Original file line number Diff line number Diff line change 1
- use itertools:: free:: zip_eq;
2
1
use itertools:: multizip;
3
2
use itertools:: EitherOrBoth :: { Both , Left , Right } ;
4
3
use itertools:: Itertools ;
@@ -55,21 +54,3 @@ fn test_double_ended_zip() {
55
54
assert_eq ! ( it. next_back( ) , Some ( ( 1 , 1 ) ) ) ;
56
55
assert_eq ! ( it. next_back( ) , None ) ;
57
56
}
58
-
59
- #[ should_panic]
60
- #[ test]
61
- fn zip_eq_panic1 ( ) {
62
- let a = [ 1 , 2 ] ;
63
- let b = [ 1 , 2 , 3 ] ;
64
-
65
- zip_eq ( & a, & b) . count ( ) ;
66
- }
67
-
68
- #[ should_panic]
69
- #[ test]
70
- fn zip_eq_panic2 ( ) {
71
- let a: [ i32 ; 0 ] = [ ] ;
72
- let b = [ 1 , 2 , 3 ] ;
73
-
74
- zip_eq ( & a, & b) . count ( ) ;
75
- }
You can’t perform that action at this time.
0 commit comments