diff options
| author | Ulf Jasper | 2012-06-08 19:34:09 +0200 |
|---|---|---|
| committer | Ulf Jasper | 2012-06-08 19:34:09 +0200 |
| commit | ee5747918fd72e3ced7bc59949d5e40c84144804 (patch) | |
| tree | d1b741e3b35901bed37462fb94e148787333ee9e | |
| parent | 4b56d0fe74527ddab5a976200b479376faa6b6f4 (diff) | |
| download | emacs-ee5747918fd72e3ced7bc59949d5e40c84144804.tar.gz emacs-ee5747918fd72e3ced7bc59949d5e40c84144804.zip | |
icalendar / icalendar-tests: Fix Bug#11473 -- unescape commas in timezone specs
2012-06-08 Nick Dokos <nicholas.dokos@hp.com>
* calendar/icalendar.el (icalendar--parse-vtimezone): Import TZID
string properly, fixes Bug#11473.
2012-06-08 Ulf Jasper <ulf.jasper@web.de>
* automated/icalendar-tests.el (icalendar--parse-vtimezone): Test
escaped commas in TZID (Bug#11473).
(icalendar-import-with-timezone): New.
(icalendar-real-world): Add new testcase as found in the bugreport
of Bug#11473.
| -rw-r--r-- | lisp/ChangeLog | 5 | ||||
| -rw-r--r-- | lisp/calendar/icalendar.el | 3 | ||||
| -rw-r--r-- | test/ChangeLog | 8 | ||||
| -rw-r--r-- | test/automated/icalendar-tests.el | 109 |
4 files changed, 121 insertions, 4 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 0a33046d6f2..2d6e99415a3 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2012-06-08 Nick Dokos <nicholas.dokos@hp.com> | ||
| 2 | |||
| 3 | * calendar/icalendar.el (icalendar--parse-vtimezone): Import TZID | ||
| 4 | string properly, fixes Bug#11473. | ||
| 5 | |||
| 1 | 2012-06-08 Chong Yidong <cyd@gnu.org> | 6 | 2012-06-08 Chong Yidong <cyd@gnu.org> |
| 2 | 7 | ||
| 3 | * faces.el (set-face-attribute): Doc fix. | 8 | * faces.el (set-face-attribute): Doc fix. |
diff --git a/lisp/calendar/icalendar.el b/lisp/calendar/icalendar.el index 5dc687d001b..7326aa530ad 100644 --- a/lisp/calendar/icalendar.el +++ b/lisp/calendar/icalendar.el | |||
| @@ -500,7 +500,8 @@ The strings are suitable for assembling into a TZ variable." | |||
| 500 | (defun icalendar--parse-vtimezone (alist) | 500 | (defun icalendar--parse-vtimezone (alist) |
| 501 | "Turn a VTIMEZONE ALIST into a cons (ID . TZ-STRING). | 501 | "Turn a VTIMEZONE ALIST into a cons (ID . TZ-STRING). |
| 502 | Return nil if timezone cannot be parsed." | 502 | Return nil if timezone cannot be parsed." |
| 503 | (let* ((tz-id (icalendar--get-event-property alist 'TZID)) | 503 | (let* ((tz-id (icalendar--convert-string-for-import |
| 504 | (icalendar--get-event-property alist 'TZID))) | ||
| 504 | (daylight (cadr (cdar (icalendar--get-children alist 'DAYLIGHT)))) | 505 | (daylight (cadr (cdar (icalendar--get-children alist 'DAYLIGHT)))) |
| 505 | (day (and daylight (icalendar--convert-tz-offset daylight t))) | 506 | (day (and daylight (icalendar--convert-tz-offset daylight t))) |
| 506 | (standard (cadr (cdar (icalendar--get-children alist 'STANDARD)))) | 507 | (standard (cadr (cdar (icalendar--get-children alist 'STANDARD)))) |
diff --git a/test/ChangeLog b/test/ChangeLog index f5fa81f4a5a..ddd26bf492a 100644 --- a/test/ChangeLog +++ b/test/ChangeLog | |||
| @@ -1,3 +1,11 @@ | |||
| 1 | 2012-06-08 Ulf Jasper <ulf.jasper@web.de> | ||
| 2 | |||
| 3 | * automated/icalendar-tests.el (icalendar--parse-vtimezone): Test | ||
| 4 | escaped commas in TZID (Bug#11473). | ||
| 5 | (icalendar-import-with-timezone): New. | ||
| 6 | (icalendar-real-world): Add new testcase as given in the bugreport | ||
| 7 | of Bug#11473. | ||
| 8 | |||
| 1 | 2012-05-29 Ulf Jasper <ulf.jasper@web.de> | 9 | 2012-05-29 Ulf Jasper <ulf.jasper@web.de> |
| 2 | 10 | ||
| 3 | * automated/icalendar-tests.el (icalendar-tests--test-import): | 11 | * automated/icalendar-tests.el (icalendar-tests--test-import): |
diff --git a/test/automated/icalendar-tests.el b/test/automated/icalendar-tests.el index dbf262d9f77..58b8379bb11 100644 --- a/test/automated/icalendar-tests.el +++ b/test/automated/icalendar-tests.el | |||
| @@ -188,7 +188,7 @@ END:VTIMEZONE | |||
| 188 | (should (string= "STD-02:00DST-03:00,M3.5.0/03:00:00,M10.5.0/04:00:00" | 188 | (should (string= "STD-02:00DST-03:00,M3.5.0/03:00:00,M10.5.0/04:00:00" |
| 189 | (cdr result))) | 189 | (cdr result))) |
| 190 | (setq vtimezone (icalendar-tests--get-ical-event "BEGIN:VTIMEZONE | 190 | (setq vtimezone (icalendar-tests--get-ical-event "BEGIN:VTIMEZONE |
| 191 | TZID:anothername | 191 | TZID:anothername\, with a comma |
| 192 | BEGIN:STANDARD | 192 | BEGIN:STANDARD |
| 193 | DTSTART:16010101T040000 | 193 | DTSTART:16010101T040000 |
| 194 | TZOFFSETFROM:+0300 | 194 | TZOFFSETFROM:+0300 |
| @@ -204,7 +204,7 @@ END:DAYLIGHT | |||
| 204 | END:VTIMEZONE | 204 | END:VTIMEZONE |
| 205 | ")) | 205 | ")) |
| 206 | (setq result (icalendar--parse-vtimezone vtimezone)) | 206 | (setq result (icalendar--parse-vtimezone vtimezone)) |
| 207 | (should (string= "anothername" (car result))) | 207 | (should (string= "anothername, with a comma" (car result))) |
| 208 | (message (cdr result)) | 208 | (message (cdr result)) |
| 209 | (should (string= "STD-02:00DST-03:00,M3.2.1/03:00:00,M10.2.1/04:00:00" | 209 | (should (string= "STD-02:00DST-03:00,M3.2.1/03:00:00,M10.2.1/04:00:00" |
| 210 | (cdr result))))) | 210 | (cdr result))))) |
| @@ -1103,6 +1103,44 @@ DTEND;VALUE=DATE-TIME:20030919T113000" | |||
| 1103 | "&19/9/2003 09:00-11:30 non-recurring\n UID: 1234567890uid\n" | 1103 | "&19/9/2003 09:00-11:30 non-recurring\n UID: 1234567890uid\n" |
| 1104 | "&9/19/2003 09:00-11:30 non-recurring\n UID: 1234567890uid\n")) | 1104 | "&9/19/2003 09:00-11:30 non-recurring\n UID: 1234567890uid\n")) |
| 1105 | 1105 | ||
| 1106 | (ert-deftest icalendar-import-with-timezone () | ||
| 1107 | ;; bug#11473 | ||
| 1108 | (icalendar-tests--test-import | ||
| 1109 | "BEGIN:VCALENDAR | ||
| 1110 | BEGIN:VTIMEZONE | ||
| 1111 | TZID:fictional\, nonexistent\, arbitrary | ||
| 1112 | BEGIN:STANDARD | ||
| 1113 | DTSTART:20100101T000000 | ||
| 1114 | TZOFFSETFROM:+0200 | ||
| 1115 | TZOFFSETTO:-0200 | ||
| 1116 | RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=1SU;BYMONTH=01 | ||
| 1117 | END:STANDARD | ||
| 1118 | BEGIN:DAYLIGHT | ||
| 1119 | DTSTART:20101201T000000 | ||
| 1120 | TZOFFSETFROM:-0200 | ||
| 1121 | TZOFFSETTO:+0200 | ||
| 1122 | RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=1SU;BYMONTH=11 | ||
| 1123 | END:DAYLIGHT | ||
| 1124 | END:VTIMEZONE | ||
| 1125 | BEGIN:VEVENT | ||
| 1126 | SUMMARY:standardtime | ||
| 1127 | DTSTART;TZID=\"fictional, nonexistent, arbitrary\":20120115T120000 | ||
| 1128 | DTEND;TZID=\"fictional, nonexistent, arbitrary\":20120115T123000 | ||
| 1129 | END:VEVENT | ||
| 1130 | BEGIN:VEVENT | ||
| 1131 | SUMMARY:daylightsavingtime | ||
| 1132 | DTSTART;TZID=\"fictional, nonexistent, arbitrary\":20121215T120000 | ||
| 1133 | DTEND;TZID=\"fictional, nonexistent, arbitrary\":20121215T123000 | ||
| 1134 | END:VEVENT | ||
| 1135 | END:VCALENDAR" | ||
| 1136 | ;; "standardtime" begins first sunday in january and is 4 hours behind CET | ||
| 1137 | ;; "daylightsavingtime" begins first sunday in november and is 1 hour before CET | ||
| 1138 | "&2012/1/15 15:00-15:30 standardtime | ||
| 1139 | &2012/12/15 11:00-11:30 daylightsavingtime | ||
| 1140 | " | ||
| 1141 | nil | ||
| 1142 | nil) | ||
| 1143 | ) | ||
| 1106 | ;; ====================================================================== | 1144 | ;; ====================================================================== |
| 1107 | ;; Cycle | 1145 | ;; Cycle |
| 1108 | ;; ====================================================================== | 1146 | ;; ====================================================================== |
| @@ -1863,7 +1901,72 @@ DTEND;VALUE=DATE:19001102 | |||
| 1863 | RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=11;BYMONTHDAY=1 | 1901 | RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=11;BYMONTHDAY=1 |
| 1864 | SUMMARY:NNN Wwwwwwww Wwwww - Aaaaaa Pppppppp rrrrrr ddd oo Nnnnnnnn 30 | 1902 | SUMMARY:NNN Wwwwwwww Wwwww - Aaaaaa Pppppppp rrrrrr ddd oo Nnnnnnnn 30 |
| 1865 | ") | 1903 | ") |
| 1866 | ) | 1904 | |
| 1905 | ;; bug#11473 | ||
| 1906 | (icalendar-tests--test-import | ||
| 1907 | "BEGIN:VCALENDAR | ||
| 1908 | METHOD:REQUEST | ||
| 1909 | PRODID:Microsoft Exchange Server 2007 | ||
| 1910 | VERSION:2.0 | ||
| 1911 | BEGIN:VTIMEZONE | ||
| 1912 | TZID:(UTC+01:00) Amsterdam\, Berlin\, Bern\, Rome\, Stockholm\, Vienna | ||
| 1913 | BEGIN:STANDARD | ||
| 1914 | DTSTART:16010101T030000 | ||
| 1915 | TZOFFSETFROM:+0200 | ||
| 1916 | TZOFFSETTO:+0100 | ||
| 1917 | RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=-1SU;BYMONTH=10 | ||
| 1918 | END:STANDARD | ||
| 1919 | BEGIN:DAYLIGHT | ||
| 1920 | DTSTART:16010101T020000 | ||
| 1921 | TZOFFSETFROM:+0100 | ||
| 1922 | TZOFFSETTO:+0200 | ||
| 1923 | RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=-1SU;BYMONTH=3 | ||
| 1924 | END:DAYLIGHT | ||
| 1925 | END:VTIMEZONE | ||
| 1926 | BEGIN:VEVENT | ||
| 1927 | ORGANIZER;CN=\"A. Luser\":MAILTO:a.luser@foo.com | ||
| 1928 | ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=\"Luser, Oth | ||
| 1929 | er\":MAILTO:other.luser@foo.com | ||
| 1930 | DESCRIPTION;LANGUAGE=en-US:\nWhassup?\n\n | ||
| 1931 | SUMMARY;LANGUAGE=en-US:Query | ||
| 1932 | DTSTART;TZID=\"(UTC+01:00) Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna\" | ||
| 1933 | :20120515T150000 | ||
| 1934 | DTEND;TZID=\"(UTC+01:00) Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna\":2 | ||
| 1935 | 0120515T153000 | ||
| 1936 | UID:040000008200E00074C5B7101A82E0080000000020FFAED0CFEFCC01000000000000000 | ||
| 1937 | 010000000575268034ECDB649A15349B1BF240F15 | ||
| 1938 | RECURRENCE-ID;TZID=\"(UTC+01:00) Amsterdam, Berlin, Bern, Rome, Stockholm, V | ||
| 1939 | ienna\":20120515T170000 | ||
| 1940 | CLASS:PUBLIC | ||
| 1941 | PRIORITY:5 | ||
| 1942 | DTSTAMP:20120514T153645Z | ||
| 1943 | TRANSP:OPAQUE | ||
| 1944 | STATUS:CONFIRMED | ||
| 1945 | SEQUENCE:15 | ||
| 1946 | LOCATION;LANGUAGE=en-US:phone | ||
| 1947 | X-MICROSOFT-CDO-APPT-SEQUENCE:15 | ||
| 1948 | X-MICROSOFT-CDO-OWNERAPPTID:1907632092 | ||
| 1949 | X-MICROSOFT-CDO-BUSYSTATUS:TENTATIVE | ||
| 1950 | X-MICROSOFT-CDO-INTENDEDSTATUS:BUSY | ||
| 1951 | X-MICROSOFT-CDO-ALLDAYEVENT:FALSE | ||
| 1952 | X-MICROSOFT-CDO-IMPORTANCE:1 | ||
| 1953 | X-MICROSOFT-CDO-INSTTYPE:3 | ||
| 1954 | BEGIN:VALARM | ||
| 1955 | ACTION:DISPLAY | ||
| 1956 | DESCRIPTION:REMINDER | ||
| 1957 | TRIGGER;RELATED=START:-PT15M | ||
| 1958 | END:VALARM | ||
| 1959 | END:VEVENT | ||
| 1960 | END:VCALENDAR" | ||
| 1961 | nil | ||
| 1962 | "&15/5/2012 15:00-15:30 Query | ||
| 1963 | Location: phone | ||
| 1964 | Organizer: MAILTO:a.luser@foo.com | ||
| 1965 | Status: CONFIRMED | ||
| 1966 | Class: PUBLIC | ||
| 1967 | UID: 040000008200E00074C5B7101A82E0080000000020FFAED0CFEFCC01000000000000000010000000575268034ECDB649A15349B1BF240F15 | ||
| 1968 | " nil) | ||
| 1969 | ) | ||
| 1867 | 1970 | ||
| 1868 | (provide 'icalendar-tests) | 1971 | (provide 'icalendar-tests) |
| 1869 | ;;; icalendar-tests.el ends here | 1972 | ;;; icalendar-tests.el ends here |