summaryrefslogtreecommitdiff
path: root/src/rrulestr.rs
diff options
context:
space:
mode:
authorFredrik Meringdal <fredrikmeringdal@Fredriks-MacBook-Pro.local>2021-02-15 16:12:04 +0100
committerFredrik Meringdal <fredrikmeringdal@Fredriks-MacBook-Pro.local>2021-02-15 16:12:04 +0100
commit8cc0d3ac0f8e7030ff40958ffe63f76087c0c00e (patch)
tree8b4a58da1ec87fb581908656baaf0c8c8bb7750c /src/rrulestr.rs
parent5a7a41849a9bdd2e92addeb74c178ef713adeb2d (diff)
downloadrust_rrule-8cc0d3ac0f8e7030ff40958ffe63f76087c0c00e.zip
infinite loop bug fix
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);
+ }
}