diff options
| author | Ulf Jasper | 2009-12-18 19:35:14 +0000 |
|---|---|---|
| committer | Ulf Jasper | 2009-12-18 19:35:14 +0000 |
| commit | 6fe539d246f75dbba74b95a5ace37ea8ce91e3dd (patch) | |
| tree | 1d20a43661890f4c771748b88e7e47bcb4f5f5a8 /test | |
| parent | 83828b06e39f2d3586fbca04b4f3335a442a2f9b (diff) | |
| download | emacs-6fe539d246f75dbba74b95a5ace37ea8ce91e3dd.tar.gz emacs-6fe539d246f75dbba74b95a5ace37ea8ce91e3dd.zip | |
Fixed timezone handling problem in icalendar.el.
Diffstat (limited to 'test')
| -rw-r--r-- | test/ChangeLog | 12 | ||||
| -rw-r--r-- | test/icalendar-testsuite.el | 90 |
2 files changed, 82 insertions, 20 deletions
diff --git a/test/ChangeLog b/test/ChangeLog index a5dc9b86e79..4eefb50b95b 100644 --- a/test/ChangeLog +++ b/test/ChangeLog | |||
| @@ -1,3 +1,15 @@ | |||
| 1 | 2009-12-18 Ulf Jasper <ulf.jasper@web.de> | ||
| 2 | |||
| 3 | * icalendar-testsuite.el | ||
| 4 | (icalendar-testsuite--run-function-tests): Added | ||
| 5 | icalendar-testsuite--test-parse-vtimezone. | ||
| 6 | (icalendar-testsuite--test-parse-vtimezone): New. | ||
| 7 | (icalendar-testsuite--do-test-cycle): Doc changes. | ||
| 8 | (icalendar-testsuite--run-real-world-tests): Removed trailing | ||
| 9 | whitespace -- see change of icalendar--add-diary-entry in | ||
| 10 | icalendar.el. | ||
| 11 | (icalendar-testsuite--run-cycle-tests): Re-enabled all tests. | ||
| 12 | |||
| 1 | 2009-09-30 Glenn Morris <rgm@gnu.org> | 13 | 2009-09-30 Glenn Morris <rgm@gnu.org> |
| 2 | 14 | ||
| 3 | * cedet/semantic-utest-c.el: Relicense under GPLv3+. | 15 | * cedet/semantic-utest-c.el: Relicense under GPLv3+. |
diff --git a/test/icalendar-testsuite.el b/test/icalendar-testsuite.el index e926eabce24..fa361c26da0 100644 --- a/test/icalendar-testsuite.el +++ b/test/icalendar-testsuite.el | |||
| @@ -53,7 +53,8 @@ | |||
| 53 | (icalendar-testsuite--test-datetime-to-diary-date) | 53 | (icalendar-testsuite--test-datetime-to-diary-date) |
| 54 | (icalendar-testsuite--test-diarytime-to-isotime) | 54 | (icalendar-testsuite--test-diarytime-to-isotime) |
| 55 | (icalendar-testsuite--test-calendar-style) | 55 | (icalendar-testsuite--test-calendar-style) |
| 56 | (icalendar-testsuite--test-create-uid)) | 56 | (icalendar-testsuite--test-create-uid) |
| 57 | (icalendar-testsuite--test-parse-vtimezone)) | ||
| 57 | 58 | ||
| 58 | (defun icalendar-testsuite--test-format-ical-event () | 59 | (defun icalendar-testsuite--test-format-ical-event () |
| 59 | "Test `icalendar--format-ical-event'." | 60 | "Test `icalendar--format-ical-event'." |
| @@ -272,6 +273,48 @@ END:VEVENT | |||
| 272 | (icalendar--create-uid entry-full contents))) | 273 | (icalendar--create-uid entry-full contents))) |
| 273 | )) | 274 | )) |
| 274 | 275 | ||
| 276 | (defun icalendar-testsuite--test-parse-vtimezone () | ||
| 277 | (let (vtimezone result) | ||
| 278 | (setq vtimezone (icalendar-testsuite--get-ical-event "BEGIN:VTIMEZONE | ||
| 279 | TZID:thename | ||
| 280 | BEGIN:STANDARD | ||
| 281 | DTSTART:16010101T040000 | ||
| 282 | TZOFFSETFROM:+0300 | ||
| 283 | TZOFFSETTO:+0200 | ||
| 284 | RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=-1SU;BYMONTH=10 | ||
| 285 | END:STANDARD | ||
| 286 | BEGIN:DAYLIGHT | ||
| 287 | DTSTART:16010101T030000 | ||
| 288 | TZOFFSETFROM:+0200 | ||
| 289 | TZOFFSETTO:+0300 | ||
| 290 | RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=-1SU;BYMONTH=3 | ||
| 291 | END:DAYLIGHT | ||
| 292 | END:VTIMEZONE | ||
| 293 | ")) | ||
| 294 | (setq result (icalendar--parse-vtimezone vtimezone)) | ||
| 295 | (assert (string= "thename" (car result))) | ||
| 296 | (message (cdr result)) | ||
| 297 | (assert (string= "STD-02:00DST-03:00,M3.5.0/03:00:00,M10.5.0/04:00:00" (cdr result))) | ||
| 298 | (setq vtimezone (icalendar-testsuite--get-ical-event "BEGIN:VTIMEZONE | ||
| 299 | TZID:anothername | ||
| 300 | BEGIN:STANDARD | ||
| 301 | DTSTART:16010101T040000 | ||
| 302 | TZOFFSETFROM:+0300 | ||
| 303 | TZOFFSETTO:+0200 | ||
| 304 | RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=2MO;BYMONTH=10 | ||
| 305 | END:STANDARD | ||
| 306 | BEGIN:DAYLIGHT | ||
| 307 | DTSTART:16010101T030000 | ||
| 308 | TZOFFSETFROM:+0200 | ||
| 309 | TZOFFSETTO:+0300 | ||
| 310 | RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=2MO;BYMONTH=3 | ||
| 311 | END:DAYLIGHT | ||
| 312 | END:VTIMEZONE | ||
| 313 | ")) | ||
| 314 | (setq result (icalendar--parse-vtimezone vtimezone)) | ||
| 315 | (assert (string= "anothername" (car result))) | ||
| 316 | (message (cdr result)) | ||
| 317 | (assert (string= "STD-02:00DST-03:00,M3.2.1/03:00:00,M10.2.1/04:00:00" (cdr result))))) | ||
| 275 | 318 | ||
| 276 | ;; ====================================================================== | 319 | ;; ====================================================================== |
| 277 | ;; Test methods for exporting from diary to icalendar | 320 | ;; Test methods for exporting from diary to icalendar |
| @@ -455,10 +498,16 @@ Argument INPUT icalendar event string." | |||
| 455 | (let ((temp-diary (make-temp-file "icalendar-test-diary")) | 498 | (let ((temp-diary (make-temp-file "icalendar-test-diary")) |
| 456 | (temp-ics (make-temp-file "icalendar-test-ics")) | 499 | (temp-ics (make-temp-file "icalendar-test-ics")) |
| 457 | (org-input (buffer-substring-no-properties (point-min) (point-max)))) | 500 | (org-input (buffer-substring-no-properties (point-min) (point-max)))) |
| 501 | |||
| 502 | ;; step 1: import | ||
| 458 | (icalendar-import-buffer temp-diary t t) | 503 | (icalendar-import-buffer temp-diary t t) |
| 504 | |||
| 505 | ;; step 2: export what was just imported | ||
| 459 | (save-excursion | 506 | (save-excursion |
| 460 | (find-file temp-diary) | 507 | (find-file temp-diary) |
| 461 | (icalendar-export-region (point-min) (point-max) temp-ics)) | 508 | (icalendar-export-region (point-min) (point-max) temp-ics)) |
| 509 | |||
| 510 | ;; compare the output of step 2 with the input of step 1 | ||
| 462 | (save-excursion | 511 | (save-excursion |
| 463 | (find-file temp-ics) | 512 | (find-file temp-ics) |
| 464 | (goto-char (point-min)) | 513 | (goto-char (point-min)) |
| @@ -468,6 +517,8 @@ Argument INPUT icalendar event string." | |||
| 468 | (unless (string-equal org-input cycled) | 517 | (unless (string-equal org-input cycled) |
| 469 | (error "Import test failed! Found `%s'\nbut expected `%s'" cycled | 518 | (error "Import test failed! Found `%s'\nbut expected `%s'" cycled |
| 470 | org-input)))) | 519 | org-input)))) |
| 520 | |||
| 521 | ;; clean up -- Note this is done only if test is passed | ||
| 471 | (kill-buffer (find-buffer-visiting temp-diary)) | 522 | (kill-buffer (find-buffer-visiting temp-diary)) |
| 472 | (save-excursion | 523 | (save-excursion |
| 473 | (set-buffer (find-buffer-visiting temp-ics)) | 524 | (set-buffer (find-buffer-visiting temp-ics)) |
| @@ -1410,42 +1461,42 @@ END:VCALENDAR | |||
| 1410 | nil | 1461 | nil |
| 1411 | "&23/11/2004 14:00-14:30 Jjjjj & Wwwww | 1462 | "&23/11/2004 14:00-14:30 Jjjjj & Wwwww |
| 1412 | Status: TENTATIVE | 1463 | Status: TENTATIVE |
| 1413 | Class: PRIVATE | 1464 | Class: PRIVATE |
| 1414 | &23/11/2004 14:45-15:45 BB Aaaaaaaa Bbbbb | 1465 | &23/11/2004 14:45-15:45 BB Aaaaaaaa Bbbbb |
| 1415 | Status: TENTATIVE | 1466 | Status: TENTATIVE |
| 1416 | Class: PRIVATE | 1467 | Class: PRIVATE |
| 1417 | &23/11/2004 11:00-12:00 Hhhhhhhh | 1468 | &23/11/2004 11:00-12:00 Hhhhhhhh |
| 1418 | Status: TENTATIVE | 1469 | Status: TENTATIVE |
| 1419 | Class: PRIVATE | 1470 | Class: PRIVATE |
| 1420 | &%%(and (diary-cyclic 14 12 11 2004)) 14:00-18:30 MMM Aaaaaaaaa | 1471 | &%%(and (diary-cyclic 14 12 11 2004)) 14:00-18:30 MMM Aaaaaaaaa |
| 1421 | Status: TENTATIVE | 1472 | Status: TENTATIVE |
| 1422 | Class: PRIVATE | 1473 | Class: PRIVATE |
| 1423 | &%%(and (diary-block 19 11 2004 19 11 2004)) Rrrr/Cccccc ii Aaaaaaaa | 1474 | &%%(and (diary-block 19 11 2004 19 11 2004)) Rrrr/Cccccc ii Aaaaaaaa |
| 1424 | Desc: Vvvvv Rrrr aaa Cccccc | 1475 | Desc: Vvvvv Rrrr aaa Cccccc |
| 1425 | Status: TENTATIVE | 1476 | Status: TENTATIVE |
| 1426 | Class: PRIVATE | 1477 | Class: PRIVATE |
| 1427 | &%%(and (diary-cyclic 7 1 11 2004)) Wwww aa hhhh | 1478 | &%%(and (diary-cyclic 7 1 11 2004)) Wwww aa hhhh |
| 1428 | Status: TENTATIVE | 1479 | Status: TENTATIVE |
| 1429 | Class: PRIVATE " | 1480 | Class: PRIVATE" |
| 1430 | "&11/23/2004 14:00-14:30 Jjjjj & Wwwww | 1481 | "&11/23/2004 14:00-14:30 Jjjjj & Wwwww |
| 1431 | Status: TENTATIVE | 1482 | Status: TENTATIVE |
| 1432 | Class: PRIVATE | 1483 | Class: PRIVATE |
| 1433 | &11/23/2004 14:45-15:45 BB Aaaaaaaa Bbbbb | 1484 | &11/23/2004 14:45-15:45 BB Aaaaaaaa Bbbbb |
| 1434 | Status: TENTATIVE | 1485 | Status: TENTATIVE |
| 1435 | Class: PRIVATE | 1486 | Class: PRIVATE |
| 1436 | &11/23/2004 11:00-12:00 Hhhhhhhh | 1487 | &11/23/2004 11:00-12:00 Hhhhhhhh |
| 1437 | Status: TENTATIVE | 1488 | Status: TENTATIVE |
| 1438 | Class: PRIVATE | 1489 | Class: PRIVATE |
| 1439 | &%%(and (diary-cyclic 14 11 12 2004)) 14:00-18:30 MMM Aaaaaaaaa | 1490 | &%%(and (diary-cyclic 14 11 12 2004)) 14:00-18:30 MMM Aaaaaaaaa |
| 1440 | Status: TENTATIVE | 1491 | Status: TENTATIVE |
| 1441 | Class: PRIVATE | 1492 | Class: PRIVATE |
| 1442 | &%%(and (diary-block 11 19 2004 11 19 2004)) Rrrr/Cccccc ii Aaaaaaaa | 1493 | &%%(and (diary-block 11 19 2004 11 19 2004)) Rrrr/Cccccc ii Aaaaaaaa |
| 1443 | Desc: Vvvvv Rrrr aaa Cccccc | 1494 | Desc: Vvvvv Rrrr aaa Cccccc |
| 1444 | Status: TENTATIVE | 1495 | Status: TENTATIVE |
| 1445 | Class: PRIVATE | 1496 | Class: PRIVATE |
| 1446 | &%%(and (diary-cyclic 7 11 1 2004)) Wwww aa hhhh | 1497 | &%%(and (diary-cyclic 7 11 1 2004)) Wwww aa hhhh |
| 1447 | Status: TENTATIVE | 1498 | Status: TENTATIVE |
| 1448 | Class: PRIVATE ") | 1499 | Class: PRIVATE") |
| 1449 | 1500 | ||
| 1450 | ;; 2004-09-09 pg | 1501 | ;; 2004-09-09 pg |
| 1451 | (icalendar-testsuite--test-export | 1502 | (icalendar-testsuite--test-export |
| @@ -1555,13 +1606,12 @@ LOCATION:nowhere | |||
| 1555 | ORGANIZER:ulf | 1606 | ORGANIZER:ulf |
| 1556 | ") | 1607 | ") |
| 1557 | 1608 | ||
| 1558 | ;; FIXME: does not work | 1609 | (icalendar-testsuite--test-cycle |
| 1559 | ;; (icalendar-testsuite--test-cycle | 1610 | "DTSTART;VALUE=DATE:19190909 |
| 1560 | ;; "DTSTART;VALUE=DATE:19190909 | 1611 | DTEND;VALUE=DATE:19190910 |
| 1561 | ;;DTEND;VALUE=DATE:19190910 | 1612 | RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=09;BYMONTHDAY=09 |
| 1562 | ;;RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=09;BYMONTHDAY=09 | 1613 | SUMMARY:and diary-anniversary |
| 1563 | ;;SUMMARY:and diary-anniversary | 1614 | ") |
| 1564 | ;;") | ||
| 1565 | ) | 1615 | ) |
| 1566 | 1616 | ||
| 1567 | 1617 | ||