X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/1e0b1d40a6285c532b722f4584fa7ddde220deff..213e031dda6a34c50c04de0d6041f45ab2db0a91:/test/mhical/test-mhical?ds=sidebyside diff --git a/test/mhical/test-mhical b/test/mhical/test-mhical index b1146cc1..85962f29 100755 --- a/test/mhical/test-mhical +++ b/test/mhical/test-mhical @@ -16,9 +16,10 @@ fi setup_test +check_exit '-eq 1' mhical - + #### Make sure that html-to-text conversion is what we expect. -require_locale en_US.utf-8 en_US.utf8 -LC_ALL=en_US.UTF-8; export LC_ALL +require_locale en_US.UTF-8 en_US.UTF8 en_US.utf-8 en_US.utf8 #### Disable colorized output. TERM=dumb; export TERM @@ -46,7 +47,8 @@ Usage: mhical [switches] -help EOF -run_prog mhical -help >"$actual" 2>&1 +#### Skip nmh intro text. +run_prog mhical -help | sed '/^$/,$d' >"$actual" 2>&1 check "$expected" "$actual" @@ -93,7 +95,6 @@ EOF TZ=UTC mhical <"$MH_TEST_DIR/test1.ics" >"$MH_TEST_DIR/test1.txt" check "$expected" "$MH_TEST_DIR/test1.txt" -rm -f "$MH_TEST_DIR/test1.ics" # check display with 24 hour time format and -outfile @@ -120,7 +121,6 @@ EOF mhical -outfile "$MH_TEST_DIR/test1.txt" <"$MH_TEST_DIR/test1.ics" check "$expected" "$MH_TEST_DIR/test1.txt" -rm -f "$MH_TEST_DIR/test1.ics" # check display with 12 hour time format and -infile @@ -148,7 +148,6 @@ EOF mhical -form mhical.12hour -infile "$MH_TEST_DIR/test1.ics" \ >"$MH_TEST_DIR/test1.txt" check "$expected" "$MH_TEST_DIR/test1.txt" -rm -f "$MH_TEST_DIR/test1.ics" # check display with DST @@ -217,7 +216,6 @@ EOF TZ=EST mhical <"$MH_TEST_DIR/test1.ics" >"$MH_TEST_DIR/test1.txt" check "$expected" "$MH_TEST_DIR/test1.txt" -rm -f "$MH_TEST_DIR/test1.ics" # check timezone boundary at transition to daylight saving time @@ -269,7 +267,6 @@ EOF TZ=EST5EDT mhical -format '%(pretty{dtend})' \ -infile "$MH_TEST_DIR/test1.ics" -outfile "$MH_TEST_DIR/test1.txt" check "$expected" "$MH_TEST_DIR/test1.txt" -rm -f "$MH_TEST_DIR/test1.ics" # check timezone boundary at transition from daylight saving time @@ -319,7 +316,6 @@ EOF TZ=EST5EDT mhical -format '%(pretty{dtend})' \ -infile "$MH_TEST_DIR/test1.ics" -outfile "$MH_TEST_DIR/test1.txt" check "$expected" "$MH_TEST_DIR/test1.txt" -rm -f "$MH_TEST_DIR/test1.ics" printf 'Local-Mailbox: Requestee2 \n' >> "$MH" @@ -413,7 +409,6 @@ EOF mhical -reply accept <"$MH_TEST_DIR/test1.ics" | egrep -v '^DTSTAMP:' \ >"$MH_TEST_DIR/test1.txt" check "$expected" "$MH_TEST_DIR/test1.txt" -rm -f "$MH_TEST_DIR/test1.ics" # check accept of multiple vevent requests in single vcalendar cat >"$expected" <<'EOF' @@ -546,7 +541,6 @@ EOF mhical -reply accept <"$MH_TEST_DIR/test1.ics" | egrep -v '^DTSTAMP:' \ >"$MH_TEST_DIR/test1.txt" check "$expected" "$MH_TEST_DIR/test1.txt" -rm -f "$MH_TEST_DIR/test1.ics" # check decline of request @@ -608,7 +602,6 @@ EOF mhical -reply decline <"$MH_TEST_DIR/test1.ics" | egrep -v '^DTSTAMP:' \ >"$MH_TEST_DIR/test1.txt" check "$expected" "$MH_TEST_DIR/test1.txt" -rm -f "$MH_TEST_DIR/test1.ics" # check response of tentative to request, and -nocontenttype @@ -671,7 +664,6 @@ mhical -reply tentative -contenttype -nocontenttype \ -infile "$MH_TEST_DIR/test1.ics" | egrep -v '^DTSTAMP:' \ >"$MH_TEST_DIR/test1.txt" check "$expected" "$MH_TEST_DIR/test1.txt" -rm -f "$MH_TEST_DIR/test1.ics" # check cancel request, and -contenttype @@ -736,6 +728,74 @@ EOF mhical -cancel -contenttype <"$MH_TEST_DIR/test1.ics" | egrep -v '^DTSTAMP:' \ >"$MH_TEST_DIR/test1.txt" check "$expected" "$MH_TEST_DIR/test1.txt" + + +# Check TZID name wrapped with quotes, this used to cause a segfault. +cat >"$expected" <<'EOF' +Method: REQUEST +Summary: Quoted timezone ID +At: Wed, 01 Jan 2014 00:00 +To: Wed, 01 Jan 2014 01:00 +EOF + +cat >"$MH_TEST_DIR/test1.ics" <<'EOF' +BEGIN:VCALENDAR +PRODID:Zimbra-Calendar-Provider +VERSION:2.0 +METHOD:REQUEST +SUMMARY:Quoted timezone ID +BEGIN:VTIMEZONE +TZID:Etc/GMT +BEGIN:STANDARD +DTSTART:19710101T000000 +TZOFFSETTO:-0000 +TZOFFSETFROM:-0000 +TZNAME:GMT +END:STANDARD +END:VTIMEZONE +BEGIN:VEVENT +DTSTART:20140101T000000 +DTEND;TZID="Etc/GMT":20140101T010000 +SEQUENCE:0 +END:VEVENT +END:VCALENDAR +EOF + +TZ=UTC mhical <"$MH_TEST_DIR/test1.ics" >"$MH_TEST_DIR/test1.txt" +check "$expected" "$MH_TEST_DIR/test1.txt" + + +# Check start datetime without a time, and missing end datetime. +cat >"$expected" <<'EOF' +Method: PUBLISH +Summary: Test datetime without time +At: Wed, 30 Dec 2015 00:00 +To: Wed, 30 Dec 2015 23:59 +EOF + +cat >"$MH_TEST_DIR/test1.ics" <<'EOF' +BEGIN:VCALENDAR +VERSION:2.0 +PRODID:icalendar-ruby +CALSCALE:GREGORIAN +METHOD:PUBLISH +BEGIN:VEVENT +DTSTAMP:20151208T204350Z +UID:0123456789 +DTSTART;VALUE=DATE:20151230 +CLASS:PRIVATE +SUMMARY:Test datetime without time +BEGIN:VALARM +ACTION:DISPLAY +DESCRIPTION:REMINDER +TRIGGER;RELATED=START:-PT15M +END:VALARM +END:VEVENT +END:VCALENDAR +EOF + +TZ=UTC mhical <"$MH_TEST_DIR/test1.ics" >"$MH_TEST_DIR/test1.txt" +check "$expected" "$MH_TEST_DIR/test1.txt" rm -f "$MH_TEST_DIR/test1.ics"