Skip to content

Commit b1be1e4

Browse files
Philippe-Choletphimuemue
authored andcommitted
Update iproduct tests
Test name `iproduct1` starts with `i` because `product1` is for another kind of test.
1 parent b32a3b3 commit b1be1e4

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

tests/macros_hygiene.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#[test]
22
fn iproduct_hygiene() {
3+
let _ = itertools::iproduct!();
34
let _ = itertools::iproduct!(0..6);
45
let _ = itertools::iproduct!(0..6, 0..9);
56
let _ = itertools::iproduct!(0..6, 0..9, 0..12);

tests/test_core.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,23 @@ use crate::it::Itertools;
1818
use core::iter;
1919
use itertools as it;
2020

21+
#[test]
22+
fn product0() {
23+
let mut prod = iproduct!();
24+
assert_eq!(prod.next(), Some(()));
25+
assert!(prod.next().is_none());
26+
}
27+
28+
#[test]
29+
fn iproduct1() {
30+
let s = "αβ";
31+
32+
let mut prod = iproduct!(s.chars());
33+
assert_eq!(prod.next(), Some(('α',)));
34+
assert_eq!(prod.next(), Some(('β',)));
35+
assert!(prod.next().is_none());
36+
}
37+
2138
#[test]
2239
fn product2() {
2340
let s = "αβ";

0 commit comments

Comments
 (0)