-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add examples and functional tests (#5)
* Fix coverage script * Create ergonomic interface for accessing ical data and first example * Check examples on CI * Create round trip test, to be extended with more data * Force line endings for ics * Upgrade cache action to fix node16 warning * Add data to the round trip test * Add missing recur tests from #3 * Round trip for remaining components * Round trip for IANA and X- components
- Loading branch information
1 parent
443401b
commit 756610d
Showing
41 changed files
with
2,692 additions
and
663 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
sample.ics eol=crlf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
use aetolia::prelude::*; | ||
|
||
fn main() { | ||
let input = std::fs::File::open("sample.ics").unwrap(); | ||
let ical = load_ical(input).unwrap(); | ||
println!("Loaded iCal document with {} object", ical.len()); | ||
|
||
for component in &ical[0].components { | ||
match component { | ||
CalendarComponent::TimeZone(tz) => { | ||
println!( | ||
"Found timezone with name: {}", | ||
tz.property_opt::<TimeZoneIdProperty>().unwrap().value().id | ||
); | ||
} | ||
CalendarComponent::Event(e) => { | ||
println!( | ||
"Found event with description: {}", | ||
e.property_opt::<DescriptionProperty>().unwrap().value() | ||
); | ||
|
||
let attendee = e.property_opt::<AttendeeProperty>().unwrap(); | ||
let role_param = attendee.param_opt::<RoleParam>().unwrap(); | ||
println!( | ||
"Found attendee {} with role: {:?}", | ||
attendee.value(), | ||
role_param.role | ||
); | ||
} | ||
_ => {} | ||
} | ||
} | ||
|
||
let validation_errors = validate_model(&ical[0]).unwrap(); | ||
assert!( | ||
validation_errors.is_empty(), | ||
"Didn't expect any validation errors" | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
BEGIN:VCALENDAR | ||
PRODID:-//RDU Software//NONSGML HandCal//EN | ||
VERSION:2.0 | ||
BEGIN:VTIMEZONE | ||
TZID:America/New_York | ||
BEGIN:STANDARD | ||
DTSTART:19981025T020000 | ||
TZOFFSETFROM:-0400 | ||
TZOFFSETTO:-0500 | ||
TZNAME:EST | ||
END:STANDARD | ||
BEGIN:DAYLIGHT | ||
DTSTART:19990404T020000 | ||
TZOFFSETFROM:-0500 | ||
TZOFFSETTO:-0400 | ||
TZNAME:EDT | ||
END:DAYLIGHT | ||
END:VTIMEZONE | ||
BEGIN:VEVENT | ||
DTSTAMP:19980309T231000Z | ||
UID:guid-1.example.com | ||
ORGANIZER:mailto:[email protected] | ||
ATTENDEE;RSVP=TRUE;ROLE=REQ-PARTICIPANT;CUTYPE=GROUP: | ||
mailto:[email protected] | ||
DESCRIPTION:Project XYZ Review Meeting | ||
CATEGORIES:MEETING | ||
CLASS:PUBLIC | ||
CREATED:19980309T130000Z | ||
SUMMARY:XYZ Project Review | ||
DTSTART;TZID=America/New_York:19980312T083000 | ||
DTEND;TZID=America/New_York:19980312T093000 | ||
LOCATION:1CP Conference Room 4350 | ||
END:VEVENT | ||
END:VCALENDAR |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.