summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2019-12-20 20:48:20 +0100
committerGitHub <noreply@github.com>2019-12-20 20:48:20 +0100
commit1380db01f8d1cc813c7b7f9d42b75cad4318e845 (patch)
tree30efac3008bce35e07e37e5fc9644017fd695b54
parent4e065267398aaedcf827a3a26f11b0cba8d9bb19 (diff)
parentd4f30821e72c5f257db52b61d8448a49df405182 (diff)
Merge pull request #10 from matthiasbeyer/restructure
Restructure
-rw-r--r--src/component.rs12
-rw-r--r--src/lib.rs7
-rw-r--r--src/testing/data.rs (renamed from src/testdata.rs)0
-rw-r--r--src/testing/mod.rs1
-rw-r--r--src/testutils.rs16
-rw-r--r--src/utils/dateutil.rs23
-rw-r--r--src/utils/fileutil.rs50
-rw-r--r--src/utils/misc.rs18
-rw-r--r--src/vcalendar.rs67
-rw-r--r--src/vevent.rs40
10 files changed, 69 insertions, 165 deletions
diff --git a/src/component.rs b/src/component.rs
index 7de364c..d6e38b8 100644
--- a/src/component.rs
+++ b/src/component.rs
@@ -87,12 +87,12 @@ pub trait IcalComponent {
#[cfg(test)]
mod tests {
use super::*;
- use crate::testdata;
+ use crate::testing;
use crate::IcalVCalendar;
#[test]
fn get_property_test() {
- let cal = IcalVCalendar::from_str(testdata::TEST_EVENT_MULTIDAY, None).unwrap();
+ let cal = IcalVCalendar::from_str(testing::data::TEST_EVENT_MULTIDAY, None).unwrap();
let event = cal.get_principal_event();
let prop_name = "SUMMARY";
let prop_value: String = event.get_property_by_name(prop_name).unwrap().get_value();
@@ -106,7 +106,7 @@ mod tests {
#[test]
fn get_property_test_lastmodified() {
let cal =
- IcalVCalendar::from_str(testdata::TEST_EVENT_MULTIDAY_LASTMODIFIED, None).unwrap();
+ IcalVCalendar::from_str(testing::data::TEST_EVENT_MULTIDAY_LASTMODIFIED, None).unwrap();
let event = cal.get_principal_event();
let prop_name = "LAST-MODIFIED";
let prop_value: String = event.get_property_by_name(prop_name).unwrap().get_value();
@@ -116,7 +116,7 @@ mod tests {
#[test]
fn get_property_test_cal() {
- let cal = IcalVCalendar::from_str(testdata::TEST_EVENT_MULTIDAY, None).unwrap();
+ let cal = IcalVCalendar::from_str(testing::data::TEST_EVENT_MULTIDAY, None).unwrap();
let prop_name = "PRODID";
let prop_value: String = cal.get_property_by_name(prop_name).unwrap().get_value();
@@ -128,7 +128,7 @@ mod tests {
#[test]
fn get_property_test_negative() {
- let cal = IcalVCalendar::from_str(testdata::TEST_EVENT_MULTIDAY, None).unwrap();
+ let cal = IcalVCalendar::from_str(testing::data::TEST_EVENT_MULTIDAY, None).unwrap();
let event = cal.get_principal_event();
let prop_name = "DESCRIPTION";
let prop = event.get_property_by_name(prop_name);
@@ -138,7 +138,7 @@ mod tests {
#[test]
fn get_property_by_name_test() {
- let cal = IcalVCalendar::from_str(testdata::TEST_EVENT_MULTIDAY, None).unwrap();
+ let cal = IcalVCalendar::from_str(testing::data::TEST_EVENT_MULTIDAY, None).unwrap();
let event = cal.get_principal_event();
let prop_name = "NONSENSE";
let prop = event.get_property_by_name(prop_name);
diff --git a/src/lib.rs b/src/lib.rs
index d0fc056..89c64df 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -38,15 +38,12 @@ pub mod duration;
pub mod property;
pub mod time;
pub mod timezone;
-pub mod utils;
pub mod vcalendar;
pub mod vevent;
+mod utils;
#[cfg(test)]
-pub mod testdata;
-
-#[cfg(test)]
-pub mod testutils;
+pub mod testing;
pub use crate::component::IcalComponent;
pub use crate::duration::IcalDuration;
diff --git a/src/testdata.rs b/src/testing/data.rs
index 9237889..9237889 100644
--- a/src/testdata.rs
+++ b/src/testing/data.rs
diff --git a/src/testing/mod.rs b/src/testing/mod.rs
new file mode 100644
index 0000000..7a345e4
--- /dev/null
+++ b/src/testing/mod.rs
@@ -0,0 +1 @@
+pub mod data;
diff --git a/src/testutils.rs b/src/testutils.rs
deleted file mode 100644
index ade3ea1..0000000
--- a/src/testutils.rs
+++ /dev/null
@@ -1,16 +0,0 @@
-use assert_fs::fixture::{ChildPath, FixtureError};
-use assert_fs::prelude::*;
-use assert_fs::TempDir;
-use std::path::{Path, PathBuf};
-
-pub fn path_to(artifact: &str) -> PathBuf {
- [env!("CARGO_MANIFEST_DIR"), "testdata", artifact]
- .iter()
- .collect()
-}
-
-pub fn touch_testfile(testdir: &TempDir, relative_path: &Path) -> Result<ChildPath, FixtureError> {
- let testfile = testdir.child(relative_path);
- testfile.touch()?;
- Ok(testfile)
-}
diff --git a/src/utils/dateutil.rs b/src/utils/dateutil.rs
index 0f17971..7d3146a 100644
--- a/src/utils/dateutil.rs
+++ b/src/utils/dateutil.rs
@@ -4,7 +4,7 @@ use crate::utils::fileutil;
use std::env;
use std::path::PathBuf;
-pub fn date_from_str(date_str: &str) -> ParseResult<Date<Local>> {
+fn date_from_str(date_str: &str) -> ParseResult<Date<Local>> {
if date_str == "today" || date_str == "now" {
return Ok(Local::now().date());
}
@@ -20,7 +20,7 @@ pub fn datetime_from_str(datetime_str: &str) -> ParseResult<DateTime<Local>> {
Ok(Local.from_local_datetime(naive_datetime).unwrap())
}
-pub fn week_from_str_begin(date_str: &str) -> Result<Date<Local>, String> {
+fn week_from_str_begin(date_str: &str) -> Result<Date<Local>, String> {
let now = Local::now();
if date_str == "toweek" || date_str == "thisweek" {
return Ok(Local.isoywd(now.year(), now.iso_week().week(), Weekday::Mon));
@@ -56,11 +56,10 @@ pub fn now() -> DateTime<Utc> {
#[cfg(test)]
pub fn now() -> DateTime<Utc> {
- use crate::testdata;
- *testdata::NOW_TEST
+ *crate::testing::data::NOW_TEST
}
-pub fn week_from_str_end(date_str: &str) -> Result<Date<Local>, String> {
+fn week_from_str_end(date_str: &str) -> Result<Date<Local>, String> {
let now = Local::now();
if date_str == "toweek" || date_str == "thisweek" {
return Ok(Local.isoywd(now.year(), now.iso_week().week(), Weekday::Sun));
@@ -76,13 +75,6 @@ pub fn week_from_str_end(date_str: &str) -> Result<Date<Local>, String> {
Err("Could not parse '{}' as week".to_string())
}
-pub fn datetime_from_timestamp(timestamp: &str) -> Option<DateTime<Local>> {
- let timestamp_i64 = timestamp.parse::<i64>().ok()?;
- let naive_datetime = NaiveDateTime::from_timestamp_opt(timestamp_i64, 0)?;
- let utc_time: DateTime<Utc> = DateTime::from_utc(naive_datetime, Utc);
- Some(utc_time.with_timezone(&Local))
-}
-
#[cfg(test)]
mod tests {
use super::*;
@@ -142,11 +134,4 @@ mod tests {
week_from_str_end("nonsense").unwrap();
}
- #[test]
- fn test_datetime_from_timestamp() {
- let timestamp = "1547234687";
- let dt_from_ts = datetime_from_timestamp(timestamp).unwrap();
- let dt = Utc.ymd(2019, 01, 11).and_hms(19, 24, 47);
- assert_eq!(dt, dt_from_ts);
- }
}
diff --git a/src/utils/fileutil.rs b/src/utils/fileutil.rs
index aac3ab6..052b72f 100644
--- a/src/utils/fileutil.rs
+++ b/src/utils/fileutil.rs
@@ -1,55 +1,7 @@
-use std::fs::OpenOptions;
use std::io::prelude::*;
-use std::io::{BufRead, BufReader};
-use std::path::{Path, PathBuf};
+use std::path::Path;
use std::{fs, io};
-pub fn file_iter(dir: &Path) -> impl Iterator<Item = PathBuf> {
- use walkdir::WalkDir;
-
- WalkDir::new(dir)
- .follow_links(true)
- .into_iter()
- .filter_map(|e| e.ok())
- .filter(|e| e.file_type().is_file())
- .map(|entry| entry.into_path())
-}
-
-pub fn dir_iter(dir: &Path) -> impl Iterator<Item = PathBuf> {
- use walkdir::WalkDir;
-
- let dir = dir.to_path_buf();
- WalkDir::new(&dir)
- .follow_links(true)
- .into_iter()
- .filter_map(|e| e.ok())
- .filter(|e| e.file_type().is_dir())
- .filter(move |f| f.path() != dir)
- .map(|entry| entry.into_path())
-}
-
-pub fn write_file(filepath: &Path, contents: &str) -> io::Result<()> {
- let mut file = fs::File::create(filepath)?;
- file.write_all(contents.as_bytes())
-}
-
-pub fn append_file(filepath: &Path, contents: &str) -> io::Result<()> {
- let mut file = OpenOptions::new()
- .append(true)
- .create(true)
- .open(filepath)?;
- file.write_all(contents.as_bytes())
-}
-
-pub fn read_lines_from_file(
- filepath: &Path,
-) -> io::Result<impl DoubleEndedIterator<Item = String>> {
- let f = fs::File::open(filepath)?;
- let f = BufReader::new(f);
- let lines: Result<Vec<String>, io::Error> = f.lines().collect();
- lines.map(|result| result.into_iter())
-}
-
pub fn read_file_to_string(path: &Path) -> io::Result<String> {
let mut file = fs::File::open(&path)?;
let mut contents = String::new();
diff --git a/src/utils/misc.rs b/src/utils/misc.rs
index f02ddeb..d5b0551 100644
--- a/src/utils/misc.rs
+++ b/src/utils/misc.rs
@@ -1,4 +1,3 @@
-use chrono::prelude::*;
use std::fmt::Display;
use std::time;
@@ -19,23 +18,6 @@ pub fn format_duration(duration: &time::Duration) -> impl Display {
duration.as_millis()
}
-pub fn get_bucket_for_date(date: Date<Local>) -> String {
- date.format("%G-W%V").to_string()
-}
-
-#[cfg(not(test))]
-pub fn make_new_uid() -> String {
- use uuid::Uuid;
-
- let suffix = "@khaleesi";
- format!("{}{}", Uuid::new_v4().to_hyphenated_ref(), suffix)
-}
-
-#[cfg(test)]
-pub fn make_new_uid() -> String {
- "11111111-2222-3333-4444-444444444444@khaleesi".to_string()
-}
-
#[cfg(test)]
mod tests {
use super::*;
diff --git a/src/vcalendar.rs b/src/vcalendar.rs
index 09752d5..f925df3 100644
--- a/src/vcalendar.rs
+++ b/src/vcalendar.rs
@@ -2,6 +2,7 @@ use std::ffi::{CStr, CString};
use std::io;
use std::path::{Path, PathBuf};
use std::rc::Rc;
+use std::string::ToString;
use super::IcalComponent;
use super::IcalTime;
@@ -91,20 +92,13 @@ impl IcalVCalendar {
}
}
- pub fn with_normalize(self) -> Self {
+ pub fn normalized(self) -> Self {
unsafe {
ical::icalcomponent_normalize(self.get_ptr());
}
self
}
- pub fn to_string(&self) -> String {
- unsafe {
- let ical_cstr = CStr::from_ptr(ical::icalcomponent_as_ical_string(self.get_ptr()));
- ical_cstr.to_string_lossy().into_owned()
- }
- }
-
pub fn get_uid(&self) -> String {
unsafe {
let uid_cstr = CStr::from_ptr(ical::icalcomponent_get_uid(
@@ -358,6 +352,15 @@ impl IcalVCalendar {
}
}
+impl ToString for IcalVCalendar {
+ fn to_string(&self) -> String {
+ unsafe {
+ let ical_cstr = CStr::from_ptr(ical::icalcomponent_as_ical_string(self.get_ptr()));
+ ical_cstr.to_string_lossy().into_owned()
+ }
+ }
+}
+
impl<'a> IcalEventIter<'a> {
fn from_vcalendar(cal: &'a IcalVCalendar) -> Self {
let vevent_kind = ical::icalcomponent_kind_ICAL_VEVENT_COMPONENT;
@@ -406,7 +409,7 @@ impl Drop for IcalComponentOwner {
#[cfg(test)]
mod tests {
use super::*;
- use crate::testdata;
+ use crate::testing;
#[test]
fn test_from_str_empty() {
@@ -415,39 +418,39 @@ mod tests {
#[test]
fn test_from_str_event() {
- assert!(IcalVCalendar::from_str(testdata::TEST_BARE_EVENT, None).is_err());
+ assert!(IcalVCalendar::from_str(testing::data::TEST_BARE_EVENT, None).is_err());
}
#[test]
fn event_iterator_element_count() {
- let cal = IcalVCalendar::from_str(testdata::TEST_EVENT_MULTIDAY, None).unwrap();
+ let cal = IcalVCalendar::from_str(testing::data::TEST_EVENT_MULTIDAY, None).unwrap();
assert_eq!(cal.events_iter().count(), 1)
}
#[test]
fn event_iterator_element_count_with_other() {
let cal =
- IcalVCalendar::from_str(testdata::TEST_EVENT_WITH_TIMEZONE_COMPONENT, None).unwrap();
+ IcalVCalendar::from_str(testing::data::TEST_EVENT_WITH_TIMEZONE_COMPONENT, None).unwrap();
assert_eq!(cal.events_iter().count(), 1)
}
#[test]
fn load_serialize() {
- let cal = IcalVCalendar::from_str(testdata::TEST_EVENT_MULTIDAY, None).unwrap();
+ let cal = IcalVCalendar::from_str(testing::data::TEST_EVENT_MULTIDAY, None).unwrap();
let back = cal.to_string().replace("\r\n", "\n");
- assert_eq!(back.trim(), testdata::TEST_EVENT_MULTIDAY)
+ assert_eq!(back.trim(), testing::data::TEST_EVENT_MULTIDAY)
}
#[test]
fn load_serialize_with_error() {
- let cal = IcalVCalendar::from_str(testdata::TEST_EVENT_WITH_X_LIC_ERROR, None).unwrap();
+ let cal = IcalVCalendar::from_str(testing::data::TEST_EVENT_WITH_X_LIC_ERROR, None).unwrap();
let back = cal.to_string().replace("\r\n", "\n");
- assert_eq!(back.trim(), testdata::TEST_EVENT_WITH_X_LIC_ERROR)
+ assert_eq!(back.trim(), testing::data::TEST_EVENT_WITH_X_LIC_ERROR)
}
#[test]
fn with_dtstamp_test() {
- let mut cal = IcalVCalendar::from_str(testdata::TEST_EVENT_MULTIDAY, None).unwrap();
+ let mut cal = IcalVCalendar::from_str(testing::data::TEST_EVENT_MULTIDAY, None).unwrap();
cal = cal.with_dtstamp_now();
let event = cal.get_principal_event();
@@ -460,13 +463,13 @@ mod tests {
fn get_calendar_name_test() {
let path = PathBuf::from("calname/event");
let cal =
- IcalVCalendar::from_str(testdata::TEST_EVENT_MULTIDAY_ALLDAY, Some(&path)).unwrap();
+ IcalVCalendar::from_str(testing::data::TEST_EVENT_MULTIDAY_ALLDAY, Some(&path)).unwrap();
assert_eq!("calname".to_string(), cal.get_calendar_name().unwrap())
}
#[test]
fn test_get_all_properties_cal() {
- let cal = IcalVCalendar::from_str(testdata::TEST_EVENT_MULTIDAY, None).unwrap();
+ let cal = IcalVCalendar::from_str(testing::data::TEST_EVENT_MULTIDAY, None).unwrap();
let props = cal.get_properties_all();
assert_eq!(2, props.len());
@@ -474,7 +477,7 @@ mod tests {
#[test]
fn parse_checker_test_empty_summary() {
- let c_str = CString::new(testdata::TEST_EVENT_EMPTY_SUMMARY).unwrap();
+ let c_str = CString::new(testing::data::TEST_EVENT_EMPTY_SUMMARY).unwrap();
unsafe {
let parsed_cal = ical::icalparser_parse_string(c_str.as_ptr());
assert!(IcalVCalendar::check_icalcomponent(parsed_cal).is_some())
@@ -483,7 +486,7 @@ mod tests {
#[test]
fn parse_checker_test_no_uid() {
- let c_str = CString::new(testdata::TEST_EVENT_NO_UID).unwrap();
+ let c_str = CString::new(testing::data::TEST_EVENT_NO_UID).unwrap();
unsafe {
let parsed_cal = ical::icalparser_parse_string(c_str.as_ptr());
assert!(IcalVCalendar::check_icalcomponent(parsed_cal).is_some())
@@ -492,7 +495,7 @@ mod tests {
#[test]
fn parse_checker_test_no_prodid() {
- let c_str = CString::new(testdata::TEST_EVENT_NO_PRODID).unwrap();
+ let c_str = CString::new(testing::data::TEST_EVENT_NO_PRODID).unwrap();
unsafe {
let parsed_cal = ical::icalparser_parse_string(c_str.as_ptr());
assert!(IcalVCalendar::check_icalcomponent(parsed_cal).is_some())
@@ -502,7 +505,7 @@ mod tests {
#[test]
fn test_with_last_modified_now() {
let cal =
- IcalVCalendar::from_str(testdata::TEST_EVENT_MULTIDAY_LASTMODIFIED, None).unwrap();
+ IcalVCalendar::from_str(testing::data::TEST_EVENT_MULTIDAY_LASTMODIFIED, None).unwrap();
let new_cal = cal.with_last_modified_now();
let event = new_cal.get_principal_event();
@@ -516,7 +519,7 @@ mod tests {
#[test]
fn test_with_last_modified_now_added() {
- let cal = IcalVCalendar::from_str(testdata::TEST_EVENT_MULTIDAY, None).unwrap();
+ let cal = IcalVCalendar::from_str(testing::data::TEST_EVENT_MULTIDAY, None).unwrap();
let new_cal = cal.with_last_modified_now();
let event = new_cal.get_principal_event();
@@ -530,7 +533,7 @@ mod tests {
#[test]
fn test_with_location() {
- let cal = IcalVCalendar::from_str(testdata::TEST_EVENT_MULTIDAY, None).unwrap();
+ let cal = IcalVCalendar::from_str(testing::data::TEST_EVENT_MULTIDAY, None).unwrap();
let location = "test";
let new_cal = cal.with_location(location);
@@ -541,7 +544,7 @@ mod tests {
//#[test]
//fn test_with_internal_timestamp() {
- //let cal = IcalVCalendar::from_str(testdata::TEST_EVENT_MULTIDAY, None).unwrap();
+ //let cal = IcalVCalendar::from_str(testing::data::TEST_EVENT_MULTIDAY, None).unwrap();
//
//let timestamp = IcalTime::floating_ymd(2018, 1, 1).and_hms(11, 30, 20);
//let new_cal = cal.with_internal_timestamp(&timestamp);
@@ -553,7 +556,7 @@ mod tests {
#[test]
fn with_uid_test() {
let path = PathBuf::from("test/path");
- let cal = IcalVCalendar::from_str(testdata::TEST_EVENT_MULTIDAY, Some(&path)).unwrap();
+ let cal = IcalVCalendar::from_str(testing::data::TEST_EVENT_MULTIDAY, Some(&path)).unwrap();
let uid = "my_new_uid";
let new_cal = cal.with_uid(uid).unwrap();
@@ -570,7 +573,7 @@ mod tests {
#[test]
fn with_uid_multiple_test() {
let path = PathBuf::from("test/path");
- let cal = IcalVCalendar::from_str(testdata::TEST_MULTIPLE_EVENTS, Some(&path)).unwrap();
+ let cal = IcalVCalendar::from_str(testing::data::TEST_MULTIPLE_EVENTS, Some(&path)).unwrap();
let uid = "my_new_uid";
let new_cal = cal.with_uid(uid);
@@ -581,7 +584,7 @@ mod tests {
#[test]
fn with_keep_uid_test() {
let path = PathBuf::from("test/path");
- let cal = IcalVCalendar::from_str(testdata::TEST_MULTIPLE_EVENTS, Some(&path)).unwrap();
+ let cal = IcalVCalendar::from_str(testing::data::TEST_MULTIPLE_EVENTS, Some(&path)).unwrap();
for uid in &["uid1", "uid2"] {
let new_cal = cal.clone().with_keep_uid(uid);
@@ -595,7 +598,7 @@ mod tests {
#[test]
fn clone_test() {
let path = PathBuf::from("test/path");
- let cal = IcalVCalendar::from_str(testdata::TEST_EVENT_MULTIDAY, Some(&path)).unwrap();
+ let cal = IcalVCalendar::from_str(testing::data::TEST_EVENT_MULTIDAY, Some(&path)).unwrap();
let cal2 = cal.clone().with_uid("my_new_uid").unwrap();
assert_ne!(cal.get_uid(), cal2.get_uid());
@@ -603,7 +606,7 @@ mod tests {
#[test]
fn parse_checker_test_negative() {
- let c_str = CString::new(testdata::TEST_EVENT_NO_PRODID).unwrap();
+ let c_str = CString::new(testing::data::TEST_EVENT_NO_PRODID).unwrap();
unsafe {
let parsed_cal = ical::icalparser_parse_string(c_str.as_ptr());
assert!(IcalVCalendar::check_icalcomponent(parsed_cal).is_some())
@@ -612,7 +615,7 @@ mod tests {
#[test]
fn parse_checker_test() {
- let cal = IcalVCalendar::from_str(testdata::TEST_EVENT_MULTIDAY, None).unwrap();
+ let cal = IcalVCalendar::from_str(testing::data::TEST_EVENT_MULTIDAY, None).unwrap();
assert!(cal.check_for_errors().is_none());
}
}
diff --git a/src/vevent.rs b/src/vevent.rs
index 97d4bcc..d8b345f 100644
--- a/src/vevent.rs
+++ b/src/vevent.rs
@@ -205,12 +205,12 @@ extern "C" fn recur_callback(
#[cfg(test)]
mod tests {
use super::*;
- use crate::testdata;
+ use crate::testing;
use chrono::NaiveDate;
#[test]
fn test_get_all_properties() {
- let cal = IcalVCalendar::from_str(testdata::TEST_EVENT_MULTIDAY, None).unwrap();
+ let cal = IcalVCalendar::from_str(testing::data::TEST_EVENT_MULTIDAY, None).unwrap();
let event = cal.get_principal_event();
let props = event.get_properties_all();
@@ -219,7 +219,7 @@ mod tests {
#[test]
fn test_get_property_get_value() {
- let cal = IcalVCalendar::from_str(testdata::TEST_EVENT_MULTIDAY_ALLDAY, None).unwrap();
+ let cal = IcalVCalendar::from_str(testing::data::TEST_EVENT_MULTIDAY_ALLDAY, None).unwrap();
let event = cal.get_principal_event();
let prop = event.get_properties_by_name("DTSTART");
@@ -234,7 +234,7 @@ mod tests {
#[test]
fn test_get_property_debug() {
- let cal = IcalVCalendar::from_str(testdata::TEST_EVENT_MULTIDAY_ALLDAY, None).unwrap();
+ let cal = IcalVCalendar::from_str(testing::data::TEST_EVENT_MULTIDAY_ALLDAY, None).unwrap();
let event = cal.get_principal_event();
let prop = event
.get_property(ical::icalproperty_kind_ICAL_DTSTART_PROPERTY)
@@ -245,7 +245,7 @@ mod tests {
#[test]
fn test_get_summary() {
- let cal = IcalVCalendar::from_str(testdata::TEST_EVENT_MULTIDAY, None).unwrap();
+ let cal = IcalVCalendar::from_str(testing::data::TEST_EVENT_MULTIDAY, None).unwrap();
let event = cal.get_principal_event();
assert_eq!(
@@ -256,7 +256,7 @@ mod tests {
#[test]
fn test_get_summary_none() {
- let cal = IcalVCalendar::from_str(testdata::TEST_NO_SUMMARY, None).unwrap();
+ let cal = IcalVCalendar::from_str(testing::data::TEST_NO_SUMMARY, None).unwrap();
let event = cal.get_principal_event();
assert_eq!(None, event.get_summary());
@@ -264,7 +264,7 @@ mod tests {
#[test]
fn test_get_dtstart() {
- let cal = IcalVCalendar::from_str(testdata::TEST_EVENT_MULTIDAY, None).unwrap();
+ let cal = IcalVCalendar::from_str(testing::data::TEST_EVENT_MULTIDAY, None).unwrap();
let event = cal.get_principal_event();
assert_eq!(
@@ -275,7 +275,7 @@ mod tests {
#[test]
fn test_get_dtstart_negative() {
- let cal = IcalVCalendar::from_str(testdata::TEST_NO_DTSTART, None).unwrap();
+ let cal = IcalVCalendar::from_str(testing::data::TEST_NO_DTSTART, None).unwrap();
let event = cal.get_principal_event();
assert!(event.get_dtstart().is_none());
@@ -283,7 +283,7 @@ mod tests {
#[test]
fn test_get_dtend() {
- let cal = IcalVCalendar::from_str(testdata::TEST_EVENT_MULTIDAY, None).unwrap();
+ let cal = IcalVCalendar::from_str(testing::data::TEST_EVENT_MULTIDAY, None).unwrap();
let event = cal.get_principal_event();
assert_eq!(
@@ -294,7 +294,7 @@ mod tests {
#[test]
fn test_get_dtend_negative() {
- let cal = IcalVCalendar::from_str(testdata::TEST_NO_DTSTART, None).unwrap();
+ let cal = IcalVCalendar::from_str(testing::data::TEST_NO_DTSTART, None).unwrap();
let event = cal.get_principal_event();
assert!(event.get_dtend().is_none());
@@ -302,7 +302,7 @@ mod tests {
#[test]
fn test_get_duration_internal_normal() {
- let cal = IcalVCalendar::from_str(testdata::TEST_EVENT_MULTIDAY, None).unwrap();
+ let cal = IcalVCalendar::from_str(testing::data::TEST_EVENT_MULTIDAY, None).unwrap();
let event = cal.get_principal_event();
assert_eq!(
@@ -313,7 +313,7 @@ mod tests {
#[test]
fn test_get_duration_normal() {
- let cal = IcalVCalendar::from_str(testdata::TEST_EVENT_MULTIDAY, None).unwrap();
+ let cal = IcalVCalendar::from_str(testing::data::TEST_EVENT_MULTIDAY, None).unwrap();
let event = cal.get_principal_event();
assert_eq!(
@@ -324,7 +324,7 @@ mod tests {
#[test]
fn test_get_duration_inernal_startdate_only() {
- let cal = IcalVCalendar::from_str(testdata::TEST_DTSTART_ONLY_DATE, None).unwrap();
+ let cal = IcalVCalendar::from_str(testing::data::TEST_DTSTART_ONLY_DATE, None).unwrap();
let event = cal.get_principal_event();
assert!(event.get_duration_internal().is_none());
@@ -332,7 +332,7 @@ mod tests {
#[test]
fn test_get_duration_startdate_only() {
- let cal = IcalVCalendar::from_str(testdata::TEST_DTSTART_ONLY_DATE, None).unwrap();
+ let cal = IcalVCalendar::from_str(testing::data::TEST_DTSTART_ONLY_DATE, None).unwrap();
let event = cal.get_principal_event();
assert_eq!(
@@ -343,7 +343,7 @@ mod tests {
#[test]
fn test_get_duration_internal_startdatetime_only() {
- let cal = IcalVCalendar::from_str(testdata::TEST_DTSTART_ONLY_DATETIME, None).unwrap();
+ let cal = IcalVCalendar::from_str(testing::data::TEST_DTSTART_ONLY_DATETIME, None).unwrap();
let event = cal.get_principal_event();
assert!(event.get_duration_internal().is_none());
@@ -351,7 +351,7 @@ mod tests {
#[test]
fn test_get_duration_startdatetime_only() {
- let cal = IcalVCalendar::from_str(testdata::TEST_DTSTART_ONLY_DATETIME, None).unwrap();
+ let cal = IcalVCalendar::from_str(testing::data::TEST_DTSTART_ONLY_DATETIME, None).unwrap();
let event = cal.get_principal_event();
assert_eq!(Some(IcalDuration::from_seconds(0)), event.get_duration());
@@ -359,7 +359,7 @@ mod tests {
#[test]
fn test_get_description() {
- let cal = IcalVCalendar::from_str(testdata::TEST_EVENT_ONE_MEETING, None).unwrap();
+ let cal = IcalVCalendar::from_str(testing::data::TEST_EVENT_ONE_MEETING, None).unwrap();
let event = cal.get_principal_event();
assert_eq!(
@@ -373,7 +373,7 @@ mod tests {
#[test]
fn test_get_description_none() {
- let cal = IcalVCalendar::from_str(testdata::TEST_EVENT_MULTIDAY, None).unwrap();
+ let cal = IcalVCalendar::from_str(testing::data::TEST_EVENT_MULTIDAY, None).unwrap();
let event = cal.get_principal_event();
assert_eq!(None, event.get_description());
@@ -381,7 +381,7 @@ mod tests {
#[test]
fn test_get_location() {
- let cal = IcalVCalendar::from_str(testdata::TEST_EVENT_ONE_MEETING, None).unwrap();
+ let cal = IcalVCalendar::from_str(testing::data::TEST_EVENT_ONE_MEETING, None).unwrap();
let event = cal.get_principal_event();
assert_eq!(Some("LDB Lobby".to_string()), event.get_location());
@@ -389,7 +389,7 @@ mod tests {
#[test]
fn test_get_location_none() {
- let cal = IcalVCalendar::from_str(testdata::TEST_NO_SUMMARY, None).unwrap();
+ let cal = IcalVCalendar::from_str(testing::data::TEST_NO_SUMMARY, None).unwrap();
let event = cal.get_principal_event();
assert_eq!(None, event.get_location());