diff options
author | Harald Eilertsen <haraldei@anduin.net> | 2018-12-18 13:15:24 +0100 |
---|---|---|
committer | Harald Eilertsen <haraldei@anduin.net> | 2018-12-18 13:15:24 +0100 |
commit | 9925eeefbe864b81b96dffdb67b69b2572eca679 (patch) | |
tree | 131927fd0b5e77a8e6fa5122b08f45abb797f875 /src | |
parent | 20a3b4e71b3706e1ee15a8f3d3d9640fd3a8b460 (diff) | |
download | icaltool-9925eeefbe864b81b96dffdb67b69b2572eca679.tar.gz icaltool-9925eeefbe864b81b96dffdb67b69b2572eca679.tar.bz2 icaltool-9925eeefbe864b81b96dffdb67b69b2572eca679.zip |
Add minimal function to match all events.
Diffstat (limited to 'src')
-rw-r--r-- | src/main.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/main.rs b/src/main.rs index af10ccb..28575d5 100644 --- a/src/main.rs +++ b/src/main.rs @@ -62,6 +62,18 @@ fn read_icalendar_from_file(filename: &str) -> std::io::Result<Vec<ical::parser: .collect()) } +fn match_event(_event: &ical::parser::ical::component::IcalEvent, _pattern: &str) -> bool { + true +} + +#[test] +fn match_all_events() { + let cal = read_icalendar_from_file("test/fixtures/events.ics").unwrap(); + let num_events = cal[0].events.len(); + let events:Vec<_> = cal[0].events.iter().filter(|ref event| match_event(&event, "*")).collect(); + assert_eq!(num_events, events.len()); +} + fn main() { let calendars = read_icalendar_from_file("test.ics").unwrap(); println!("Found {} calendard in file...", calendars.len()); |