2 ######################################################
6 ######################################################
10 if test -z "${MH_OBJ_DIR}"; then
11 srcdir
=`dirname $0`/..
/..
12 MH_OBJ_DIR
=`cd $srcdir && pwd`; export MH_OBJ_DIR
15 .
"${MH_OBJ_DIR}/test/common.sh"
19 check_exit
'-eq 1' mhical
-
21 #### Make sure that html-to-text conversion is what we expect.
22 require_locale en_US.UTF-8 en_US.UTF8 en_US.utf-8 en_US.utf8
24 #### Disable colorized output.
25 TERM
=dumb
; export TERM
27 expected
="$MH_TEST_DIR/test-mhical$$.expected"
28 expected_err
="$MH_TEST_DIR/test-mhical$$.expected_err"
29 actual
="$MH_TEST_DIR/test-mhical$$.actual"
30 actual_err
="$MH_TEST_DIR/test-mhical$$.actual_err"
33 # check timezone boundary at transition from daylight saving time, -2SU
34 start_test
"timezone boundary at transition from daylight saving time, -2SU"
35 # Specifically looking at "second last Sunday of the month" type transitions.
36 cat >"$expected" <<'EOF'
38 At: Sat, 22 Oct 1994 23:33 +0000
39 To: Sun, 23 Oct 1994 07:34
42 cat >"$MH_TEST_DIR/test1.ics" <<'EOF'
50 DTSTART:19931018T020000
53 RRULE:FREQ=YEARLY;BYDAY=-2SU;BYMONTH=10
57 DTSTART:19810329T010000
60 RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=3
64 DTSTAMP:19941002T115852Z
65 DTSTART;TZID=London:19941022T233300
66 DTEND;TZID=London:19941023T073400
72 TZ
=GMT mhical
<"$MH_TEST_DIR/test1.ics" >"$MH_TEST_DIR/test1.txt"
73 check
"$expected" "$MH_TEST_DIR/test1.txt"
76 # check timezone boundary at transition to daylight saving time, -1SU
77 start_test
"timezone boundary at transition to daylight saving time, -1SU"
78 # Specifically looking at "last Sunday of the month" type transitions.
79 cat >"$expected" <<'EOF'
81 At: Sat, 27 Mar 1982 23:31 +0000
82 To: Sun, 28 Mar 1982 07:32
85 cat >"$MH_TEST_DIR/test1.ics" <<'EOF'
93 DTSTART:19781025T030000
96 RRULE:FREQ=YEARLY;UNTIL=19811025T010000Z;BYDAY=-1SU;BYMONTH=10
100 DTSTART:19810329T010000
103 RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=3
107 DTSTAMP:19820302T115852Z
108 DTSTART;TZID=London:19820327T233100
109 DTEND;TZID=London:19820328T073200
115 TZ
=GMT mhical
<"$MH_TEST_DIR/test1.ics" >"$MH_TEST_DIR/test1.txt"
116 check
"$expected" "$MH_TEST_DIR/test1.txt"
121 cat >"$expected" <<EOF
122 Usage: mhical [switches]
124 -reply accept|decline|tentative
138 #### Skip nmh intro text.
139 run_prog mhical
-help 2>&1 | sed '/^$/,$d' >"$actual"
140 check
"$expected" "$actual"
144 start_test
"-version"
145 case `mhical -version` in
147 *) printf '%s: mhical -version generated unexpected output\n' "$0" >&2
148 failed
=`expr ${failed:-0} + 1`;;
152 # check display with timezone that only has standard time
153 start_test
"display with timezone that only has standard time"
154 cat >"$expected" <<'EOF'
156 Description: See Santa here first!
157 At: Wed, 24 Dec 2014 12:00 +0000
158 To: Fri, 25 Dec 2015 11:59
161 cat >"$MH_TEST_DIR/test1.ics" <<'EOF'
169 DTSTART:16010101T020000
176 DTSTAMP:20141224T140426Z
177 DTSTART;TZID=MHT-12:20141225T000000
178 DTEND;TZID=MHT-12:20151225T235959
180 DESCRIPTION: See Santa here first!
186 TZ
=UTC mhical
<"$MH_TEST_DIR/test1.ics" >"$MH_TEST_DIR/test1.txt"
187 check
"$expected" "$MH_TEST_DIR/test1.txt"
190 # check display with 24 hour time format and -outfile
191 start_test
"display with 24 hour time format and -outfile"
192 cat >"$expected" <<'EOF'
193 Summary: 4 pm meeting
194 At: Mon, 05 Jan 2015 16:00
195 To: Mon, 05 Jan 2015 16:30
198 cat >"$MH_TEST_DIR/test1.ics" <<'EOF'
204 DTSTAMP:20150101T162400Z
205 DTSTART:20150105T160000
206 DTEND:20150105T163000
213 mhical
-outfile "$MH_TEST_DIR/test1.txt" <"$MH_TEST_DIR/test1.ics"
214 check
"$expected" "$MH_TEST_DIR/test1.txt"
217 # check display with 12 hour time format and -infile
218 start_test
"display with 12 hour time format and -infile"
219 cat >"$expected" <<'EOF'
220 Summary: 4 pm meeting
221 At: Mon, 05 Jan 2015 4:00 PM
222 To: Mon, 05 Jan 2015 4:30 PM
225 cat >"$MH_TEST_DIR/test1.ics" <<'EOF'
231 DTSTAMP:20150101T162800Z
232 DTSTART:20150105T160000
233 DTEND:20150105T163000
240 mhical
-form mhical
.12hour
-infile "$MH_TEST_DIR/test1.ics" \
241 >"$MH_TEST_DIR/test1.txt"
242 check
"$expected" "$MH_TEST_DIR/test1.txt"
245 # check display with DST
246 start_test
"display with DST"
247 cat >"$expected" <<'EOF'
252 At: Mon, 05 Jan 2015 08:00 -0500
253 To: Mon, 05 Jan 2015 09:00
257 cat >"$MH_TEST_DIR/test1.ics" <<'EOF'
260 PRODID:Microsoft Exchange Server 2010
263 TZID:Eastern Standard Time
265 DTSTART:16010101T020000
268 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=1SU;BYMONTH=11
271 DTSTART:16010101T020000
274 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=2SU;BYMONTH=3
278 ORGANIZER;CN=Requester:MAILTO:requester@example.com
279 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=FALSE;CN=Requestee
280 :MAILTO:requestee@example.com
281 DESCRIPTION;LANGUAGE=en-US:\n\n
282 SUMMARY;LANGUAGE=en-US:Big Meeting
283 DTSTART;TZID=Eastern Standard Time:20150105T080000
284 DTEND;TZID=Eastern Standard Time:20150105T090000
288 DTSTAMP:20141231T235959Z
292 LOCATION;LANGUAGE=en-US:The Office
293 X-MICROSOFT-CDO-APPT-SEQUENCE:0
294 X-MICROSOFT-CDO-OWNERAPPTID:-0123456789
295 X-MICROSOFT-CDO-BUSYSTATUS:TENTATIVE
296 X-MICROSOFT-CDO-INTENDEDSTATUS:BUSY
297 X-MICROSOFT-CDO-ALLDAYEVENT:FALSE
298 X-MICROSOFT-CDO-IMPORTANCE:1
299 X-MICROSOFT-CDO-INSTTYPE:0
300 X-MICROSOFT-DISALLOW-COUNTER:FALSE
304 TRIGGER;RELATED=START:-PT15M
310 TZ
=EST mhical
<"$MH_TEST_DIR/test1.ics" >"$MH_TEST_DIR/test1.txt"
311 check
"$expected" "$MH_TEST_DIR/test1.txt"
314 # check timezone boundary at transition to daylight saving time
315 start_test
"timezone boundary at transition to daylight saving time"
316 # The default mhical display format doesn't show the timezone for the
317 # To: time, but it is different than that of the At: time.
318 cat >"$expected" <<'EOF'
320 At: Sun, 09 Mar 2014 01:59 -0500
321 To: Sun, 09 Mar 2014 03:30
324 cat >"$MH_TEST_DIR/test1.ics" <<'EOF'
329 TZID:Eastern Standard Time
331 DTSTART:16010101T020000
334 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=1SU;BYMONTH=11
337 DTSTART:16010101T020000
340 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=2SU;BYMONTH=3
344 DTSTAMP:20150101T000000Z
345 DTSTART;TZID=Eastern Standard Time:20140309T015959
346 DTEND;TZID=Eastern Standard Time:20140309T023000
352 TZ
=EST5EDT mhical
<"$MH_TEST_DIR/test1.ics" >"$MH_TEST_DIR/test1.txt"
353 check
"$expected" "$MH_TEST_DIR/test1.txt"
356 # check -format, and that timezone is correct in end time
357 start_test
"-format, and that timezone is correct in end time"
358 cat >"$expected" <<'EOF'
359 Sun, 09 Mar 2014 03:30:00 -0400
362 TZ
=EST5EDT mhical
-format '%(pretty{dtend})' \
363 -infile "$MH_TEST_DIR/test1.ics" -outfile "$MH_TEST_DIR/test1.txt"
364 check
"$expected" "$MH_TEST_DIR/test1.txt"
367 # check timezone boundary at transition from daylight saving time
368 start_test
"timezone boundary at transition from daylight saving time"
369 cat >"$expected" <<'EOF'
371 At: Sun, 02 Nov 2014 01:59 -0400
372 To: Sun, 02 Nov 2014 02:00
375 cat >"$MH_TEST_DIR/test1.ics" <<'EOF'
380 TZID:Eastern Standard Time
382 DTSTART:16010101T020000
385 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=1SU;BYMONTH=11
388 DTSTART:16010101T020000
391 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=2SU;BYMONTH=3
395 DTSTAMP:20150101T000000Z
396 DTSTART;TZID=Eastern Standard Time:20141102T015959
397 DTEND;TZID=Eastern Standard Time:20141102T020000
403 TZ
=EST5EDT mhical
<"$MH_TEST_DIR/test1.ics" >"$MH_TEST_DIR/test1.txt"
404 check
"$expected" "$MH_TEST_DIR/test1.txt"
407 # check -format, and that timezone is correct in end time
408 start_test
"-format, and that timezone is correct in end time"
409 cat >"$expected" <<'EOF'
410 Sun, 02 Nov 2014 02:00:00 -0500
413 TZ
=EST5EDT mhical
-format '%(pretty{dtend})' \
414 -infile "$MH_TEST_DIR/test1.ics" -outfile "$MH_TEST_DIR/test1.txt"
415 check
"$expected" "$MH_TEST_DIR/test1.txt"
418 printf 'Local-Mailbox: Requestee2 <requestee2@example.com>\n' >> "$MH"
420 # check accept of request
421 start_test
"accept of request"
422 cat >"$expected" <<'EOF'
425 PRODID:nmh mhical v0.5
428 TZID:Eastern Standard Time
430 DTSTART:16010101T020000
433 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=1SU;BYMONTH=11
436 DTSTART:16010101T020000
439 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=2SU;BYMONTH=3
443 ORGANIZER;CN=Requester:MAILTO:requester@example.com
444 ATTENDEE;PARTSTAT=ACCEPTED;CN=Requestee2:MAILTO:requestee2@example.com
445 SUMMARY;LANGUAGE=en-US:Accepted: test request
446 DTSTART;TZID=Eastern Standard Time:20150105T090000
447 DTEND;TZID=Eastern Standard Time:20150105T093000
454 LOCATION;LANGUAGE=en-US:
459 cat >"$MH_TEST_DIR/test1.ics" <<'EOF'
465 TZID:Eastern Standard Time
467 DTSTART:16010101T020000
470 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=1SU;BYMONTH=11
473 DTSTART:16010101T020000
476 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=2SU;BYMONTH=3
480 ORGANIZER;CN=Requester:MAILTO:requester@example.com
481 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=Requestee1
482 :MAILTO:requestee1@example.com
483 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=Requestee2
484 :MAILTO:requestee2@example.com
485 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=Requestee3
486 :MAILTO:requestee3@example.com
487 SUMMARY;LANGUAGE=en-US:test request
488 DTSTART;TZID=Eastern Standard Time:20150105T090000
489 DTEND;TZID=Eastern Standard Time:20150105T093000
493 DTSTAMP:20150101T171600Z
497 LOCATION;LANGUAGE=en-US:
501 TRIGGER;RELATED=START:-PT15M
507 mhical
-reply accept
<"$MH_TEST_DIR/test1.ics" | egrep -v '^DTSTAMP:' \
508 >"$MH_TEST_DIR/test1.txt"
509 check
"$expected" "$MH_TEST_DIR/test1.txt"
512 # check accept of request with -attendee
513 start_test
"accept of request with -attendee"
514 cat >"$expected" <<'EOF'
517 PRODID:nmh mhical v0.5
520 TZID:Eastern Standard Time
522 DTSTART:16010101T020000
525 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=1SU;BYMONTH=11
528 DTSTART:16010101T020000
531 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=2SU;BYMONTH=3
535 ORGANIZER;CN=Requester:MAILTO:requester@example.com
536 ATTENDEE;PARTSTAT=ACCEPTED;CN=Requestee1:MAILTO:requestee1@example.com
537 SUMMARY;LANGUAGE=en-US:Accepted: test request
538 DTSTART;TZID=Eastern Standard Time:20150105T090000
539 DTEND;TZID=Eastern Standard Time:20150105T093000
546 LOCATION;LANGUAGE=en-US:
551 cp "$MH" "${MH}.save"
552 printf 'Alternate-Mailboxes: RequesteeToo <requestee1@example.com>\n' >> "$MH"
553 mhical
-reply accept
-attendee requestee1@example.com
<"$MH_TEST_DIR/test1.ics" \
554 | egrep -v '^DTSTAMP:' >"$MH_TEST_DIR/test1.txt"
555 check
"$expected" "$MH_TEST_DIR/test1.txt"
558 # check accept of request with other -attendee
559 start_test
"accept of request with other -attendee"
560 cat >"$expected" <<'EOF'
563 PRODID:nmh mhical v0.5
566 TZID:Eastern Standard Time
568 DTSTART:16010101T020000
571 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=1SU;BYMONTH=11
574 DTSTART:16010101T020000
577 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=2SU;BYMONTH=3
581 ORGANIZER;CN=Requester:MAILTO:requester@example.com
582 ATTENDEE;PARTSTAT=ACCEPTED;CN=Requestee2:MAILTO:requestee2@example.com
583 SUMMARY;LANGUAGE=en-US:Accepted: test request
584 DTSTART;TZID=Eastern Standard Time:20150105T090000
585 DTEND;TZID=Eastern Standard Time:20150105T093000
592 LOCATION;LANGUAGE=en-US:
597 mhical
-reply accept
-attendee requestee2@example.com
<"$MH_TEST_DIR/test1.ics" \
598 | egrep -v '^DTSTAMP:' >"$MH_TEST_DIR/test1.txt"
599 check
"$expected" "$MH_TEST_DIR/test1.txt"
602 # check accept of request without required -attendee
603 start_test
"accept of request without required -attendee"
604 cat >"$expected" <<'EOF'
605 mhical: Multiple attendees match your address, re-run with -attendee switch
608 mhical
-reply accept
<"$MH_TEST_DIR/test1.ics" 2>"$MH_TEST_DIR/test1.txt" \
610 check
"$expected" "$MH_TEST_DIR/test1.txt"
611 mv "${MH}.save" "$MH"
614 # check accept of multiple vevent requests in single vcalendar
615 start_test
"accept of multiple vevent requests in single vcalendar"
616 cat >"$expected" <<'EOF'
619 PRODID:nmh mhical v0.5
622 TZID:Eastern Standard Time
624 DTSTART:16010101T020000
627 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=1SU;BYMONTH=11
630 DTSTART:16010101T020000
633 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=2SU;BYMONTH=3
637 ORGANIZER;CN=Requester:MAILTO:requester@example.com
638 ATTENDEE;PARTSTAT=ACCEPTED;CN=Requestee2:MAILTO:requestee2@example.com
639 SUMMARY;LANGUAGE=en-US:Accepted: test request
640 DTSTART;TZID=Eastern Standard Time:20150105T090000
641 DTEND;TZID=Eastern Standard Time:20150105T093000
648 LOCATION;LANGUAGE=en-US:
652 ORGANIZER;CN=Requester:MAILTO:requester@example.com
653 ATTENDEE;PARTSTAT=ACCEPTED;CN=Requestee2:MAILTO:requestee2@example.com
654 SUMMARY;LANGUAGE=en-US:Accepted: test request
655 DTSTART;TZID=Eastern Standard Time:20150105T130000
656 DTEND;TZID=Eastern Standard Time:20150105T134500
663 LOCATION;LANGUAGE=en-US:
668 cat >"$MH_TEST_DIR/test1.ics" <<'EOF'
675 TZID:Eastern Standard Time
677 DTSTART:16010101T020000
680 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=1SU;BYMONTH=11
683 DTSTART:16010101T020000
686 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=2SU;BYMONTH=3
691 ORGANIZER;CN=Requester:MAILTO:requester@example.com
692 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=Requestee1
693 :MAILTO:requestee1@example.com
694 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=Requestee2
695 :MAILTO:requestee2@example.com
696 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=Requestee3
697 :MAILTO:requestee3@example.com
698 SUMMARY;LANGUAGE=en-US:test request
699 DTSTART;TZID=Eastern Standard Time:20150105T090000
700 DTEND;TZID=Eastern Standard Time:20150105T093000
704 DTSTAMP:20150101T171600Z
708 LOCATION;LANGUAGE=en-US:
712 TRIGGER;RELATED=START:-PT15M
717 ORGANIZER;CN=Requester:MAILTO:requester@example.com
718 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=Requestee2
719 :MAILTO:requestee2@example.com
720 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=Requestee3
721 :MAILTO:requestee3@example.com
722 SUMMARY;LANGUAGE=en-US:test request
723 DTSTART;TZID=Eastern Standard Time:20150105T130000
724 DTEND;TZID=Eastern Standard Time:20150105T134500
728 DTSTAMP:20150101T171600Z
732 LOCATION;LANGUAGE=en-US:
736 TRIGGER;RELATED=START:-PT15M
743 mhical
-reply accept
<"$MH_TEST_DIR/test1.ics" | egrep -v '^DTSTAMP:' \
744 >"$MH_TEST_DIR/test1.txt"
745 check
"$expected" "$MH_TEST_DIR/test1.txt"
748 # check decline of request
749 start_test
"decline of request"
750 cat >"$expected" <<'EOF'
753 PRODID:nmh mhical v0.5
756 ORGANIZER;CN=Requester:MAILTO:requester@example.com
757 ATTENDEE;PARTSTAT=DECLINED;CN=Requestee2:MAILTO:requestee2@example.com
758 SUMMARY;LANGUAGE=en-US:Declined: test request
759 DTSTART:20150105T090000
760 DTEND:20150105T093000
767 LOCATION;LANGUAGE=en-US:
772 cat >"$MH_TEST_DIR/test1.ics" <<'EOF'
778 ORGANIZER;CN=Requester:MAILTO:requester@example.com
779 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=Requestee1
780 :MAILTO:requestee1@example.com
781 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=Requestee2
782 :MAILTO:requestee2@example.com
783 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=Requestee3
784 :MAILTO:requestee3@example.com
785 SUMMARY;LANGUAGE=en-US:test request
786 DTSTART:20150105T090000
787 DTEND:20150105T093000
791 DTSTAMP:20150101T171600Z
795 LOCATION;LANGUAGE=en-US:
799 TRIGGER;RELATED=START:-PT15M
805 mhical
-reply decline
<"$MH_TEST_DIR/test1.ics" | egrep -v '^DTSTAMP:' \
806 >"$MH_TEST_DIR/test1.txt"
807 check
"$expected" "$MH_TEST_DIR/test1.txt"
810 # check response of tentative to request, and -nocontenttype
811 start_test
"response of tentative to request, and -nocontenttype"
812 cat >"$expected" <<'EOF'
815 PRODID:nmh mhical v0.5
818 ORGANIZER;CN=Requester:MAILTO:requester@example.com
819 ATTENDEE;PARTSTAT=TENTATIVE;CN=Requestee2:MAILTO:requestee2@example.com
820 SUMMARY;LANGUAGE=en-US:Tentative: test request
821 DTSTART:20150105T090000
822 DTEND:20150105T093000
829 LOCATION;LANGUAGE=en-US:
834 cat >"$MH_TEST_DIR/test1.ics" <<'EOF'
840 ORGANIZER;CN=Requester:MAILTO:requester@example.com
841 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=Requestee1
842 :MAILTO:requestee1@example.com
843 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=Requestee2
844 :MAILTO:requestee2@example.com
845 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=Requestee3
846 :MAILTO:requestee3@example.com
847 SUMMARY;LANGUAGE=en-US:test request
848 DTSTART:20150105T090000
849 DTEND:20150105T093000
853 DTSTAMP:20150101T171600Z
857 LOCATION;LANGUAGE=en-US:
861 TRIGGER;RELATED=START:-PT15M
867 mhical
-reply tentative
-contenttype -nocontenttype \
868 -infile "$MH_TEST_DIR/test1.ics" | egrep -v '^DTSTAMP:' \
869 >"$MH_TEST_DIR/test1.txt"
870 check
"$expected" "$MH_TEST_DIR/test1.txt"
873 # check cancel request, and -contenttype
874 start_test
"cancel request, and -contenttype"
875 cat >"$expected" <<'EOF'
876 Content-Type: text/calendar; method="CANCEL"; charset="UTF-8"
880 PRODID:nmh mhical v0.5
883 ORGANIZER;CN=Requestee2:MAILTO:requestee2@example.com
884 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=Requestee1
885 :MAILTO:requestee1@example.com
886 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=Requestee3
887 :MAILTO:requestee3@example.com
888 SUMMARY;LANGUAGE=en-US:Cancelled:test request
889 DTSTART:20150105T090000
890 DTEND:20150105T093000
897 LOCATION;LANGUAGE=en-US:
902 cat >"$MH_TEST_DIR/test1.ics" <<'EOF'
908 ORGANIZER;CN=Requestee2:MAILTO:requestee2@example.com
909 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=Requestee1
910 :MAILTO:requestee1@example.com
911 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=Requestee3
912 :MAILTO:requestee3@example.com
913 SUMMARY;LANGUAGE=en-US:test request
914 DTSTART:20150105T090000
915 DTEND:20150105T093000
919 DTSTAMP:20150101T171600Z
923 LOCATION;LANGUAGE=en-US:
927 TRIGGER;RELATED=START:-PT15M
933 mhical
-cancel -contenttype <"$MH_TEST_DIR/test1.ics" | egrep -v '^DTSTAMP:' \
934 >"$MH_TEST_DIR/test1.txt"
935 check
"$expected" "$MH_TEST_DIR/test1.txt"
938 # Check TZID name wrapped with quotes, this used to cause a segfault.
939 start_test
"TZID name wrapped with quotes, this used to cause a segfault."
940 cat >"$expected" <<'EOF'
942 Summary: Quoted timezone ID
943 At: Wed, 01 Jan 2014 00:00
944 To: Wed, 01 Jan 2014 01:00
947 cat >"$MH_TEST_DIR/test1.ics" <<'EOF'
949 PRODID:Zimbra-Calendar-Provider
952 SUMMARY:Quoted timezone ID
956 DTSTART:19710101T000000
963 DTSTART:20140101T000000
964 DTEND;TZID="Etc/GMT":20140101T010000
970 TZ
=UTC mhical
<"$MH_TEST_DIR/test1.ics" >"$MH_TEST_DIR/test1.txt"
971 check
"$expected" "$MH_TEST_DIR/test1.txt"
974 # Check start datetime without a time, and missing end datetime.
975 start_test
"start datetime without a time, and missing end datetime."
976 cat >"$expected" <<'EOF'
978 Summary: Test datetime without time
979 At: Wed, 30 Dec 2015 00:00
980 To: Wed, 30 Dec 2015 23:59
983 cat >"$MH_TEST_DIR/test1.ics" <<'EOF'
986 PRODID:icalendar-ruby
990 DTSTAMP:20151208T204350Z
992 DTSTART;VALUE=DATE:20151230
994 SUMMARY:Test datetime without time
998 TRIGGER;RELATED=START:-PT15M
1004 TZ
=UTC mhical
<"$MH_TEST_DIR/test1.ics" >"$MH_TEST_DIR/test1.txt"
1005 check
"$expected" "$MH_TEST_DIR/test1.txt"
1006 rm -f "$MH_TEST_DIR/test1.ics"
1009 # check missing final newline
1010 start_test
"missing final newline"
1012 cat >"$expected" <<'EOF'
1014 Description: this file does not end with a newline
1015 At: Sun, 14 May 2017 13:00 +0000
1016 To: Sun, 14 May 2017 14:00
1024 DTSTAMP:20170514T122300Z
1025 DTSTART:20170514T130000Z
1026 DTEND:20170514T140000Z
1028 DESCRIPTION:this file does not end with a newline
1030 END:VCALENDAR" | TZ
=UTC mhical
>"$actual"
1031 check
"$expected" "$actual"
1034 # check invalid line folding
1035 start_test
"invalid line folding"
1037 cat >"$expected" <<'EOF'
1039 Description: this file does not end with a newline
1040 At: Sun, 14 May 2017 13:00 +0000
1041 To: Sun, 14 May 2017 14:00
1044 cat >"$expected_err" <<'EOF'
1045 mhical: syntax error, unexpected ICAL_COMMA, expecting ICAL_COLON after " this line is not folded"
1052 PRODID:-//TDP v3.0//EN
1054 DTSTAMP:20170514T122300Z
1055 DTSTART:20170514T130000Z
1056 DTEND:20170514T140000Z
1058 DESCRIPTION:this file does not end with a newline
1059 and this line is not folded,
1061 END:VCALENDAR" | TZ
=UTC mhical
>"$actual" 2>"$actual_err"
1063 check
"$expected" "$actual"
1064 check
"$expected_err" "$actual_err"
1068 start_test
"null input"
1069 check_exit
'-eq 0' mhical
</dev
/null