diff options
| author | Marijn Schouten <mhkbst@gmail.com> | 2025-09-30 17:56:18 +0000 |
|---|---|---|
| committer | Marijn Schouten <mhkbst@gmail.com> | 2025-09-30 17:56:18 +0000 |
| commit | 50398e2e7505779323e5371b1905c4ad56a29097 (patch) | |
| tree | be3d177ab36648ea67f28d918903bc34ceb40bdd /library | |
| parent | a2db9280539229a3b8a084a09886670a57bc7e9c (diff) | |
| download | rust-50398e2e7505779323e5371b1905c4ad56a29097.tar.gz rust-50398e2e7505779323e5371b1905c4ad56a29097.zip | |
iter repeat: add tests for new count and last behavior
Diffstat (limited to 'library')
| -rw-r--r-- | library/coretests/tests/iter/sources.rs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/library/coretests/tests/iter/sources.rs b/library/coretests/tests/iter/sources.rs index 506febaa056..5a391cb6775 100644 --- a/library/coretests/tests/iter/sources.rs +++ b/library/coretests/tests/iter/sources.rs @@ -31,6 +31,17 @@ fn test_repeat_take_collect() { } #[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)] struct NotClone(usize); |
