diff options
| author | Eli Zaretskii | 2010-02-20 05:25:57 -0500 |
|---|---|---|
| committer | Eli Zaretskii | 2010-02-20 05:25:57 -0500 |
| commit | d77fbdad04a1e3f8e4fa1038508379a5f5b8e67e (patch) | |
| tree | d20e47abe63806acbc519454e597ab7dc6ced017 /test | |
| parent | ae9784892b7c9005b792b026d466af105bcb655f (diff) | |
| parent | 0f00e9485d96c308b126553bd1b90ce4e64f1a1d (diff) | |
| download | emacs-d77fbdad04a1e3f8e4fa1038508379a5f5b8e67e.tar.gz emacs-d77fbdad04a1e3f8e4fa1038508379a5f5b8e67e.zip | |
Merge from mainline.
Diffstat (limited to 'test')
| -rw-r--r-- | test/ChangeLog | 13 | ||||
| -rw-r--r-- | test/icalendar-testsuite.el | 112 |
2 files changed, 125 insertions, 0 deletions
diff --git a/test/ChangeLog b/test/ChangeLog index e17adc0bfc7..85d9d813c5c 100644 --- a/test/ChangeLog +++ b/test/ChangeLog | |||
| @@ -1,3 +1,16 @@ | |||
| 1 | 2010-02-19 Ulf Jasper <ulf.jasper@web.de> | ||
| 2 | |||
| 3 | * icalendar-testsuite.el | ||
| 4 | (icalendar-testsuite--run-function-tests): Added new tests. | ||
| 5 | (icalendar-testsuite--test-diarytime-to-isotime): Added another | ||
| 6 | testcase. | ||
| 7 | (icalendar-testsuite--test-convert-ordinary-to-ical): New. | ||
| 8 | (icalendar-testsuite--test-convert-weekly-to-ical): New. | ||
| 9 | (icalendar-testsuite--test-convert-yearly-to-ical): New. | ||
| 10 | (icalendar-testsuite--test-convert-block-to-ical): New. | ||
| 11 | (icalendar-testsuite--test-convert-cyclic-to-ical): New. | ||
| 12 | (icalendar-testsuite--test-convert-anniversary-to-ical): New. | ||
| 13 | |||
| 1 | 2010-01-18 Juanma Barranquero <lekktu@gmail.com> | 14 | 2010-01-18 Juanma Barranquero <lekktu@gmail.com> |
| 2 | 15 | ||
| 3 | * cedet/semantic-tests.el (semanticdb-test-gnu-global) | 16 | * cedet/semantic-tests.el (semanticdb-test-gnu-global) |
diff --git a/test/icalendar-testsuite.el b/test/icalendar-testsuite.el index 0b48376c324..012f586c342 100644 --- a/test/icalendar-testsuite.el +++ b/test/icalendar-testsuite.el | |||
| @@ -52,6 +52,12 @@ | |||
| 52 | (icalendar-testsuite--test-datestring-to-isodate) | 52 | (icalendar-testsuite--test-datestring-to-isodate) |
| 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-convert-ordinary-to-ical) | ||
| 56 | (icalendar-testsuite--test-convert-weekly-to-ical) | ||
| 57 | (icalendar-testsuite--test-convert-yearly-to-ical) | ||
| 58 | (icalendar-testsuite--test-convert-block-to-ical) | ||
| 59 | (icalendar-testsuite--test-convert-cyclic-to-ical) | ||
| 60 | (icalendar-testsuite--test-convert-anniversary-to-ical) | ||
| 55 | (icalendar-testsuite--test-calendar-style) | 61 | (icalendar-testsuite--test-calendar-style) |
| 56 | (icalendar-testsuite--test-create-uid) | 62 | (icalendar-testsuite--test-create-uid) |
| 57 | (icalendar-testsuite--test-parse-vtimezone)) | 63 | (icalendar-testsuite--test-parse-vtimezone)) |
| @@ -213,6 +219,12 @@ END:VEVENT | |||
| 213 | 219 | ||
| 214 | (defun icalendar-testsuite--test-diarytime-to-isotime () | 220 | (defun icalendar-testsuite--test-diarytime-to-isotime () |
| 215 | "Test method for `icalendar--diarytime-to-isotime'." | 221 | "Test method for `icalendar--diarytime-to-isotime'." |
| 222 | (assert (string= (icalendar--diarytime-to-isotime "01:15" "") | ||
| 223 | "T011500")) | ||
| 224 | (assert (string= (icalendar--diarytime-to-isotime "1:15" "") | ||
| 225 | "T011500")) | ||
| 226 | (assert (string= (icalendar--diarytime-to-isotime "0:01" "") | ||
| 227 | "T000100")) | ||
| 216 | (assert (string= (icalendar--diarytime-to-isotime "0100" "") | 228 | (assert (string= (icalendar--diarytime-to-isotime "0100" "") |
| 217 | "T010000")) | 229 | "T010000")) |
| 218 | (assert (string= (icalendar--diarytime-to-isotime "0100" "am") | 230 | (assert (string= (icalendar--diarytime-to-isotime "0100" "am") |
| @@ -236,6 +248,106 @@ END:VEVENT | |||
| 236 | (assert (string= (icalendar--diarytime-to-isotime "1259" "pm") | 248 | (assert (string= (icalendar--diarytime-to-isotime "1259" "pm") |
| 237 | "T125900"))) | 249 | "T125900"))) |
| 238 | 250 | ||
| 251 | (defun icalendar-testsuite--test-convert-ordinary-to-ical () | ||
| 252 | "Test method for `icalendar--convert-ordinary-to-ical'." | ||
| 253 | (let* ((calendar-date-style 'iso) | ||
| 254 | result) | ||
| 255 | ;; without time | ||
| 256 | (setq result (icalendar--convert-ordinary-to-ical "&?" "2010 2 15 subject")) | ||
| 257 | (assert (= 2 (length result))) | ||
| 258 | (assert (string= "\nDTSTART;VALUE=DATE:20100215\nDTEND;VALUE=DATE:20100216" | ||
| 259 | (car result))) | ||
| 260 | (assert (string= "subject" (cadr result))) | ||
| 261 | |||
| 262 | ;; with time | ||
| 263 | (setq result (icalendar--convert-ordinary-to-ical | ||
| 264 | "&?" "&2010 2 15 12:34-23:45 s")) | ||
| 265 | (assert (= 2 (length result))) | ||
| 266 | (assert (string= (concat "\nDTSTART;VALUE=DATE-TIME:20100215T123400" | ||
| 267 | "\nDTEND;VALUE=DATE-TIME:20100215T234500") | ||
| 268 | (car result))) | ||
| 269 | (assert (string= "s" (cadr result))) | ||
| 270 | |||
| 271 | ;; with time, again -- test bug#5549 | ||
| 272 | (setq result (icalendar--convert-ordinary-to-ical | ||
| 273 | "x?" "x2010 2 15 0:34-1:45 s")) | ||
| 274 | (assert (= 2 (length result))) | ||
| 275 | (assert (string= (concat "\nDTSTART;VALUE=DATE-TIME:20100215T003400" | ||
| 276 | "\nDTEND;VALUE=DATE-TIME:20100215T014500") | ||
| 277 | (car result))) | ||
| 278 | (assert (string= "s" (cadr result))))) | ||
| 279 | |||
| 280 | (defun icalendar-testsuite--test-convert-weekly-to-ical () | ||
| 281 | "Test method for `icalendar--convert-weekly-to-ical'." | ||
| 282 | (let* ((calendar-date-style 'iso) | ||
| 283 | result | ||
| 284 | (calendar-day-name-array | ||
| 285 | ["Sunday" "Monday" "Tuesday" "Wednesday" "Thursday" "Friday" | ||
| 286 | "Saturday"])) | ||
| 287 | (setq result (icalendar--convert-weekly-to-ical "" "Monday 8:30 subject")) | ||
| 288 | (assert (= 2 (length result))) | ||
| 289 | (assert (string= (concat "\nDTSTART;VALUE=DATE-TIME:20050103T083000" | ||
| 290 | "\nDTEND;VALUE=DATE-TIME:20050103T093000" | ||
| 291 | "\nRRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=MO") | ||
| 292 | (car result))) | ||
| 293 | (assert (string= "subject" (cadr result))))) | ||
| 294 | |||
| 295 | (defun icalendar-testsuite--test-convert-yearly-to-ical () | ||
| 296 | "Test method for `icalendar--convert-yearly-to-ical'." | ||
| 297 | (let* ((calendar-date-style 'iso) | ||
| 298 | result | ||
| 299 | (calendar-month-name-array | ||
| 300 | ["January" "February" "March" "April" "May" "June" "July" "August" | ||
| 301 | "September" "October" "November" "December"])) | ||
| 302 | (setq result (icalendar--convert-yearly-to-ical "" "May 1 Tag der Arbeit")) | ||
| 303 | (assert (= 2 (length result))) | ||
| 304 | (assert (string= (concat | ||
| 305 | "\nDTSTART;VALUE=DATE:19000501" | ||
| 306 | "\nDTEND;VALUE=DATE:19000502" | ||
| 307 | "\nRRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=5;BYMONTHDAY=1") | ||
| 308 | (car result))) | ||
| 309 | (assert (string= "Tag der Arbeit" (cadr result))))) | ||
| 310 | |||
| 311 | (defun icalendar-testsuite--test-convert-block-to-ical () | ||
| 312 | "Test method for `icalendar--convert-block-to-ical'." | ||
| 313 | (let* ((calendar-date-style 'iso) | ||
| 314 | result) | ||
| 315 | (setq result (icalendar--convert-block-to-ical | ||
| 316 | "" "%%(diary-block 2004 7 19 2004 8 27) Sommerferien")) | ||
| 317 | (assert (= 2 (length result))) | ||
| 318 | (assert (string= (concat | ||
| 319 | "\nDTSTART;VALUE=DATE:20040719" | ||
| 320 | "\nDTEND;VALUE=DATE:20040828") | ||
| 321 | (car result))) | ||
| 322 | (assert (string= "Sommerferien" (cadr result))))) | ||
| 323 | |||
| 324 | (defun icalendar-testsuite--test-convert-cyclic-to-ical () | ||
| 325 | "Test method for `icalendar--convert-cyclic-to-ical'." | ||
| 326 | (let* ((calendar-date-style 'iso) | ||
| 327 | result) | ||
| 328 | (setq result (icalendar--convert-block-to-ical | ||
| 329 | "" "%%(diary-block 2004 7 19 2004 8 27) Sommerferien")) | ||
| 330 | (assert (= 2 (length result))) | ||
| 331 | (assert (string= (concat | ||
| 332 | "\nDTSTART;VALUE=DATE:20040719" | ||
| 333 | "\nDTEND;VALUE=DATE:20040828") | ||
| 334 | (car result))) | ||
| 335 | (assert (string= "Sommerferien" (cadr result))))) | ||
| 336 | |||
| 337 | (defun icalendar-testsuite--test-convert-anniversary-to-ical () | ||
| 338 | "Test method for `icalendar--convert-anniversary-to-ical'." | ||
| 339 | (let* ((calendar-date-style 'iso) | ||
| 340 | result) | ||
| 341 | (setq result (icalendar--convert-anniversary-to-ical | ||
| 342 | "" "%%(diary-anniversary 1964 6 30) g")) | ||
| 343 | (assert (= 2 (length result))) | ||
| 344 | (assert (string= (concat | ||
| 345 | "\nDTSTART;VALUE=DATE:19640630" | ||
| 346 | "\nDTEND;VALUE=DATE:19640701" | ||
| 347 | "\nRRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=06;BYMONTHDAY=30") | ||
| 348 | (car result))) | ||
| 349 | (assert (string= "g" (cadr result))))) | ||
| 350 | |||
| 239 | (defun icalendar-testsuite--test-calendar-style () | 351 | (defun icalendar-testsuite--test-calendar-style () |
| 240 | "Test method for `icalendar--date-style'." | 352 | "Test method for `icalendar--date-style'." |
| 241 | (dolist (calendar-date-style '(iso american european)) | 353 | (dolist (calendar-date-style '(iso american european)) |