Rollup merge of #147195 - hkBst:repeat-3, r=Mark-Simulacrum

iter repeat: add tests for new count and last behavior

Tests for https://github.com/rust-lang/rust/pull/146410
This commit is contained in:
Matthias Krüger 2025-10-01 18:42:35 +02:00 committed by GitHub
commit 1feb547a52
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -30,6 +30,17 @@ fn test_repeat_take_collect() {
assert_eq!(v, vec![42, 42, 42]);
}
#[test]
#[should_panic = "iterator is infinite"]
fn test_repeat_count() {
repeat(42).count();
}
#[test]
fn test_repeat_last() {
assert_eq!(repeat(42).last(), Some(42));
}
#[test]
fn test_repeat_with() {
#[derive(PartialEq, Debug)]