pretty up the page and allow for local calendars
This commit is contained in:
parent
5310f19383
commit
1717b3ab70
2 changed files with 68 additions and 10 deletions
49
src/tests.rs
49
src/tests.rs
|
@ -80,6 +80,55 @@ END:VCALENDAR
|
|||
Ok(())
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn hand_written() -> Result<()> {
|
||||
let s = r#"
|
||||
BEGIN:VCALENDAR
|
||||
|
||||
COMMENT:August
|
||||
|
||||
BEGIN:VEVENT
|
||||
DTSTART;TZID=America/Chicago:20250819T210000
|
||||
DTEND;TZID=America/Chicago:20250819T223000
|
||||
SUMMARY:Redacted
|
||||
END:VEVENT
|
||||
|
||||
BEGIN:VEVENT
|
||||
DTSTART;TZID=America/Chicago:20250823T170000
|
||||
SUMMARY:Redacted
|
||||
URL:https://www.example.com
|
||||
END:VEVENT
|
||||
|
||||
END:VCALENDAR
|
||||
"#;
|
||||
|
||||
let ical = ICal::read_from_str(s)?;
|
||||
let params = Parameters {
|
||||
ignore_before: chicago_time(2025, 1, 1, 0, 0, 0),
|
||||
output_start: chicago_time(2025, 7, 1, 0, 0, 0),
|
||||
output_stop: chicago_time(2025, 10, 1, 0, 0, 0),
|
||||
tz: chrono_tz::America::Chicago,
|
||||
};
|
||||
let instances = ical.event_instances(¶ms)?;
|
||||
|
||||
assert_eq!(
|
||||
[instances[0].dtstart, instances[1].dtstart,],
|
||||
[
|
||||
DatePerhapsTime {
|
||||
dt: chicago_time(2025, 8, 19, 21, 0, 0),
|
||||
all_day: false,
|
||||
},
|
||||
DatePerhapsTime {
|
||||
dt: chicago_time(2025, 8, 23, 17, 0, 0),
|
||||
all_day: false,
|
||||
},
|
||||
]
|
||||
);
|
||||
assert_eq!(instances.len(), 2);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Expect that recurrent exceptions work correctly and don't duplicate events
|
||||
#[test]
|
||||
fn recurrence_exceptions() -> Result<()> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue