Skip to content

Commit 1feb547

Browse files
authored
Rollup merge of rust-lang#147195 - hkBst:repeat-3, r=Mark-Simulacrum
iter repeat: add tests for new count and last behavior Tests for rust-lang#146410
2 parents e40e50e + 50398e2 commit 1feb547

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

library/coretests/tests/iter/sources.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,17 @@ fn test_repeat_take_collect() {
3030
assert_eq!(v, vec![42, 42, 42]);
3131
}
3232

33+
#[test]
34+
#[should_panic = "iterator is infinite"]
35+
fn test_repeat_count() {
36+
repeat(42).count();
37+
}
38+
39+
#[test]
40+
fn test_repeat_last() {
41+
assert_eq!(repeat(42).last(), Some(42));
42+
}
43+
3344
#[test]
3445
fn test_repeat_with() {
3546
#[derive(PartialEq, Debug)]

0 commit comments

Comments
 (0)