summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/bin/khaleesi.rs12
-rw-r--r--testdata/testdir/cal/twodaysacrossbuckets.ics (renamed from testdata/cal/twodaysacrossbuckets.ics)0
-rw-r--r--testdata/testdir_with_index/cal/twodaysacrossbuckets.ics31
-rw-r--r--testdata/testdir_with_index/index/2018-W501
-rw-r--r--testdata/testdir_with_index/index/2018-W511
5 files changed, 37 insertions, 8 deletions
diff --git a/src/bin/khaleesi.rs b/src/bin/khaleesi.rs
index ef3cab4..cdcab7c 100644
--- a/src/bin/khaleesi.rs
+++ b/src/bin/khaleesi.rs
@@ -188,12 +188,9 @@ mod tests {
[env!("CARGO_MANIFEST_DIR"), "testdata", artifact].iter().collect()
}
- fn prepare_testdir() -> TempDir {
+ fn prepare_testdir(template: &str) -> TempDir {
let testdir = TempDir::new().unwrap();
- let testdir_cal = testdir.child(".khaleesi/cal");
-
- testdir_cal.copy_from(path_to("cal"), &["*"]).unwrap();
-
+ testdir.child(".khaleesi/").copy_from(path_to(template), &["*"]).unwrap();
testdir
}
@@ -202,17 +199,16 @@ mod tests {
let config = config.unwrap_or_default();
let args: Vec<String> = args.iter().map(|x| x.to_string()).collect();
- main_internal("khaleesi", &args, config);
+ main_internal("khaleesi", &args, config)
}
#[test]
fn test_index() {
- let testdir = prepare_testdir();
+ let testdir = prepare_testdir("testdir");
run(&testdir, &["index"], None);
testdir.child(".khaleesi/index/2018-W50").assert("1544740200 .khaleesi/cal/twodaysacrossbuckets.ics");
testdir.child(".khaleesi/index/2018-W51").assert("1544740200 .khaleesi/cal/twodaysacrossbuckets.ics");
}
-
}
diff --git a/testdata/cal/twodaysacrossbuckets.ics b/testdata/testdir/cal/twodaysacrossbuckets.ics
index ff238b2..ff238b2 100644
--- a/testdata/cal/twodaysacrossbuckets.ics
+++ b/testdata/testdir/cal/twodaysacrossbuckets.ics
diff --git a/testdata/testdir_with_index/cal/twodaysacrossbuckets.ics b/testdata/testdir_with_index/cal/twodaysacrossbuckets.ics
new file mode 100644
index 0000000..ff238b2
--- /dev/null
+++ b/testdata/testdir_with_index/cal/twodaysacrossbuckets.ics
@@ -0,0 +1,31 @@
+BEGIN:VCALENDAR
+VERSION:2.0
+CALSCALE:GREGORIAN
+PRODID:-//Ximian//NONSGML Evolution Calendar//EN
+BEGIN:VTIMEZONE
+TZID:/freeassociation.sourceforge.net/Europe/Berlin
+X-LIC-LOCATION:Europe/Berlin
+BEGIN:STANDARD
+TZNAME:CET
+DTSTART:19701028T030000
+RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=10
+TZOFFSETFROM:+0200
+TZOFFSETTO:+0100
+END:STANDARD
+BEGIN:DAYLIGHT
+TZNAME:CEST
+DTSTART:19700325T020000
+RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=3
+TZOFFSETFROM:+0100
+TZOFFSETTO:+0200
+END:DAYLIGHT
+END:VTIMEZONE
+BEGIN:VEVENT
+UID:20181129T142636Z-11617-1000-1-0@pool-4-4
+DTSTAMP:20181129T092002Z
+DTSTART;TZID=/freeassociation.sourceforge.net/Europe/Berlin:20181213T233000
+DTEND;TZID=/freeassociation.sourceforge.net/Europe/Berlin:20181217T193000
+SEQUENCE:2
+SUMMARY:shows up on two days
+END:VEVENT
+END:VCALENDAR
diff --git a/testdata/testdir_with_index/index/2018-W50 b/testdata/testdir_with_index/index/2018-W50
new file mode 100644
index 0000000..a394657
--- /dev/null
+++ b/testdata/testdir_with_index/index/2018-W50
@@ -0,0 +1 @@
+1544740200 .khaleesi/cal/twodaysacrossbuckets.ics \ No newline at end of file
diff --git a/testdata/testdir_with_index/index/2018-W51 b/testdata/testdir_with_index/index/2018-W51
new file mode 100644
index 0000000..a394657
--- /dev/null
+++ b/testdata/testdir_with_index/index/2018-W51
@@ -0,0 +1 @@
+1544740200 .khaleesi/cal/twodaysacrossbuckets.ics \ No newline at end of file