diff options
author | Nora <nora.widdecke@tu-bs.de> | 2019-01-20 00:50:32 +0100 |
---|---|---|
committer | Nora <nora.widdecke@tu-bs.de> | 2019-01-20 00:52:40 +0100 |
commit | 13fd11100e942aaad9fdcf77fbf13dde10969ef2 (patch) | |
tree | 9fc8aca2bb310288688b62afa5e5a34085ac7332 /src/icalwrap | |
parent | 4ed586d4757668eb9c074ca574280708345677ee (diff) |
icalvcalendar: add tests for new with_* functions
Diffstat (limited to 'src/icalwrap')
-rw-r--r-- | src/icalwrap/icalvcalendar.rs | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/src/icalwrap/icalvcalendar.rs b/src/icalwrap/icalvcalendar.rs index 68ea4ed..e1c8e82 100644 --- a/src/icalwrap/icalvcalendar.rs +++ b/src/icalwrap/icalvcalendar.rs @@ -477,6 +477,50 @@ mod tests { } #[test] + fn test_with_location() { + let cal = IcalVCalendar::from_str(testdata::TEST_EVENT_MULTIDAY, None).unwrap(); + + let location = "test"; + let new_cal = cal.with_location(location); + + let event = new_cal.get_principal_event(); + assert_eq!(location, event.get_location().unwrap()) + } + + #[test] + fn test_with_summary() { + let cal = IcalVCalendar::from_str(testdata::TEST_EVENT_MULTIDAY, None).unwrap(); + + let summary = "test"; + let new_cal = cal.with_summary(summary); + + let event = new_cal.get_principal_event(); + assert_eq!(summary, event.get_summary().unwrap()) + } + + #[test] + fn test_with_dtend() { + let cal = IcalVCalendar::from_str(testdata::TEST_EVENT_MULTIDAY, None).unwrap(); + + let timestamp = Local.ymd(2018, 1, 1).and_hms(11, 30, 20); + let new_cal = cal.with_dtend(×tamp); + + let event = new_cal.get_principal_event(); + assert_eq!(timestamp, event.get_dtend().unwrap()) + } + + #[test] + fn test_with_dtstart() { + let cal = IcalVCalendar::from_str(testdata::TEST_EVENT_MULTIDAY, None).unwrap(); + + let timestamp = Local.ymd(2018, 1, 1).and_hms(11, 30, 20); + let new_cal = cal.with_dtstart(×tamp); + + let event = new_cal.get_principal_event(); + assert_eq!(timestamp, event.get_dtstart().unwrap()) + } + + #[test] fn test_with_internal_timestamp() { let cal = IcalVCalendar::from_str(testdata::TEST_EVENT_MULTIDAY, None).unwrap(); |