From 52d52208c879c63f5e33fb4f743014b8585dc05a Mon Sep 17 00:00:00 2001 From: Lars Henriksen Date: Sun, 28 Apr 2019 00:20:37 +0200 Subject: Test cases for impossible dates in recurrence rule Signed-off-by: Lars Henriksen Signed-off-by: Lukas Fleischer --- test/Makefile.am | 3 ++- test/data/apts-recur | 2 ++ test/recur-006.sh | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 54 insertions(+), 1 deletion(-) create mode 100755 test/recur-006.sh diff --git a/test/Makefile.am b/test/Makefile.am index 7040505..12998c9 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -60,7 +60,8 @@ TESTS = \ recur-002.sh \ recur-003.sh \ recur-004.sh \ - recur-005.sh + recur-005.sh \ + recur-006.sh TESTS_ENVIRONMENT = \ TEST_INIT='$(top_srcdir)/test/test-init.sh' \ diff --git a/test/data/apts-recur b/test/data/apts-recur index 0fdfe3e..6c08da0 100644 --- a/test/data/apts-recur +++ b/test/data/apts-recur @@ -10,3 +10,5 @@ 01/01/2000 @ 16:00 -> 01/02/2000 @ 02:00 {2D} |Recurrent appointment 01/01/2000 @ 00:00 -> 01/07/2000 @ 00:00 {1W} |Another recurrent appointment 01/01/2000 @ 00:00 -> 01/07/2000 @ 00:00 {1D} |Third recurrent appointment +05/31/2019 @ 07:25 -> 05/31/2019 @ 07:45 {1M} |Ignore impossible dates +02/29/2020 [1] {1Y} Every 29 February since 2020 diff --git a/test/recur-006.sh b/test/recur-006.sh new file mode 100755 index 0000000..3486391 --- /dev/null +++ b/test/recur-006.sh @@ -0,0 +1,50 @@ +#!/bin/sh +# Ignore impossible dates. + +. "${TEST_INIT:-./test-init.sh}" + +if [ "$1" = 'actual' ]; then + "$CALCURSE" --read-only -D "$DATA_DIR"/ -c "$DATA_DIR/apts-recur" \ + --startday=5/31/2019 --range=365 --filter-type recur-apt \ + --filter-pattern impossible + "$CALCURSE" --read-only -D "$DATA_DIR"/ -c "$DATA_DIR/apts-recur" \ + --startday=2/1/2020 --range=1500 --filter-type recur-event \ + --filter-pattern February +elif [ "$1" = 'expected' ]; then + cat < 07:45 + Ignore impossible dates + +07/31/19: + - 07:25 -> 07:45 + Ignore impossible dates + +08/31/19: + - 07:25 -> 07:45 + Ignore impossible dates + +10/31/19: + - 07:25 -> 07:45 + Ignore impossible dates + +12/31/19: + - 07:25 -> 07:45 + Ignore impossible dates + +01/31/20: + - 07:25 -> 07:45 + Ignore impossible dates + +03/31/20: + - 07:25 -> 07:45 + Ignore impossible dates +02/29/20: + * Every 29 February since 2020 + +02/29/24: + * Every 29 February since 2020 +EOD +else + ./run-test "$0" +fi -- cgit v1.2.3-70-g09d2