summaryrefslogtreecommitdiff
path: root/src/rrulestr.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/rrulestr.rs')
-rw-r--r--src/rrulestr.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/rrulestr.rs b/src/rrulestr.rs
index 62d1faa..bf616ba 100644
--- a/src/rrulestr.rs
+++ b/src/rrulestr.rs
@@ -748,4 +748,18 @@ mod test {
assert_eq!(occurences.len(), 7);
assert!(Utc::now().timestamp() - occurences[0].timestamp() < 2);
}
+
+ #[test]
+ fn avoids_infinite_loop() {
+ let rrule =
+ "DTSTART:20200427T090000\nFREQ=WEEKLY;UNTIL=20200506T035959Z;BYDAY=FR,MO,TH,TU,WE"
+ .parse::<RRule>()
+ .unwrap();
+ let instances: Vec<_> = rrule
+ .into_iter()
+ .skip_while(|d| *d < Local::now())
+ .take(2)
+ .collect();
+ assert_eq!(instances.len(), 0);
+ }
}