icalendar-tests.el 58 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838
  1. ;; icalendar-tests.el --- Test suite for icalendar.el
  2. ;; Copyright (C) 2005, 2008-2012 Free Software Foundation, Inc.
  3. ;; Author: Ulf Jasper <ulf.jasper@web.de>
  4. ;; Created: March 2005
  5. ;; Keywords: calendar
  6. ;; Human-Keywords: calendar, diary, iCalendar, vCalendar
  7. ;; This file is part of GNU Emacs.
  8. ;; GNU Emacs is free software: you can redistribute it and/or modify
  9. ;; it under the terms of the GNU General Public License as published by
  10. ;; the Free Software Foundation, either version 3 of the License, or
  11. ;; (at your option) any later version.
  12. ;; GNU Emacs is distributed in the hope that it will be useful,
  13. ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. ;; GNU General Public License for more details.
  16. ;; You should have received a copy of the GNU General Public License
  17. ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
  18. ;;; Commentary:
  19. ;; TODO:
  20. ;; - Add more unit tests for functions, timezone etc.
  21. ;; Note: Watch the trailing blank that is added on import.
  22. ;;; Code:
  23. (require 'ert)
  24. (require 'icalendar)
  25. ;; ======================================================================
  26. ;; Helpers
  27. ;; ======================================================================
  28. (defun icalendar-tests--get-ical-event (ical-string)
  29. "Return iCalendar event for ICAL-STRING."
  30. (save-excursion
  31. (with-temp-buffer
  32. (insert ical-string)
  33. (goto-char (point-min))
  34. (car (icalendar--read-element nil nil)))))
  35. (defun icalendar-tests--trim (string)
  36. "Remove leading and trailing whitespace from STRING."
  37. (replace-regexp-in-string "[ \t\n]+\\'" ""
  38. (replace-regexp-in-string "\\`[ \t\n]+" "" string)))
  39. ;; ======================================================================
  40. ;; Tests of functions
  41. ;; ======================================================================
  42. (ert-deftest icalendar--create-uid ()
  43. "Test for `icalendar--create-uid'."
  44. (let* ((icalendar-uid-format "xxx-%t-%c-%h-%u-%s")
  45. t-ct
  46. (icalendar--uid-count 77)
  47. (entry-full "30.06.1964 07:01 blahblah")
  48. (hash (format "%d" (abs (sxhash entry-full))))
  49. (contents "DTSTART:19640630T070100\nblahblah")
  50. (username (or user-login-name "UNKNOWN_USER"))
  51. )
  52. (fset 't-ct (symbol-function 'current-time))
  53. (unwind-protect
  54. (progn
  55. (fset 'current-time (lambda () '(1 2 3)))
  56. (should (= 77 icalendar--uid-count))
  57. (should (string= (concat "xxx-123-77-" hash "-" username "-19640630")
  58. (icalendar--create-uid entry-full contents)))
  59. (should (= 78 icalendar--uid-count)))
  60. ;; restore 'current-time
  61. (fset 'current-time (symbol-function 't-ct)))
  62. (setq contents "blahblah")
  63. (setq icalendar-uid-format "yyy%syyy")
  64. (should (string= (concat "yyyDTSTARTyyy")
  65. (icalendar--create-uid entry-full contents)))))
  66. (ert-deftest icalendar--calendar-style ()
  67. "Test for `icalendar--date-style'."
  68. (dolist (calendar-date-style '(iso american european))
  69. (should (eq (icalendar--date-style) calendar-date-style)))
  70. (let ((cds calendar-date-style)
  71. (european-calendar-style t))
  72. (makunbound 'calendar-date-style)
  73. (should (eq (icalendar--date-style) 'european))
  74. (with-no-warnings (setq european-calendar-style nil)) ;still get warning!?! FIXME
  75. (should (eq (icalendar--date-style) 'american))
  76. (setq calendar-date-style cds)))
  77. (ert-deftest icalendar-convert-anniversary-to-ical ()
  78. "Test method for `icalendar--convert-anniversary-to-ical'."
  79. (let* ((calendar-date-style 'iso)
  80. result)
  81. (setq result (icalendar--convert-anniversary-to-ical
  82. "" "%%(diary-anniversary 1964 6 30) g"))
  83. (should (= 2 (length result)))
  84. (should (string= (concat
  85. "\nDTSTART;VALUE=DATE:19640630"
  86. "\nDTEND;VALUE=DATE:19640701"
  87. "\nRRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=06;BYMONTHDAY=30")
  88. (car result)))
  89. (should (string= "g" (cadr result)))))
  90. (ert-deftest icalendar--convert-cyclic-to-ical ()
  91. "Test method for `icalendar--convert-cyclic-to-ical'."
  92. (let* ((calendar-date-style 'iso)
  93. result)
  94. (setq result (icalendar--convert-block-to-ical
  95. "" "%%(diary-block 2004 7 19 2004 8 27) Sommerferien"))
  96. (should (= 2 (length result)))
  97. (should (string= (concat
  98. "\nDTSTART;VALUE=DATE:20040719"
  99. "\nDTEND;VALUE=DATE:20040828")
  100. (car result)))
  101. (should (string= "Sommerferien" (cadr result)))))
  102. (ert-deftest icalendar--convert-block-to-ical ()
  103. "Test method for `icalendar--convert-block-to-ical'."
  104. (let* ((calendar-date-style 'iso)
  105. result)
  106. (setq result (icalendar--convert-block-to-ical
  107. "" "%%(diary-block 2004 7 19 2004 8 27) Sommerferien"))
  108. (should (= 2 (length result)))
  109. (should (string= (concat
  110. "\nDTSTART;VALUE=DATE:20040719"
  111. "\nDTEND;VALUE=DATE:20040828")
  112. (car result)))
  113. (should (string= "Sommerferien" (cadr result)))))
  114. (ert-deftest icalendar--convert-yearly-to-ical ()
  115. "Test method for `icalendar--convert-yearly-to-ical'."
  116. (let* ((calendar-date-style 'iso)
  117. result
  118. (calendar-month-name-array
  119. ["January" "February" "March" "April" "May" "June" "July" "August"
  120. "September" "October" "November" "December"]))
  121. (setq result (icalendar--convert-yearly-to-ical "" "May 1 Tag der Arbeit"))
  122. (should (= 2 (length result)))
  123. (should (string= (concat
  124. "\nDTSTART;VALUE=DATE:19000501"
  125. "\nDTEND;VALUE=DATE:19000502"
  126. "\nRRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=5;BYMONTHDAY=1")
  127. (car result)))
  128. (should (string= "Tag der Arbeit" (cadr result)))))
  129. (ert-deftest icalendar--convert-weekly-to-ical ()
  130. "Test method for `icalendar--convert-weekly-to-ical'."
  131. (let* ((calendar-date-style 'iso)
  132. result
  133. (calendar-day-name-array
  134. ["Sunday" "Monday" "Tuesday" "Wednesday" "Thursday" "Friday"
  135. "Saturday"]))
  136. (setq result (icalendar--convert-weekly-to-ical "" "Monday 8:30 subject"))
  137. (should (= 2 (length result)))
  138. (should (string= (concat "\nDTSTART;VALUE=DATE-TIME:20050103T083000"
  139. "\nDTEND;VALUE=DATE-TIME:20050103T093000"
  140. "\nRRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=MO")
  141. (car result)))
  142. (should (string= "subject" (cadr result)))))
  143. (ert-deftest icalendar--parse-vtimezone ()
  144. "Test method for `icalendar--parse-vtimezone'."
  145. (let (vtimezone result)
  146. (setq vtimezone (icalendar-tests--get-ical-event "BEGIN:VTIMEZONE
  147. TZID:thename
  148. BEGIN:STANDARD
  149. DTSTART:16010101T040000
  150. TZOFFSETFROM:+0300
  151. TZOFFSETTO:+0200
  152. RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=-1SU;BYMONTH=10
  153. END:STANDARD
  154. BEGIN:DAYLIGHT
  155. DTSTART:16010101T030000
  156. TZOFFSETFROM:+0200
  157. TZOFFSETTO:+0300
  158. RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=-1SU;BYMONTH=3
  159. END:DAYLIGHT
  160. END:VTIMEZONE
  161. "))
  162. (setq result (icalendar--parse-vtimezone vtimezone))
  163. (should (string= "thename" (car result)))
  164. (message (cdr result))
  165. (should (string= "STD-02:00DST-03:00,M3.5.0/03:00:00,M10.5.0/04:00:00"
  166. (cdr result)))
  167. (setq vtimezone (icalendar-tests--get-ical-event "BEGIN:VTIMEZONE
  168. TZID:anothername
  169. BEGIN:STANDARD
  170. DTSTART:16010101T040000
  171. TZOFFSETFROM:+0300
  172. TZOFFSETTO:+0200
  173. RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=2MO;BYMONTH=10
  174. END:STANDARD
  175. BEGIN:DAYLIGHT
  176. DTSTART:16010101T030000
  177. TZOFFSETFROM:+0200
  178. TZOFFSETTO:+0300
  179. RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=2MO;BYMONTH=3
  180. END:DAYLIGHT
  181. END:VTIMEZONE
  182. "))
  183. (setq result (icalendar--parse-vtimezone vtimezone))
  184. (should (string= "anothername" (car result)))
  185. (message (cdr result))
  186. (should (string= "STD-02:00DST-03:00,M3.2.1/03:00:00,M10.2.1/04:00:00"
  187. (cdr result)))))
  188. (ert-deftest icalendar--convert-ordinary-to-ical ()
  189. "Test method for `icalendar--convert-ordinary-to-ical'."
  190. (let* ((calendar-date-style 'iso)
  191. result)
  192. ;; without time
  193. (setq result (icalendar--convert-ordinary-to-ical "&?" "2010 2 15 subject"))
  194. (should (= 2 (length result)))
  195. (should (string= "\nDTSTART;VALUE=DATE:20100215\nDTEND;VALUE=DATE:20100216"
  196. (car result)))
  197. (should (string= "subject" (cadr result)))
  198. ;; with time
  199. (setq result (icalendar--convert-ordinary-to-ical
  200. "&?" "&2010 2 15 12:34-23:45 s"))
  201. (should (= 2 (length result)))
  202. (should (string= (concat "\nDTSTART;VALUE=DATE-TIME:20100215T123400"
  203. "\nDTEND;VALUE=DATE-TIME:20100215T234500")
  204. (car result)))
  205. (should (string= "s" (cadr result)))
  206. ;; with time, again -- test bug#5549
  207. (setq result (icalendar--convert-ordinary-to-ical
  208. "x?" "x2010 2 15 0:34-1:45 s"))
  209. (should (= 2 (length result)))
  210. (should (string= (concat "\nDTSTART;VALUE=DATE-TIME:20100215T003400"
  211. "\nDTEND;VALUE=DATE-TIME:20100215T014500")
  212. (car result)))
  213. (should (string= "s" (cadr result)))))
  214. (ert-deftest icalendar--diarytime-to-isotime ()
  215. "Test method for `icalendar--diarytime-to-isotime'."
  216. (should (string= "T011500"
  217. (icalendar--diarytime-to-isotime "01:15" "")))
  218. (should (string= "T011500"
  219. (icalendar--diarytime-to-isotime "1:15" "")))
  220. (should (string= "T000100"
  221. (icalendar--diarytime-to-isotime "0:01" "")))
  222. (should (string= "T010000"
  223. (icalendar--diarytime-to-isotime "0100" "")))
  224. (should (string= "T010000"
  225. (icalendar--diarytime-to-isotime "0100" "am")))
  226. (should (string= "T130000"
  227. (icalendar--diarytime-to-isotime "0100" "pm")))
  228. (should (string= "T120000"
  229. (icalendar--diarytime-to-isotime "1200" "")))
  230. (should (string= "T171700"
  231. (icalendar--diarytime-to-isotime "17:17" "")))
  232. (should (string= "T000000"
  233. (icalendar--diarytime-to-isotime "1200" "am")))
  234. (should (string= "T000100"
  235. (icalendar--diarytime-to-isotime "1201" "am")))
  236. (should (string= "T005900"
  237. (icalendar--diarytime-to-isotime "1259" "am")))
  238. (should (string= "T120000"
  239. (icalendar--diarytime-to-isotime "1200" "pm")))
  240. (should (string= "T120100"
  241. (icalendar--diarytime-to-isotime "1201" "pm")))
  242. (should (string= "T125900"
  243. (icalendar--diarytime-to-isotime "1259" "pm"))))
  244. (ert-deftest icalendar--datetime-to-diary-date ()
  245. "Test method for `icalendar--datetime-to-diary-date'."
  246. (let* ((datetime '(59 59 23 31 12 2008))
  247. (calendar-date-style 'iso))
  248. (should (string= "2008 12 31"
  249. (icalendar--datetime-to-diary-date datetime)))
  250. (setq calendar-date-style 'european)
  251. (should (string= "31 12 2008"
  252. (icalendar--datetime-to-diary-date datetime)))
  253. (setq calendar-date-style 'american)
  254. (should (string= "12 31 2008"
  255. (icalendar--datetime-to-diary-date datetime)))))
  256. (ert-deftest icalendar--datestring-to-isodate ()
  257. "Test method for `icalendar--datestring-to-isodate'."
  258. (let ((calendar-date-style 'iso))
  259. ;; numeric iso
  260. (should (string= "20080511"
  261. (icalendar--datestring-to-isodate "2008 05 11")))
  262. (should (string= "20080531"
  263. (icalendar--datestring-to-isodate "2008 05 31")))
  264. (should (string= "20080602"
  265. (icalendar--datestring-to-isodate "2008 05 31" 2)))
  266. ;; numeric european
  267. (setq calendar-date-style 'european)
  268. (should (string= "20080511"
  269. (icalendar--datestring-to-isodate "11 05 2008")))
  270. (should (string= "20080531"
  271. (icalendar--datestring-to-isodate "31 05 2008")))
  272. (should (string= "20080602"
  273. (icalendar--datestring-to-isodate "31 05 2008" 2)))
  274. ;; numeric american
  275. (setq calendar-date-style 'american)
  276. (should (string= "20081105"
  277. (icalendar--datestring-to-isodate "11 05 2008")))
  278. (should (string= "20081230"
  279. (icalendar--datestring-to-isodate "12 30 2008")))
  280. (should (string= "20090101"
  281. (icalendar--datestring-to-isodate "12 30 2008" 2)))
  282. ;; non-numeric
  283. (setq calendar-date-style nil) ;not necessary for conversion
  284. (should (string= "20081105"
  285. (icalendar--datestring-to-isodate "Nov 05 2008")))
  286. (should (string= "20081105"
  287. (icalendar--datestring-to-isodate "05 Nov 2008")))
  288. (should (string= "20081105"
  289. (icalendar--datestring-to-isodate "2008 Nov 05")))))
  290. (ert-deftest icalendar--first-weekday-of-year ()
  291. "Test method for `icalendar-first-weekday-of-year'."
  292. (should (eq 1 (icalendar-first-weekday-of-year "TU" 2008)))
  293. (should (eq 3 (icalendar-first-weekday-of-year "WE" 2007)))
  294. (should (eq 5 (icalendar-first-weekday-of-year "TH" 2006)))
  295. (should (eq 7 (icalendar-first-weekday-of-year "FR" 2005)))
  296. (should (eq 3 (icalendar-first-weekday-of-year "SA" 2004)))
  297. (should (eq 5 (icalendar-first-weekday-of-year "SU" 2003)))
  298. (should (eq 7 (icalendar-first-weekday-of-year "MO" 2002)))
  299. (should (eq 3 (icalendar-first-weekday-of-year "MO" 2000)))
  300. (should (eq 1 (icalendar-first-weekday-of-year "TH" 1970))))
  301. (ert-deftest icalendar--import-format-sample ()
  302. "Test method for `icalendar-import-format-sample'."
  303. (should (string= (concat "SUMMARY=`a' DESCRIPTION=`b' LOCATION=`c' "
  304. "ORGANIZER=`d' STATUS=`' URL=`' CLASS=`'")
  305. (icalendar-import-format-sample
  306. (icalendar-tests--get-ical-event "BEGIN:VEVENT
  307. DTSTAMP:20030509T043439Z
  308. DTSTART:20030509T103000
  309. SUMMARY:a
  310. ORGANIZER:d
  311. LOCATION:c
  312. DTEND:20030509T153000
  313. DESCRIPTION:b
  314. END:VEVENT
  315. ")))))
  316. (ert-deftest icalendar--format-ical-event ()
  317. "Test `icalendar--format-ical-event'."
  318. (let ((icalendar-import-format "%s%d%l%o%t%u%c")
  319. (icalendar-import-format-summary "SUM %s")
  320. (icalendar-import-format-location " LOC %s")
  321. (icalendar-import-format-description " DES %s")
  322. (icalendar-import-format-organizer " ORG %s")
  323. (icalendar-import-format-status " STA %s")
  324. (icalendar-import-format-url " URL %s")
  325. (icalendar-import-format-class " CLA %s")
  326. (event (icalendar-tests--get-ical-event "BEGIN:VEVENT
  327. DTSTAMP:20030509T043439Z
  328. DTSTART:20030509T103000
  329. SUMMARY:sum
  330. ORGANIZER:org
  331. LOCATION:loc
  332. DTEND:20030509T153000
  333. DESCRIPTION:des
  334. END:VEVENT
  335. ")))
  336. (should (string= "SUM sum DES des LOC loc ORG org"
  337. (icalendar--format-ical-event event)))
  338. (setq icalendar-import-format (lambda (&rest ignore)
  339. "helloworld"))
  340. (should (string= "helloworld" (icalendar--format-ical-event event)))
  341. (setq icalendar-import-format
  342. (lambda (e)
  343. (format "-%s-%s-%s-%s-%s-%s-%s-"
  344. (icalendar--get-event-property event 'SUMMARY)
  345. (icalendar--get-event-property event 'DESCRIPTION)
  346. (icalendar--get-event-property event 'LOCATION)
  347. (icalendar--get-event-property event 'ORGANIZER)
  348. (icalendar--get-event-property event 'STATUS)
  349. (icalendar--get-event-property event 'URL)
  350. (icalendar--get-event-property event 'CLASS))))
  351. (should (string= "-sum-des-loc-org-nil-nil-nil-"
  352. (icalendar--format-ical-event event)))))
  353. (ert-deftest icalendar--parse-summary-and-rest ()
  354. "Test `icalendar--parse-summary-and-rest'."
  355. (let ((icalendar-import-format "%s%d%l%o%t%u%c")
  356. (icalendar-import-format-summary "SUM %s")
  357. (icalendar-import-format-location " LOC %s")
  358. (icalendar-import-format-description " DES %s")
  359. (icalendar-import-format-organizer " ORG %s")
  360. (icalendar-import-format-status " STA %s")
  361. (icalendar-import-format-url " URL %s")
  362. (icalendar-import-format-class " CLA %s")
  363. (result))
  364. (setq result (icalendar--parse-summary-and-rest "SUM sum ORG org"))
  365. (should (string= "org" (cdr (assoc 'org result))))
  366. (setq result (icalendar--parse-summary-and-rest
  367. "SUM sum DES des LOC loc ORG org STA sta URL url CLA cla"))
  368. (should (string= "des" (cdr (assoc 'des result))))
  369. (should (string= "loc" (cdr (assoc 'loc result))))
  370. (should (string= "org" (cdr (assoc 'org result))))
  371. (should (string= "sta" (cdr (assoc 'sta result))))
  372. (should (string= "cla" (cdr (assoc 'cla result))))
  373. (setq icalendar-import-format (lambda () "Hello world"))
  374. (setq result (icalendar--parse-summary-and-rest
  375. "blah blah "))
  376. (should (not result))
  377. ))
  378. ;; ======================================================================
  379. ;; Export tests
  380. ;; ======================================================================
  381. (defun icalendar-tests--test-export (input-iso input-european input-american
  382. expected-output)
  383. "Perform an export test.
  384. Argument INPUT-ISO iso style diary string.
  385. Argument INPUT-EUROPEAN european style diary string.
  386. Argument INPUT-AMERICAN american style diary string.
  387. Argument EXPECTED-OUTPUT expected iCalendar result string.
  388. European style input data must use german month names. American
  389. and ISO style input data must use english month names."
  390. (let ((tz (cadr (current-time-zone)))
  391. (calendar-date-style 'iso)
  392. (icalendar-recurring-start-year 2000))
  393. (unwind-protect
  394. (progn
  395. (set-time-zone-rule "CET")
  396. (when input-iso
  397. (let ((calendar-month-name-array
  398. ["January" "February" "March" "April" "May" "June" "July" "August"
  399. "September" "October" "November" "December"])
  400. (calendar-day-name-array
  401. ["Sunday" "Monday" "Tuesday" "Wednesday" "Thursday" "Friday"
  402. "Saturday"]))
  403. (setq calendar-date-style 'iso)
  404. (icalendar-tests--do-test-export input-iso expected-output)))
  405. (when input-european
  406. (let ((calendar-month-name-array
  407. ["Januar" "Februar" "März" "April" "Mai" "Juni" "Juli" "August"
  408. "September" "Oktober" "November" "Dezember"])
  409. (calendar-day-name-array
  410. ["Sonntag" "Montag" "Dienstag" "Mittwoch" "Donnerstag" "Freitag"
  411. "Samstag"]))
  412. (setq calendar-date-style 'european)
  413. (icalendar-tests--do-test-export input-european expected-output)))
  414. (when input-american
  415. (let ((calendar-month-name-array
  416. ["January" "February" "March" "April" "May" "June" "July" "August"
  417. "September" "October" "November" "December"])
  418. (calendar-day-name-array
  419. ["Sunday" "Monday" "Tuesday" "Wednesday" "Thursday" "Friday"
  420. "Saturday"]))
  421. (setq calendar-date-style 'american)
  422. (icalendar-tests--do-test-export input-american expected-output))))
  423. ;; restore time-zone if something went terribly wrong
  424. (set-time-zone-rule tz))))
  425. (defun icalendar-tests--do-test-export (input expected-output)
  426. "Actually perform export test.
  427. Argument INPUT input diary string.
  428. Argument EXPECTED-OUTPUT expected iCalendar result string."
  429. (let ((temp-file (make-temp-file "icalendar-tests-ics")))
  430. (unwind-protect
  431. (progn
  432. (with-temp-buffer
  433. (insert input)
  434. (icalendar-export-region (point-min) (point-max) temp-file))
  435. (save-excursion
  436. (find-file temp-file)
  437. (goto-char (point-min))
  438. (cond (expected-output
  439. (should (re-search-forward "^\\s-*BEGIN:VCALENDAR
  440. PRODID:-//Emacs//NONSGML icalendar.el//EN
  441. VERSION:2.0
  442. BEGIN:VEVENT
  443. UID:emacs[0-9]+
  444. \\(\\(.\\|\n\\)+\\)
  445. END:VEVENT
  446. END:VCALENDAR
  447. \\s-*$"
  448. nil t))
  449. (should (string-match
  450. (concat "^\\s-*"
  451. (regexp-quote (buffer-substring-no-properties
  452. (match-beginning 1) (match-end 1)))
  453. "\\s-*$")
  454. expected-output)))
  455. (t
  456. (should (re-search-forward "^\\s-*BEGIN:VCALENDAR
  457. PRODID:-//Emacs//NONSGML icalendar.el//EN
  458. VERSION:2.0
  459. END:VCALENDAR
  460. \\s-*$"
  461. nil t))))))
  462. ;; cleanup!!
  463. (kill-buffer (find-buffer-visiting temp-file))
  464. (delete-file temp-file))))
  465. (ert-deftest icalendar-export-ordinary-no-time ()
  466. "Perform export test."
  467. (let ((icalendar-export-hidden-diary-entries nil))
  468. (icalendar-tests--test-export
  469. "&2000 Oct 3 ordinary no time "
  470. "&3 Okt 2000 ordinary no time "
  471. "&Oct 3 2000 ordinary no time "
  472. nil))
  473. (icalendar-tests--test-export
  474. "2000 Oct 3 ordinary no time "
  475. "3 Okt 2000 ordinary no time "
  476. "Oct 3 2000 ordinary no time "
  477. "DTSTART;VALUE=DATE:20001003
  478. DTEND;VALUE=DATE:20001004
  479. SUMMARY:ordinary no time
  480. "))
  481. (ert-deftest icalendar-export-ordinary ()
  482. "Perform export test."
  483. (icalendar-tests--test-export
  484. "2000 Oct 3 16:30 ordinary with time"
  485. "3 Okt 2000 16:30 ordinary with time"
  486. "Oct 3 2000 16:30 ordinary with time"
  487. "DTSTART;VALUE=DATE-TIME:20001003T163000
  488. DTEND;VALUE=DATE-TIME:20001003T173000
  489. SUMMARY:ordinary with time
  490. ")
  491. (icalendar-tests--test-export
  492. "2000 10 3 16:30 ordinary with time 2"
  493. "3 10 2000 16:30 ordinary with time 2"
  494. "10 3 2000 16:30 ordinary with time 2"
  495. "DTSTART;VALUE=DATE-TIME:20001003T163000
  496. DTEND;VALUE=DATE-TIME:20001003T173000
  497. SUMMARY:ordinary with time 2
  498. ")
  499. (icalendar-tests--test-export
  500. "2000/10/3 16:30 ordinary with time 3"
  501. "3/10/2000 16:30 ordinary with time 3"
  502. "10/3/2000 16:30 ordinary with time 3"
  503. "DTSTART;VALUE=DATE-TIME:20001003T163000
  504. DTEND;VALUE=DATE-TIME:20001003T173000
  505. SUMMARY:ordinary with time 3
  506. "))
  507. (ert-deftest icalendar-export-multiline ()
  508. "Perform export test."
  509. ;; multiline -- FIXME!!!
  510. (icalendar-tests--test-export
  511. "2000 October 3 16:30 multiline
  512. 17:30 multiline continued FIXME"
  513. "3 Oktober 2000 16:30 multiline
  514. 17:30 multiline continued FIXME"
  515. "October 3 2000 16:30 multiline
  516. 17:30 multiline continued FIXME"
  517. "DTSTART;VALUE=DATE-TIME:20001003T163000
  518. DTEND;VALUE=DATE-TIME:20001003T173000
  519. SUMMARY:multiline
  520. DESCRIPTION:
  521. 17:30 multiline continued FIXME
  522. "))
  523. (ert-deftest icalendar-export-weekly-by-day ()
  524. "Perform export test."
  525. ;; weekly by day
  526. (icalendar-tests--test-export
  527. "Monday 1:30pm weekly by day with start time"
  528. "Montag 13:30 weekly by day with start time"
  529. "Monday 1:30pm weekly by day with start time"
  530. "DTSTART;VALUE=DATE-TIME:20000103T133000
  531. DTEND;VALUE=DATE-TIME:20000103T143000
  532. RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=MO
  533. SUMMARY:weekly by day with start time
  534. ")
  535. (icalendar-tests--test-export
  536. "Monday 13:30-15:00 weekly by day with start and end time"
  537. "Montag 13:30-15:00 weekly by day with start and end time"
  538. "Monday 01:30pm-03:00pm weekly by day with start and end time"
  539. "DTSTART;VALUE=DATE-TIME:20000103T133000
  540. DTEND;VALUE=DATE-TIME:20000103T150000
  541. RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=MO
  542. SUMMARY:weekly by day with start and end time
  543. "))
  544. (ert-deftest icalendar-export-yearly ()
  545. "Perform export test."
  546. ;; yearly
  547. (icalendar-tests--test-export
  548. "may 1 yearly no time"
  549. "1 Mai yearly no time"
  550. "may 1 yearly no time"
  551. "DTSTART;VALUE=DATE:19000501
  552. DTEND;VALUE=DATE:19000502
  553. RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=5;BYMONTHDAY=1
  554. SUMMARY:yearly no time
  555. "))
  556. (ert-deftest icalendar-export-anniversary ()
  557. "Perform export test."
  558. ;; anniversaries
  559. (icalendar-tests--test-export
  560. "%%(diary-anniversary 1989 10 3) anniversary no time"
  561. "%%(diary-anniversary 3 10 1989) anniversary no time"
  562. "%%(diary-anniversary 10 3 1989) anniversary no time"
  563. "DTSTART;VALUE=DATE:19891003
  564. DTEND;VALUE=DATE:19891004
  565. RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=10;BYMONTHDAY=03
  566. SUMMARY:anniversary no time
  567. ")
  568. (icalendar-tests--test-export
  569. "%%(diary-anniversary 1989 10 3) 19:00-20:00 anniversary with time"
  570. "%%(diary-anniversary 3 10 1989) 19:00-20:00 anniversary with time"
  571. "%%(diary-anniversary 10 3 1989) 19:00-20:00 anniversary with time"
  572. "DTSTART;VALUE=DATE-TIME:19891003T190000
  573. DTEND;VALUE=DATE-TIME:19891004T200000
  574. RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=10;BYMONTHDAY=03
  575. SUMMARY:anniversary with time
  576. "))
  577. (ert-deftest icalendar-export-block ()
  578. "Perform export test."
  579. ;; block
  580. (icalendar-tests--test-export
  581. "%%(diary-block 2001 6 18 2001 7 6) block no time"
  582. "%%(diary-block 18 6 2001 6 7 2001) block no time"
  583. "%%(diary-block 6 18 2001 7 6 2001) block no time"
  584. "DTSTART;VALUE=DATE:20010618
  585. DTEND;VALUE=DATE:20010707
  586. SUMMARY:block no time
  587. ")
  588. (icalendar-tests--test-export
  589. "%%(diary-block 2001 6 18 2001 7 6) 13:00-17:00 block with time"
  590. "%%(diary-block 18 6 2001 6 7 2001) 13:00-17:00 block with time"
  591. "%%(diary-block 6 18 2001 7 6 2001) 13:00-17:00 block with time"
  592. "DTSTART;VALUE=DATE-TIME:20010618T130000
  593. DTEND;VALUE=DATE-TIME:20010618T170000
  594. RRULE:FREQ=DAILY;INTERVAL=1;UNTIL=20010706
  595. SUMMARY:block with time
  596. ")
  597. (icalendar-tests--test-export
  598. "%%(diary-block 2001 6 18 2001 7 6) 13:00 block no end time"
  599. "%%(diary-block 18 6 2001 6 7 2001) 13:00 block no end time"
  600. "%%(diary-block 6 18 2001 7 6 2001) 13:00 block no end time"
  601. "DTSTART;VALUE=DATE-TIME:20010618T130000
  602. DTEND;VALUE=DATE-TIME:20010618T140000
  603. RRULE:FREQ=DAILY;INTERVAL=1;UNTIL=20010706
  604. SUMMARY:block no end time
  605. "))
  606. ;; ======================================================================
  607. ;; Import tests
  608. ;; ======================================================================
  609. (defun icalendar-tests--test-import (input expected-iso expected-european
  610. expected-american)
  611. "Perform import test.
  612. Argument INPUT icalendar event string.
  613. Argument EXPECTED-ISO expected iso style diary string.
  614. Argument EXPECTED-EUROPEAN expected european style diary string.
  615. Argument EXPECTED-AMERICAN expected american style diary string."
  616. (let ((timezone (cadr (current-time-zone))))
  617. (set-time-zone-rule "CET")
  618. (with-temp-buffer
  619. (if (string-match "^BEGIN:VCALENDAR" input)
  620. (insert input)
  621. (insert "BEGIN:VCALENDAR\nPRODID:-//Emacs//NONSGML icalendar.el//EN\n")
  622. (insert "VERSION:2.0\nBEGIN:VEVENT\n")
  623. (insert input)
  624. (unless (eq (char-before) ?\n)
  625. (insert "\n"))
  626. (insert "END:VEVENT\nEND:VCALENDAR\n"))
  627. (let ((icalendar-import-format "%s%d%l%o%t%u%c")
  628. (icalendar-import-format-summary "%s")
  629. (icalendar-import-format-location "\n Location: %s")
  630. (icalendar-import-format-description "\n Desc: %s")
  631. (icalendar-import-format-organizer "\n Organizer: %s")
  632. (icalendar-import-format-status "\n Status: %s")
  633. (icalendar-import-format-url "\n URL: %s")
  634. (icalendar-import-format-class "\n Class: %s")
  635. calendar-date-style)
  636. (when expected-iso
  637. (setq calendar-date-style 'iso)
  638. (icalendar-tests--do-test-import input expected-iso))
  639. (when expected-european
  640. (setq calendar-date-style 'european)
  641. (icalendar-tests--do-test-import input expected-european))
  642. (when expected-american
  643. (setq calendar-date-style 'american)
  644. (icalendar-tests--do-test-import input expected-american))))
  645. (set-time-zone-rule timezone)))
  646. (defun icalendar-tests--do-test-import (input expected-output)
  647. "Actually perform import test.
  648. Argument INPUT input icalendar string.
  649. Argument EXPECTED-OUTPUT expected diary string."
  650. (let ((temp-file (make-temp-file "icalendar-test-diary")))
  651. (icalendar-import-buffer temp-file t t)
  652. (save-excursion
  653. (find-file temp-file)
  654. (let ((result (buffer-substring-no-properties (point-min) (point-max))))
  655. (should (string= expected-output result)))
  656. (kill-buffer (find-buffer-visiting temp-file))
  657. (delete-file temp-file))))
  658. (ert-deftest icalendar-import-non-recurring ()
  659. "Perform standard import tests."
  660. (icalendar-tests--test-import
  661. "SUMMARY:non-recurring
  662. DTSTART;VALUE=DATE-TIME:20030919T090000
  663. DTEND;VALUE=DATE-TIME:20030919T113000"
  664. "&2003/9/19 09:00-11:30 non-recurring\n"
  665. "&19/9/2003 09:00-11:30 non-recurring\n"
  666. "&9/19/2003 09:00-11:30 non-recurring\n")
  667. (icalendar-tests--test-import
  668. "SUMMARY:non-recurring allday
  669. DTSTART;VALUE=DATE-TIME:20030919"
  670. "&2003/9/19 non-recurring allday\n"
  671. "&19/9/2003 non-recurring allday\n"
  672. "&9/19/2003 non-recurring allday\n")
  673. (icalendar-tests--test-import
  674. ;; Checkdoc removes trailing blanks. Therefore: format!
  675. (format "%s\n%s\n%s" "SUMMARY:long " " summary"
  676. "DTSTART;VALUE=DATE:20030919")
  677. "&2003/9/19 long summary\n"
  678. "&19/9/2003 long summary\n"
  679. "&9/19/2003 long summary\n")
  680. (icalendar-tests--test-import
  681. "UID:748f2da0-0d9b-11d8-97af-b4ec8686ea61
  682. SUMMARY:Sommerferien
  683. STATUS:TENTATIVE
  684. CLASS:PRIVATE
  685. X-MOZILLA-ALARM-DEFAULT-UNITS:Minuten
  686. X-MOZILLA-RECUR-DEFAULT-INTERVAL:0
  687. DTSTART;VALUE=DATE:20040719
  688. DTEND;VALUE=DATE:20040828
  689. DTSTAMP:20031103T011641Z
  690. "
  691. "&%%(and (diary-block 2004 7 19 2004 8 27)) Sommerferien
  692. Status: TENTATIVE
  693. Class: PRIVATE
  694. "
  695. "&%%(and (diary-block 19 7 2004 27 8 2004)) Sommerferien
  696. Status: TENTATIVE
  697. Class: PRIVATE
  698. "
  699. "&%%(and (diary-block 7 19 2004 8 27 2004)) Sommerferien
  700. Status: TENTATIVE
  701. Class: PRIVATE
  702. ")
  703. (icalendar-tests--test-import
  704. "UID
  705. :04979712-3902-11d9-93dd-8f9f4afe08da
  706. SUMMARY
  707. :folded summary
  708. STATUS
  709. :TENTATIVE
  710. CLASS
  711. :PRIVATE
  712. X-MOZILLA-ALARM-DEFAULT-LENGTH
  713. :0
  714. DTSTART
  715. :20041123T140000
  716. DTEND
  717. :20041123T143000
  718. DTSTAMP
  719. :20041118T013430Z
  720. LAST-MODIFIED
  721. :20041118T013640Z
  722. "
  723. "&2004/11/23 14:00-14:30 folded summary
  724. Status: TENTATIVE
  725. Class: PRIVATE\n"
  726. "&23/11/2004 14:00-14:30 folded summary
  727. Status: TENTATIVE
  728. Class: PRIVATE\n"
  729. "&11/23/2004 14:00-14:30 folded summary
  730. Status: TENTATIVE
  731. Class: PRIVATE\n")
  732. (icalendar-tests--test-import
  733. "UID
  734. :6161a312-3902-11d9-b512-f764153bb28b
  735. SUMMARY
  736. :another example
  737. STATUS
  738. :TENTATIVE
  739. CLASS
  740. :PRIVATE
  741. X-MOZILLA-ALARM-DEFAULT-LENGTH
  742. :0
  743. DTSTART
  744. :20041123T144500
  745. DTEND
  746. :20041123T154500
  747. DTSTAMP
  748. :20041118T013641Z
  749. "
  750. "&2004/11/23 14:45-15:45 another example
  751. Status: TENTATIVE
  752. Class: PRIVATE\n"
  753. "&23/11/2004 14:45-15:45 another example
  754. Status: TENTATIVE
  755. Class: PRIVATE\n"
  756. "&11/23/2004 14:45-15:45 another example
  757. Status: TENTATIVE
  758. Class: PRIVATE\n"))
  759. (ert-deftest icalendar-import-rrule ()
  760. (icalendar-tests--test-import
  761. "SUMMARY:rrule daily
  762. DTSTART;VALUE=DATE-TIME:20030919T090000
  763. DTEND;VALUE=DATE-TIME:20030919T113000
  764. RRULE:FREQ=DAILY;
  765. "
  766. "&%%(and (diary-cyclic 1 2003 9 19)) 09:00-11:30 rrule daily\n"
  767. "&%%(and (diary-cyclic 1 19 9 2003)) 09:00-11:30 rrule daily\n"
  768. "&%%(and (diary-cyclic 1 9 19 2003)) 09:00-11:30 rrule daily\n")
  769. ;; RRULE examples
  770. (icalendar-tests--test-import
  771. "SUMMARY:rrule daily
  772. DTSTART;VALUE=DATE-TIME:20030919T090000
  773. DTEND;VALUE=DATE-TIME:20030919T113000
  774. RRULE:FREQ=DAILY;INTERVAL=2
  775. "
  776. "&%%(and (diary-cyclic 2 2003 9 19)) 09:00-11:30 rrule daily\n"
  777. "&%%(and (diary-cyclic 2 19 9 2003)) 09:00-11:30 rrule daily\n"
  778. "&%%(and (diary-cyclic 2 9 19 2003)) 09:00-11:30 rrule daily\n")
  779. (icalendar-tests--test-import
  780. "SUMMARY:rrule daily with exceptions
  781. DTSTART;VALUE=DATE-TIME:20030919T090000
  782. DTEND;VALUE=DATE-TIME:20030919T113000
  783. RRULE:FREQ=DAILY;INTERVAL=2
  784. EXDATE:20030921,20030925
  785. "
  786. "&%%(and (not (diary-date 2003 9 25)) (not (diary-date 2003 9 21)) (diary-cyclic 2 2003 9 19)) 09:00-11:30 rrule daily with exceptions\n"
  787. "&%%(and (not (diary-date 25 9 2003)) (not (diary-date 21 9 2003)) (diary-cyclic 2 19 9 2003)) 09:00-11:30 rrule daily with exceptions\n"
  788. "&%%(and (not (diary-date 9 25 2003)) (not (diary-date 9 21 2003)) (diary-cyclic 2 9 19 2003)) 09:00-11:30 rrule daily with exceptions\n")
  789. (icalendar-tests--test-import
  790. "SUMMARY:rrule weekly
  791. DTSTART;VALUE=DATE-TIME:20030919T090000
  792. DTEND;VALUE=DATE-TIME:20030919T113000
  793. RRULE:FREQ=WEEKLY;
  794. "
  795. "&%%(and (diary-cyclic 7 2003 9 19)) 09:00-11:30 rrule weekly\n"
  796. "&%%(and (diary-cyclic 7 19 9 2003)) 09:00-11:30 rrule weekly\n"
  797. "&%%(and (diary-cyclic 7 9 19 2003)) 09:00-11:30 rrule weekly\n")
  798. (icalendar-tests--test-import
  799. "SUMMARY:rrule monthly no end
  800. DTSTART;VALUE=DATE-TIME:20030919T090000
  801. DTEND;VALUE=DATE-TIME:20030919T113000
  802. RRULE:FREQ=MONTHLY;
  803. "
  804. "&%%(and (diary-date t t 19) (diary-block 2003 9 19 9999 1 1)) 09:00-11:30 rrule monthly no end\n"
  805. "&%%(and (diary-date 19 t t) (diary-block 19 9 2003 1 1 9999)) 09:00-11:30 rrule monthly no end\n"
  806. "&%%(and (diary-date t 19 t) (diary-block 9 19 2003 1 1 9999)) 09:00-11:30 rrule monthly no end\n")
  807. (icalendar-tests--test-import
  808. "SUMMARY:rrule monthly with end
  809. DTSTART;VALUE=DATE-TIME:20030919T090000
  810. DTEND;VALUE=DATE-TIME:20030919T113000
  811. RRULE:FREQ=MONTHLY;UNTIL=20050819;
  812. "
  813. "&%%(and (diary-date t t 19) (diary-block 2003 9 19 2005 8 19)) 09:00-11:30 rrule monthly with end\n"
  814. "&%%(and (diary-date 19 t t) (diary-block 19 9 2003 19 8 2005)) 09:00-11:30 rrule monthly with end\n"
  815. "&%%(and (diary-date t 19 t) (diary-block 9 19 2003 8 19 2005)) 09:00-11:30 rrule monthly with end\n")
  816. (icalendar-tests--test-import
  817. "DTSTART;VALUE=DATE:20040815
  818. DTEND;VALUE=DATE:20040816
  819. SUMMARY:Maria Himmelfahrt
  820. UID:CC56BEA6-49D2-11D8-8833-00039386D1C2-RID
  821. RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=8
  822. "
  823. "&%%(and (diary-anniversary 2004 8 15)) Maria Himmelfahrt\n"
  824. "&%%(and (diary-anniversary 15 8 2004)) Maria Himmelfahrt\n"
  825. "&%%(and (diary-anniversary 8 15 2004)) Maria Himmelfahrt\n")
  826. (icalendar-tests--test-import
  827. "SUMMARY:rrule yearly
  828. DTSTART;VALUE=DATE-TIME:20030919T090000
  829. DTEND;VALUE=DATE-TIME:20030919T113000
  830. RRULE:FREQ=YEARLY;INTERVAL=2
  831. "
  832. "&%%(and (diary-anniversary 2003 9 19)) 09:00-11:30 rrule yearly\n" ;FIXME
  833. "&%%(and (diary-anniversary 19 9 2003)) 09:00-11:30 rrule yearly\n" ;FIXME
  834. "&%%(and (diary-anniversary 9 19 2003)) 09:00-11:30 rrule yearly\n") ;FIXME
  835. (icalendar-tests--test-import
  836. "SUMMARY:rrule count daily short
  837. DTSTART;VALUE=DATE-TIME:20030919T090000
  838. DTEND;VALUE=DATE-TIME:20030919T113000
  839. RRULE:FREQ=DAILY;COUNT=1;INTERVAL=1
  840. "
  841. "&%%(and (diary-cyclic 1 2003 9 19) (diary-block 2003 9 19 2003 9 19)) 09:00-11:30 rrule count daily short\n"
  842. "&%%(and (diary-cyclic 1 19 9 2003) (diary-block 19 9 2003 19 9 2003)) 09:00-11:30 rrule count daily short\n"
  843. "&%%(and (diary-cyclic 1 9 19 2003) (diary-block 9 19 2003 9 19 2003)) 09:00-11:30 rrule count daily short\n")
  844. (icalendar-tests--test-import
  845. "SUMMARY:rrule count daily long
  846. DTSTART;VALUE=DATE-TIME:20030919T090000
  847. DTEND;VALUE=DATE-TIME:20030919T113000
  848. RRULE:FREQ=DAILY;COUNT=14;INTERVAL=1
  849. "
  850. "&%%(and (diary-cyclic 1 2003 9 19) (diary-block 2003 9 19 2003 10 2)) 09:00-11:30 rrule count daily long\n"
  851. "&%%(and (diary-cyclic 1 19 9 2003) (diary-block 19 9 2003 2 10 2003)) 09:00-11:30 rrule count daily long\n"
  852. "&%%(and (diary-cyclic 1 9 19 2003) (diary-block 9 19 2003 10 2 2003)) 09:00-11:30 rrule count daily long\n")
  853. (icalendar-tests--test-import
  854. "SUMMARY:rrule count bi-weekly 3 times
  855. DTSTART;VALUE=DATE-TIME:20030919T090000
  856. DTEND;VALUE=DATE-TIME:20030919T113000
  857. RRULE:FREQ=WEEKLY;COUNT=3;INTERVAL=2
  858. "
  859. "&%%(and (diary-cyclic 14 2003 9 19) (diary-block 2003 9 19 2003 10 31)) 09:00-11:30 rrule count bi-weekly 3 times\n"
  860. "&%%(and (diary-cyclic 14 19 9 2003) (diary-block 19 9 2003 31 10 2003)) 09:00-11:30 rrule count bi-weekly 3 times\n"
  861. "&%%(and (diary-cyclic 14 9 19 2003) (diary-block 9 19 2003 10 31 2003)) 09:00-11:30 rrule count bi-weekly 3 times\n")
  862. (icalendar-tests--test-import
  863. "SUMMARY:rrule count monthly
  864. DTSTART;VALUE=DATE-TIME:20030919T090000
  865. DTEND;VALUE=DATE-TIME:20030919T113000
  866. RRULE:FREQ=MONTHLY;INTERVAL=1;COUNT=5
  867. "
  868. "&%%(and (diary-date t t 19) (diary-block 2003 9 19 2004 1 19)) 09:00-11:30 rrule count monthly\n"
  869. "&%%(and (diary-date 19 t t) (diary-block 19 9 2003 19 1 2004)) 09:00-11:30 rrule count monthly\n"
  870. "&%%(and (diary-date t 19 t) (diary-block 9 19 2003 1 19 2004)) 09:00-11:30 rrule count monthly\n")
  871. (icalendar-tests--test-import
  872. "SUMMARY:rrule count every second month
  873. DTSTART;VALUE=DATE-TIME:20030919T090000
  874. DTEND;VALUE=DATE-TIME:20030919T113000
  875. RRULE:FREQ=MONTHLY;INTERVAL=2;COUNT=5
  876. "
  877. "&%%(and (diary-date t t 19) (diary-block 2003 9 19 2004 5 19)) 09:00-11:30 rrule count every second month\n" ;FIXME
  878. "&%%(and (diary-date 19 t t) (diary-block 19 9 2003 19 5 2004)) 09:00-11:30 rrule count every second month\n" ;FIXME
  879. "&%%(and (diary-date t 19 t) (diary-block 9 19 2003 5 19 2004)) 09:00-11:30 rrule count every second month\n") ;FIXME
  880. (icalendar-tests--test-import
  881. "SUMMARY:rrule count yearly
  882. DTSTART;VALUE=DATE-TIME:20030919T090000
  883. DTEND;VALUE=DATE-TIME:20030919T113000
  884. RRULE:FREQ=YEARLY;INTERVAL=1;COUNT=5
  885. "
  886. "&%%(and (diary-date t 9 19) (diary-block 2003 9 19 2007 9 19)) 09:00-11:30 rrule count yearly\n"
  887. "&%%(and (diary-date 19 9 t) (diary-block 19 9 2003 19 9 2007)) 09:00-11:30 rrule count yearly\n"
  888. "&%%(and (diary-date 9 19 t) (diary-block 9 19 2003 9 19 2007)) 09:00-11:30 rrule count yearly\n")
  889. (icalendar-tests--test-import
  890. "SUMMARY:rrule count every second year
  891. DTSTART;VALUE=DATE-TIME:20030919T090000
  892. DTEND;VALUE=DATE-TIME:20030919T113000
  893. RRULE:FREQ=YEARLY;INTERVAL=2;COUNT=5
  894. "
  895. "&%%(and (diary-date t 9 19) (diary-block 2003 9 19 2011 9 19)) 09:00-11:30 rrule count every second year\n" ;FIXME!!!
  896. "&%%(and (diary-date 19 9 t) (diary-block 19 9 2003 19 9 2011)) 09:00-11:30 rrule count every second year\n" ;FIXME!!!
  897. "&%%(and (diary-date 9 19 t) (diary-block 9 19 2003 9 19 2011)) 09:00-11:30 rrule count every second year\n") ;FIXME!!!
  898. )
  899. (ert-deftest icalendar-import-duration ()
  900. ;; duration
  901. (icalendar-tests--test-import
  902. "DTSTART;VALUE=DATE:20050217
  903. SUMMARY:duration
  904. DURATION:P7D
  905. "
  906. "&%%(and (diary-block 2005 2 17 2005 2 23)) duration\n"
  907. "&%%(and (diary-block 17 2 2005 23 2 2005)) duration\n"
  908. "&%%(and (diary-block 2 17 2005 2 23 2005)) duration\n")
  909. (icalendar-tests--test-import
  910. "UID:20041127T183329Z-18215-1001-4536-49109@andromeda
  911. DTSTAMP:20041127T183315Z
  912. LAST-MODIFIED:20041127T183329
  913. SUMMARY:Urlaub
  914. DTSTART;VALUE=DATE:20011221
  915. DTEND;VALUE=DATE:20011221
  916. RRULE:FREQ=DAILY;UNTIL=20011229;INTERVAL=1;WKST=SU
  917. CLASS:PUBLIC
  918. SEQUENCE:1
  919. CREATED:20041127T183329
  920. "
  921. "&%%(and (diary-cyclic 1 2001 12 21) (diary-block 2001 12 21 2001 12 29)) Urlaub
  922. Class: PUBLIC\n"
  923. "&%%(and (diary-cyclic 1 21 12 2001) (diary-block 21 12 2001 29 12 2001)) Urlaub
  924. Class: PUBLIC\n"
  925. "&%%(and (diary-cyclic 1 12 21 2001) (diary-block 12 21 2001 12 29 2001)) Urlaub
  926. Class: PUBLIC\n"))
  927. (ert-deftest icalendar-import-bug-6766 ()
  928. ;;bug#6766 -- multiple byday values in a weekly rrule
  929. (icalendar-tests--test-import
  930. "CLASS:PUBLIC
  931. DTEND;TZID=America/New_York:20100421T120000
  932. DTSTAMP:20100525T141214Z
  933. DTSTART;TZID=America/New_York:20100421T113000
  934. RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=MO,WE,TH,FR
  935. SEQUENCE:1
  936. STATUS:CONFIRMED
  937. SUMMARY:Scrum
  938. TRANSP:OPAQUE
  939. UID:8814e3f9-7482-408f-996c-3bfe486a1262
  940. END:VEVENT
  941. BEGIN:VEVENT
  942. CLASS:PUBLIC
  943. DTSTAMP:20100525T141214Z
  944. DTSTART;VALUE=DATE:20100422
  945. DTEND;VALUE=DATE:20100423
  946. RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=TU,TH
  947. SEQUENCE:1
  948. SUMMARY:Tues + Thurs thinking
  949. TRANSP:OPAQUE
  950. UID:8814e3f9-7482-408f-996c-3bfe486a1263
  951. "
  952. "&%%(and (memq (calendar-day-of-week date) '(1 3 4 5)) (diary-cyclic 1 2010 4 21)) 11:30-12:00 Scrum
  953. Status: CONFIRMED
  954. Class: PUBLIC
  955. &%%(and (memq (calendar-day-of-week date) '(2 4)) (diary-cyclic 1 2010 4 22)) Tues + Thurs thinking
  956. Class: PUBLIC
  957. "
  958. "&%%(and (memq (calendar-day-of-week date) '(1 3 4 5)) (diary-cyclic 1 21 4 2010)) 11:30-12:00 Scrum
  959. Status: CONFIRMED
  960. Class: PUBLIC
  961. &%%(and (memq (calendar-day-of-week date) '(2 4)) (diary-cyclic 1 22 4 2010)) Tues + Thurs thinking
  962. Class: PUBLIC
  963. "
  964. "&%%(and (memq (calendar-day-of-week date) '(1 3 4 5)) (diary-cyclic 1 4 21 2010)) 11:30-12:00 Scrum
  965. Status: CONFIRMED
  966. Class: PUBLIC
  967. &%%(and (memq (calendar-day-of-week date) '(2 4)) (diary-cyclic 1 4 22 2010)) Tues + Thurs thinking
  968. Class: PUBLIC
  969. "))
  970. (ert-deftest icalendar-import-multiple-vcalendars ()
  971. (icalendar-tests--test-import
  972. "DTSTART;VALUE=DATE:20110723
  973. SUMMARY:event-1
  974. "
  975. "&2011/7/23 event-1\n"
  976. "&23/7/2011 event-1\n"
  977. "&7/23/2011 event-1\n")
  978. (icalendar-tests--test-import
  979. "BEGIN:VCALENDAR
  980. PRODID:-//Emacs//NONSGML icalendar.el//EN
  981. VERSION:2.0\nBEGIN:VEVENT
  982. DTSTART;VALUE=DATE:20110723
  983. SUMMARY:event-1
  984. END:VEVENT
  985. END:VCALENDAR
  986. BEGIN:VCALENDAR
  987. PRODID:-//Emacs//NONSGML icalendar.el//EN
  988. VERSION:2.0
  989. BEGIN:VEVENT
  990. DTSTART;VALUE=DATE:20110724
  991. SUMMARY:event-2
  992. END:VEVENT
  993. END:VCALENDAR
  994. BEGIN:VCALENDAR
  995. PRODID:-//Emacs//NONSGML icalendar.el//EN
  996. VERSION:2.0
  997. BEGIN:VEVENT
  998. DTSTART;VALUE=DATE:20110725
  999. SUMMARY:event-3a
  1000. END:VEVENT
  1001. BEGIN:VEVENT
  1002. DTSTART;VALUE=DATE:20110725
  1003. SUMMARY:event-3b
  1004. END:VEVENT
  1005. END:VCALENDAR
  1006. "
  1007. "&2011/7/23 event-1\n&2011/7/24 event-2\n&2011/7/25 event-3a\n&2011/7/25 event-3b\n"
  1008. "&23/7/2011 event-1\n&24/7/2011 event-2\n&25/7/2011 event-3a\n&25/7/2011 event-3b\n"
  1009. "&7/23/2011 event-1\n&7/24/2011 event-2\n&7/25/2011 event-3a\n&7/25/2011 event-3b\n"))
  1010. ;; ======================================================================
  1011. ;; Cycle
  1012. ;; ======================================================================
  1013. (defun icalendar-tests--test-cycle (input)
  1014. "Perform cycle test.
  1015. Argument INPUT icalendar event string."
  1016. (with-temp-buffer
  1017. (if (string-match "^BEGIN:VCALENDAR" input)
  1018. (insert input)
  1019. (insert "BEGIN:VCALENDAR\nPRODID:-//Emacs//NONSGML icalendar.el//EN\n")
  1020. (insert "VERSION:2.0\nBEGIN:VEVENT\n")
  1021. (insert input)
  1022. (unless (eq (char-before) ?\n)
  1023. (insert "\n"))
  1024. (insert "END:VEVENT\nEND:VCALENDAR\n"))
  1025. (let ((icalendar-import-format "%s%d%l%o%t%u%c")
  1026. (icalendar-import-format-summary "%s")
  1027. (icalendar-import-format-location "\n Location: %s")
  1028. (icalendar-import-format-description "\n Desc: %s")
  1029. (icalendar-import-format-organizer "\n Organizer: %s")
  1030. (icalendar-import-format-status "\n Status: %s")
  1031. (icalendar-import-format-url "\n URL: %s")
  1032. (icalendar-import-format-class "\n Class: %s"))
  1033. (dolist (calendar-date-style '(iso european american))
  1034. (icalendar-tests--do-test-cycle)))))
  1035. (defun icalendar-tests--do-test-cycle ()
  1036. "Actually perform import/export cycle test."
  1037. (let ((temp-diary (make-temp-file "icalendar-test-diary"))
  1038. (temp-ics (make-temp-file "icalendar-test-ics"))
  1039. (org-input (buffer-substring-no-properties (point-min) (point-max))))
  1040. (unwind-protect
  1041. (progn
  1042. ;; step 1: import
  1043. (icalendar-import-buffer temp-diary t t)
  1044. ;; step 2: export what was just imported
  1045. (save-excursion
  1046. (find-file temp-diary)
  1047. (icalendar-export-region (point-min) (point-max) temp-ics))
  1048. ;; compare the output of step 2 with the input of step 1
  1049. (save-excursion
  1050. (find-file temp-ics)
  1051. (goto-char (point-min))
  1052. (when (re-search-forward "\nUID:.*\n" nil t)
  1053. (replace-match "\n"))
  1054. (let ((cycled (buffer-substring-no-properties (point-min) (point-max))))
  1055. (should (string= org-input cycled)))))
  1056. ;; clean up
  1057. (kill-buffer (find-buffer-visiting temp-diary))
  1058. (save-excursion
  1059. (set-buffer (find-buffer-visiting temp-ics))
  1060. (set-buffer-modified-p nil)
  1061. (kill-buffer (current-buffer)))
  1062. (delete-file temp-diary)
  1063. (delete-file temp-ics))))
  1064. (ert-deftest icalendar-cycle ()
  1065. "Perform cycling tests."
  1066. (icalendar-tests--test-cycle
  1067. "DTSTART;VALUE=DATE-TIME:20030919T090000
  1068. DTEND;VALUE=DATE-TIME:20030919T113000
  1069. SUMMARY:Cycletest
  1070. ")
  1071. (icalendar-tests--test-cycle
  1072. "DTSTART;VALUE=DATE-TIME:20030919T090000
  1073. DTEND;VALUE=DATE-TIME:20030919T113000
  1074. SUMMARY:Cycletest
  1075. DESCRIPTION:beschreibung!
  1076. LOCATION:nowhere
  1077. ORGANIZER:ulf
  1078. ")
  1079. (icalendar-tests--test-cycle
  1080. "DTSTART;VALUE=DATE:19190909
  1081. DTEND;VALUE=DATE:19190910
  1082. RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=09;BYMONTHDAY=09
  1083. SUMMARY:and diary-anniversary
  1084. "))
  1085. ;; ======================================================================
  1086. ;; Real world
  1087. ;; ======================================================================
  1088. (ert-deftest icalendar-real-world ()
  1089. "Perform real-world tests, as gathered from problem reports."
  1090. ;; 2003-05-29
  1091. (icalendar-tests--test-import
  1092. "BEGIN:VCALENDAR
  1093. METHOD:REQUEST
  1094. PRODID:Microsoft CDO for Microsoft Exchange
  1095. VERSION:2.0
  1096. BEGIN:VTIMEZONE
  1097. TZID:Kolkata\, Chennai\, Mumbai\, New Delhi
  1098. X-MICROSOFT-CDO-TZID:23
  1099. BEGIN:STANDARD
  1100. DTSTART:16010101T000000
  1101. TZOFFSETFROM:+0530
  1102. TZOFFSETTO:+0530
  1103. END:STANDARD
  1104. BEGIN:DAYLIGHT
  1105. DTSTART:16010101T000000
  1106. TZOFFSETFROM:+0530
  1107. TZOFFSETTO:+0530
  1108. END:DAYLIGHT
  1109. END:VTIMEZONE
  1110. BEGIN:VEVENT
  1111. DTSTAMP:20030509T043439Z
  1112. DTSTART;TZID=\"Kolkata, Chennai, Mumbai, New Delhi\":20030509T103000
  1113. SUMMARY:On-Site Interview
  1114. UID:040000008200E00074C5B7101A82E0080000000080B6DE661216C301000000000000000
  1115. 010000000DB823520692542408ED02D7023F9DFF9
  1116. ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=\"Xxxxx
  1117. xxx Xxxxxxxxxxxx\":MAILTO:xxxxxxxx@xxxxxxx.com
  1118. ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=\"Yyyyyyy Y
  1119. yyyy\":MAILTO:yyyyyyy@yyyyyyy.com
  1120. ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=\"Zzzz Zzzz
  1121. zz\":MAILTO:zzzzzz@zzzzzzz.com
  1122. ORGANIZER;CN=\"Aaaaaa Aaaaa\":MAILTO:aaaaaaa@aaaaaaa.com
  1123. LOCATION:Cccc
  1124. DTEND;TZID=\"Kolkata, Chennai, Mumbai, New Delhi\":20030509T153000
  1125. DESCRIPTION:10:30am - Blah
  1126. SEQUENCE:0
  1127. PRIORITY:5
  1128. CLASS:
  1129. CREATED:20030509T043439Z
  1130. LAST-MODIFIED:20030509T043459Z
  1131. STATUS:CONFIRMED
  1132. TRANSP:OPAQUE
  1133. X-MICROSOFT-CDO-BUSYSTATUS:BUSY
  1134. X-MICROSOFT-CDO-INSTTYPE:0
  1135. X-MICROSOFT-CDO-INTENDEDSTATUS:BUSY
  1136. X-MICROSOFT-CDO-ALLDAYEVENT:FALSE
  1137. X-MICROSOFT-CDO-IMPORTANCE:1
  1138. X-MICROSOFT-CDO-OWNERAPPTID:126441427
  1139. BEGIN:VALARM
  1140. ACTION:DISPLAY
  1141. DESCRIPTION:REMINDER
  1142. TRIGGER;RELATED=START:-PT00H15M00S
  1143. END:VALARM
  1144. END:VEVENT
  1145. END:VCALENDAR"
  1146. nil
  1147. "&9/5/2003 10:30-15:30 On-Site Interview
  1148. Desc: 10:30am - Blah
  1149. Location: Cccc
  1150. Organizer: MAILTO:aaaaaaa@aaaaaaa.com
  1151. Status: CONFIRMED
  1152. "
  1153. "&5/9/2003 10:30-15:30 On-Site Interview
  1154. Desc: 10:30am - Blah
  1155. Location: Cccc
  1156. Organizer: MAILTO:aaaaaaa@aaaaaaa.com
  1157. Status: CONFIRMED
  1158. ")
  1159. ;; 2003-06-18 a
  1160. (icalendar-tests--test-import
  1161. "DTSTAMP:20030618T195512Z
  1162. DTSTART;TZID=\"Mountain Time (US & Canada)\":20030623T110000
  1163. SUMMARY:Dress Rehearsal for XXXX-XXXX
  1164. UID:040000008200E00074C5B7101A82E00800000000608AA7DA9835C301000000000000000
  1165. 0100000007C3A6D65EE726E40B7F3D69A23BD567E
  1166. ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=\"AAAAA,AAA
  1167. AA (A-AAAAAAA,ex1)\":MAILTO:aaaaa_aaaaa@aaaaa.com
  1168. ORGANIZER;CN=\"ABCD,TECHTRAINING
  1169. (A-Americas,exgen1)\":MAILTO:xxx@xxxxx.com
  1170. LOCATION:555 or TN 555-5555 ID 5555 & NochWas (see below)
  1171. DTEND;TZID=\"Mountain Time (US & Canada)\":20030623T120000
  1172. DESCRIPTION:753 Zeichen hier radiert
  1173. SEQUENCE:0
  1174. PRIORITY:5
  1175. CLASS:
  1176. CREATED:20030618T195518Z
  1177. LAST-MODIFIED:20030618T195527Z
  1178. STATUS:CONFIRMED
  1179. TRANSP:OPAQUE
  1180. X-MICROSOFT-CDO-BUSYSTATUS:BUSY
  1181. X-MICROSOFT-CDO-INSTTYPE:0
  1182. X-MICROSOFT-CDO-INTENDEDSTATUS:BUSY
  1183. X-MICROSOFT-CDO-ALLDAYEVENT:FALSE
  1184. X-MICROSOFT-CDO-IMPORTANCE:1
  1185. X-MICROSOFT-CDO-OWNERAPPTID:1022519251
  1186. BEGIN:VALARM
  1187. ACTION:DISPLAY
  1188. DESCRIPTION:REMINDER
  1189. TRIGGER;RELATED=START:-PT00H15M00S
  1190. END:VALARM"
  1191. nil
  1192. "&23/6/2003 11:00-12:00 Dress Rehearsal for XXXX-XXXX
  1193. Desc: 753 Zeichen hier radiert
  1194. Location: 555 or TN 555-5555 ID 5555 & NochWas (see below)
  1195. Organizer: MAILTO:xxx@xxxxx.com
  1196. Status: CONFIRMED
  1197. "
  1198. "&6/23/2003 11:00-12:00 Dress Rehearsal for XXXX-XXXX
  1199. Desc: 753 Zeichen hier radiert
  1200. Location: 555 or TN 555-5555 ID 5555 & NochWas (see below)
  1201. Organizer: MAILTO:xxx@xxxxx.com
  1202. Status: CONFIRMED
  1203. ")
  1204. ;; 2003-06-18 b -- uses timezone
  1205. (icalendar-tests--test-import
  1206. "BEGIN:VCALENDAR
  1207. METHOD:REQUEST
  1208. PRODID:Microsoft CDO for Microsoft Exchange
  1209. VERSION:2.0
  1210. BEGIN:VTIMEZONE
  1211. TZID:Mountain Time (US & Canada)
  1212. X-MICROSOFT-CDO-TZID:12
  1213. BEGIN:STANDARD
  1214. DTSTART:16010101T020000
  1215. TZOFFSETFROM:-0600
  1216. TZOFFSETTO:-0700
  1217. RRULE:FREQ=YEARLY;WKST=MO;INTERVAL=1;BYMONTH=10;BYDAY=-1SU
  1218. END:STANDARD
  1219. BEGIN:DAYLIGHT
  1220. DTSTART:16010101T020000
  1221. TZOFFSETFROM:-0700
  1222. TZOFFSETTO:-0600
  1223. RRULE:FREQ=YEARLY;WKST=MO;INTERVAL=1;BYMONTH=4;BYDAY=1SU
  1224. END:DAYLIGHT
  1225. END:VTIMEZONE
  1226. BEGIN:VEVENT
  1227. DTSTAMP:20030618T230323Z
  1228. DTSTART;TZID=\"Mountain Time (US & Canada)\":20030623T090000
  1229. SUMMARY:Updated: Dress Rehearsal for ABC01-15
  1230. UID:040000008200E00074C5B7101A82E00800000000608AA7DA9835C301000000000000000
  1231. 0100000007C3A6D65EE726E40B7F3D69A23BD567E
  1232. ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;X-REPLYTIME=20030618T20
  1233. 0700Z;RSVP=TRUE;CN=\"AAAAA,AAAAAA
  1234. \(A-AAAAAAA,ex1)\":MAILTO:aaaaaa_aaaaa@aaaaa
  1235. .com
  1236. ORGANIZER;CN=\"ABCD,TECHTRAINING
  1237. \(A-Americas,exgen1)\":MAILTO:bbb@bbbbb.com
  1238. LOCATION:123 or TN 123-1234 ID abcd & SonstWo (see below)
  1239. DTEND;TZID=\"Mountain Time (US & Canada)\":20030623T100000
  1240. DESCRIPTION:Viele Zeichen standen hier früher
  1241. SEQUENCE:0
  1242. PRIORITY:5
  1243. CLASS:
  1244. CREATED:20030618T230326Z
  1245. LAST-MODIFIED:20030618T230335Z
  1246. STATUS:CONFIRMED
  1247. TRANSP:OPAQUE
  1248. X-MICROSOFT-CDO-BUSYSTATUS:BUSY
  1249. X-MICROSOFT-CDO-INSTTYPE:0
  1250. X-MICROSOFT-CDO-INTENDEDSTATUS:BUSY
  1251. X-MICROSOFT-CDO-ALLDAYEVENT:FALSE
  1252. X-MICROSOFT-CDO-IMPORTANCE:1
  1253. X-MICROSOFT-CDO-OWNERAPPTID:1022519251
  1254. BEGIN:VALARM
  1255. ACTION:DISPLAY
  1256. DESCRIPTION:REMINDER
  1257. TRIGGER;RELATED=START:-PT00H15M00S
  1258. END:VALARM
  1259. END:VEVENT
  1260. END:VCALENDAR"
  1261. nil
  1262. "&23/6/2003 17:00-18:00 Updated: Dress Rehearsal for ABC01-15
  1263. Desc: Viele Zeichen standen hier früher
  1264. Location: 123 or TN 123-1234 ID abcd & SonstWo (see below)
  1265. Organizer: MAILTO:bbb@bbbbb.com
  1266. Status: CONFIRMED
  1267. "
  1268. "&6/23/2003 17:00-18:00 Updated: Dress Rehearsal for ABC01-15
  1269. Desc: Viele Zeichen standen hier früher
  1270. Location: 123 or TN 123-1234 ID abcd & SonstWo (see below)
  1271. Organizer: MAILTO:bbb@bbbbb.com
  1272. Status: CONFIRMED
  1273. ")
  1274. ;; export 2004-10-28 block entries
  1275. (icalendar-tests--test-export
  1276. nil
  1277. nil
  1278. "-*- mode: text; fill-column: 256;-*-
  1279. >>> block entries:
  1280. %%(diary-block 11 8 2004 11 10 2004) Nov 8-10 aa
  1281. "
  1282. "DTSTART;VALUE=DATE:20041108
  1283. DTEND;VALUE=DATE:20041111
  1284. SUMMARY:Nov 8-10 aa")
  1285. (icalendar-tests--test-export
  1286. nil
  1287. nil
  1288. "%%(diary-block 12 13 2004 12 17 2004) Dec 13-17 bb"
  1289. "DTSTART;VALUE=DATE:20041213
  1290. DTEND;VALUE=DATE:20041218
  1291. SUMMARY:Dec 13-17 bb")
  1292. (icalendar-tests--test-export
  1293. nil
  1294. nil
  1295. "%%(diary-block 2 3 2005 2 4 2005) Feb 3-4 cc"
  1296. "DTSTART;VALUE=DATE:20050203
  1297. DTEND;VALUE=DATE:20050205
  1298. SUMMARY:Feb 3-4 cc")
  1299. (icalendar-tests--test-export
  1300. nil
  1301. nil
  1302. "%%(diary-block 4 24 2005 4 29 2005) April 24-29 dd"
  1303. "DTSTART;VALUE=DATE:20050424
  1304. DTEND;VALUE=DATE:20050430
  1305. SUMMARY:April 24-29 dd
  1306. ")
  1307. (icalendar-tests--test-export
  1308. nil
  1309. nil
  1310. "%%(diary-block 5 30 2005 6 1 2005) may 30 - June 1: ee"
  1311. "DTSTART;VALUE=DATE:20050530
  1312. DTEND;VALUE=DATE:20050602
  1313. SUMMARY:may 30 - June 1: ee")
  1314. (icalendar-tests--test-export
  1315. nil
  1316. nil
  1317. "%%(diary-block 6 6 2005 6 8 2005) ff"
  1318. "DTSTART;VALUE=DATE:20050606
  1319. DTEND;VALUE=DATE:20050609
  1320. SUMMARY:ff")
  1321. ;; export 2004-10-28 anniversary entries
  1322. (icalendar-tests--test-export
  1323. nil
  1324. nil
  1325. "
  1326. >>> anniversaries:
  1327. %%(diary-anniversary 3 28 1991) aa birthday (%d years old)"
  1328. "DTSTART;VALUE=DATE:19910328
  1329. DTEND;VALUE=DATE:19910329
  1330. RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=03;BYMONTHDAY=28
  1331. SUMMARY:aa birthday (%d years old)
  1332. ")
  1333. (icalendar-tests--test-export
  1334. nil
  1335. nil
  1336. "%%(diary-anniversary 5 17 1957) bb birthday (%d years old)"
  1337. "DTSTART;VALUE=DATE:19570517
  1338. DTEND;VALUE=DATE:19570518
  1339. RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=05;BYMONTHDAY=17
  1340. SUMMARY:bb birthday (%d years old)")
  1341. (icalendar-tests--test-export
  1342. nil
  1343. nil
  1344. "%%(diary-anniversary 6 8 1997) cc birthday (%d years old)"
  1345. "DTSTART;VALUE=DATE:19970608
  1346. DTEND;VALUE=DATE:19970609
  1347. RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=06;BYMONTHDAY=08
  1348. SUMMARY:cc birthday (%d years old)")
  1349. (icalendar-tests--test-export
  1350. nil
  1351. nil
  1352. "%%(diary-anniversary 7 22 1983) dd (%d years ago...!)"
  1353. "DTSTART;VALUE=DATE:19830722
  1354. DTEND;VALUE=DATE:19830723
  1355. RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=07;BYMONTHDAY=22
  1356. SUMMARY:dd (%d years ago...!)")
  1357. (icalendar-tests--test-export
  1358. nil
  1359. nil
  1360. "%%(diary-anniversary 8 1 1988) ee birthday (%d years old)"
  1361. "DTSTART;VALUE=DATE:19880801
  1362. DTEND;VALUE=DATE:19880802
  1363. RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=08;BYMONTHDAY=01
  1364. SUMMARY:ee birthday (%d years old)")
  1365. (icalendar-tests--test-export
  1366. nil
  1367. nil
  1368. "%%(diary-anniversary 9 21 1957) ff birthday (%d years old)"
  1369. "DTSTART;VALUE=DATE:19570921
  1370. DTEND;VALUE=DATE:19570922
  1371. RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=09;BYMONTHDAY=21
  1372. SUMMARY:ff birthday (%d years old)")
  1373. ;; FIXME!
  1374. ;; export 2004-10-28 monthly, weekly entries
  1375. ;; (icalendar-tests--test-export
  1376. ;; nil
  1377. ;; "
  1378. ;; >>> ------------ monthly:
  1379. ;; */27/* 10:00 blah blah"
  1380. ;; "xxx")
  1381. (icalendar-tests--test-export
  1382. nil
  1383. nil
  1384. ">>> ------------ my week:
  1385. Monday 13:00 MAC"
  1386. "DTSTART;VALUE=DATE-TIME:20000103T130000
  1387. DTEND;VALUE=DATE-TIME:20000103T140000
  1388. RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=MO
  1389. SUMMARY:MAC")
  1390. (icalendar-tests--test-export
  1391. nil
  1392. nil
  1393. "Monday 15:00 a1"
  1394. "DTSTART;VALUE=DATE-TIME:20000103T150000
  1395. DTEND;VALUE=DATE-TIME:20000103T160000
  1396. RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=MO
  1397. SUMMARY:a1")
  1398. (icalendar-tests--test-export
  1399. nil
  1400. nil
  1401. "Monday 16:00-17:00 a2"
  1402. "DTSTART;VALUE=DATE-TIME:20000103T160000
  1403. DTEND;VALUE=DATE-TIME:20000103T170000
  1404. RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=MO
  1405. SUMMARY:a2")
  1406. (icalendar-tests--test-export
  1407. nil
  1408. nil
  1409. "Tuesday 11:30-13:00 a3"
  1410. "DTSTART;VALUE=DATE-TIME:20000104T113000
  1411. DTEND;VALUE=DATE-TIME:20000104T130000
  1412. RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=TU
  1413. SUMMARY:a3")
  1414. (icalendar-tests--test-export
  1415. nil
  1416. nil
  1417. "Tuesday 15:00 a4"
  1418. "DTSTART;VALUE=DATE-TIME:20000104T150000
  1419. DTEND;VALUE=DATE-TIME:20000104T160000
  1420. RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=TU
  1421. SUMMARY:a4")
  1422. (icalendar-tests--test-export
  1423. nil
  1424. nil
  1425. "Wednesday 13:00 a5"
  1426. "DTSTART;VALUE=DATE-TIME:20000105T130000
  1427. DTEND;VALUE=DATE-TIME:20000105T140000
  1428. RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=WE
  1429. SUMMARY:a5")
  1430. (icalendar-tests--test-export
  1431. nil
  1432. nil
  1433. "Wednesday 11:30-13:30 a6"
  1434. "DTSTART;VALUE=DATE-TIME:20000105T113000
  1435. DTEND;VALUE=DATE-TIME:20000105T133000
  1436. RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=WE
  1437. SUMMARY:a6")
  1438. (icalendar-tests--test-export
  1439. nil
  1440. nil
  1441. "Wednesday 15:00 s1"
  1442. "DTSTART;VALUE=DATE-TIME:20000105T150000
  1443. DTEND;VALUE=DATE-TIME:20000105T160000
  1444. RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=WE
  1445. SUMMARY:s1")
  1446. ;; export 2004-10-28 regular entries
  1447. (icalendar-tests--test-export
  1448. nil
  1449. nil
  1450. "
  1451. >>> regular diary entries:
  1452. Oct 12 2004, 14:00 Tue: [2004-10-12] q1"
  1453. "DTSTART;VALUE=DATE-TIME:20041012T140000
  1454. DTEND;VALUE=DATE-TIME:20041012T150000
  1455. SUMMARY:Tue: [2004-10-12] q1")
  1456. ;; 2004-11-19
  1457. (icalendar-tests--test-import
  1458. "BEGIN:VCALENDAR
  1459. VERSION
  1460. :2.0
  1461. PRODID
  1462. :-//Mozilla.org/NONSGML Mozilla Calendar V1.0//EN
  1463. BEGIN:VEVENT
  1464. UID
  1465. :04979712-3902-11d9-93dd-8f9f4afe08da
  1466. SUMMARY
  1467. :Jjjjj & Wwwww
  1468. STATUS
  1469. :TENTATIVE
  1470. CLASS
  1471. :PRIVATE
  1472. X-MOZILLA-ALARM-DEFAULT-LENGTH
  1473. :0
  1474. DTSTART
  1475. :20041123T140000
  1476. DTEND
  1477. :20041123T143000
  1478. DTSTAMP
  1479. :20041118T013430Z
  1480. LAST-MODIFIED
  1481. :20041118T013640Z
  1482. END:VEVENT
  1483. BEGIN:VEVENT
  1484. UID
  1485. :6161a312-3902-11d9-b512-f764153bb28b
  1486. SUMMARY
  1487. :BB Aaaaaaaa Bbbbb
  1488. STATUS
  1489. :TENTATIVE
  1490. CLASS
  1491. :PRIVATE
  1492. X-MOZILLA-ALARM-DEFAULT-LENGTH
  1493. :0
  1494. DTSTART
  1495. :20041123T144500
  1496. DTEND
  1497. :20041123T154500
  1498. DTSTAMP
  1499. :20041118T013641Z
  1500. END:VEVENT
  1501. BEGIN:VEVENT
  1502. UID
  1503. :943a4d7e-3902-11d9-9ce7-c9addeadf928
  1504. SUMMARY
  1505. :Hhhhhhhh
  1506. STATUS
  1507. :TENTATIVE
  1508. CLASS
  1509. :PRIVATE
  1510. X-MOZILLA-ALARM-DEFAULT-LENGTH
  1511. :0
  1512. DTSTART
  1513. :20041123T110000
  1514. DTEND
  1515. :20041123T120000
  1516. DTSTAMP
  1517. :20041118T013831Z
  1518. END:VEVENT
  1519. BEGIN:VEVENT
  1520. UID
  1521. :fe53615e-3902-11d9-9dd8-9d38a155bf41
  1522. SUMMARY
  1523. :MMM Aaaaaaaaa
  1524. STATUS
  1525. :TENTATIVE
  1526. CLASS
  1527. :PRIVATE
  1528. X-MOZILLA-ALARM-DEFAULT-LENGTH
  1529. :0
  1530. X-MOZILLA-RECUR-DEFAULT-INTERVAL
  1531. :2
  1532. RRULE
  1533. :FREQ=WEEKLY;INTERVAL=2;BYDAY=FR
  1534. DTSTART
  1535. :20041112T140000
  1536. DTEND
  1537. :20041112T183000
  1538. DTSTAMP
  1539. :20041118T014117Z
  1540. END:VEVENT
  1541. BEGIN:VEVENT
  1542. UID
  1543. :87c928ee-3901-11d9-b21f-b45042155024
  1544. SUMMARY
  1545. :Rrrr/Cccccc ii Aaaaaaaa
  1546. DESCRIPTION
  1547. :Vvvvv Rrrr aaa Cccccc
  1548. STATUS
  1549. :TENTATIVE
  1550. CLASS
  1551. :PRIVATE
  1552. X-MOZILLA-ALARM-DEFAULT-LENGTH
  1553. :0
  1554. DTSTART
  1555. ;VALUE=DATE
  1556. :20041119
  1557. DTEND
  1558. ;VALUE=DATE
  1559. :20041120
  1560. DTSTAMP
  1561. :20041118T013107Z
  1562. LAST-MODIFIED
  1563. :20041118T014203Z
  1564. END:VEVENT
  1565. BEGIN:VEVENT
  1566. UID
  1567. :e8f331ae-3902-11d9-9948-dfdcb66a2872
  1568. SUMMARY
  1569. :Wwww aa hhhh
  1570. STATUS
  1571. :TENTATIVE
  1572. CLASS
  1573. :PRIVATE
  1574. X-MOZILLA-ALARM-DEFAULT-LENGTH
  1575. :0
  1576. RRULE
  1577. :FREQ=WEEKLY;INTERVAL=1;BYDAY=MO
  1578. DTSTART
  1579. ;VALUE=DATE
  1580. :20041101
  1581. DTEND
  1582. ;VALUE=DATE
  1583. :20041102
  1584. DTSTAMP
  1585. :20041118T014045Z
  1586. LAST-MODIFIED
  1587. :20041118T023846Z
  1588. END:VEVENT
  1589. END:VCALENDAR
  1590. "
  1591. nil
  1592. "&23/11/2004 14:00-14:30 Jjjjj & Wwwww
  1593. Status: TENTATIVE
  1594. Class: PRIVATE
  1595. &23/11/2004 14:45-15:45 BB Aaaaaaaa Bbbbb
  1596. Status: TENTATIVE
  1597. Class: PRIVATE
  1598. &23/11/2004 11:00-12:00 Hhhhhhhh
  1599. Status: TENTATIVE
  1600. Class: PRIVATE
  1601. &%%(and (diary-cyclic 14 12 11 2004)) 14:00-18:30 MMM Aaaaaaaaa
  1602. Status: TENTATIVE
  1603. Class: PRIVATE
  1604. &%%(and (diary-block 19 11 2004 19 11 2004)) Rrrr/Cccccc ii Aaaaaaaa
  1605. Desc: Vvvvv Rrrr aaa Cccccc
  1606. Status: TENTATIVE
  1607. Class: PRIVATE
  1608. &%%(and (diary-cyclic 7 1 11 2004)) Wwww aa hhhh
  1609. Status: TENTATIVE
  1610. Class: PRIVATE
  1611. "
  1612. "&11/23/2004 14:00-14:30 Jjjjj & Wwwww
  1613. Status: TENTATIVE
  1614. Class: PRIVATE
  1615. &11/23/2004 14:45-15:45 BB Aaaaaaaa Bbbbb
  1616. Status: TENTATIVE
  1617. Class: PRIVATE
  1618. &11/23/2004 11:00-12:00 Hhhhhhhh
  1619. Status: TENTATIVE
  1620. Class: PRIVATE
  1621. &%%(and (diary-cyclic 14 11 12 2004)) 14:00-18:30 MMM Aaaaaaaaa
  1622. Status: TENTATIVE
  1623. Class: PRIVATE
  1624. &%%(and (diary-block 11 19 2004 11 19 2004)) Rrrr/Cccccc ii Aaaaaaaa
  1625. Desc: Vvvvv Rrrr aaa Cccccc
  1626. Status: TENTATIVE
  1627. Class: PRIVATE
  1628. &%%(and (diary-cyclic 7 11 1 2004)) Wwww aa hhhh
  1629. Status: TENTATIVE
  1630. Class: PRIVATE
  1631. ")
  1632. ;; 2004-09-09 pg
  1633. (icalendar-tests--test-export
  1634. "%%(diary-block 1 1 2004 4 1 2004) Urlaub"
  1635. nil
  1636. nil
  1637. "DTSTART;VALUE=DATE:20040101
  1638. DTEND;VALUE=DATE:20040105
  1639. SUMMARY:Urlaub")
  1640. ;; 2004-10-25 pg
  1641. (icalendar-tests--test-export
  1642. nil
  1643. "5 11 2004 Bla Fasel"
  1644. nil
  1645. "DTSTART;VALUE=DATE:20041105
  1646. DTEND;VALUE=DATE:20041106
  1647. SUMMARY:Bla Fasel")
  1648. ;; 2004-10-30 pg
  1649. (icalendar-tests--test-export
  1650. nil
  1651. "2 Nov 2004 15:00-16:30 Zahnarzt"
  1652. nil
  1653. "DTSTART;VALUE=DATE-TIME:20041102T150000
  1654. DTEND;VALUE=DATE-TIME:20041102T163000
  1655. SUMMARY:Zahnarzt")
  1656. ;; 2005-02-07 lt
  1657. (icalendar-tests--test-import
  1658. "UID
  1659. :b60d398e-1dd1-11b2-a159-cf8cb05139f4
  1660. SUMMARY
  1661. :Waitangi Day
  1662. DESCRIPTION
  1663. :abcdef
  1664. CATEGORIES
  1665. :Public Holiday
  1666. STATUS
  1667. :CONFIRMED
  1668. CLASS
  1669. :PRIVATE
  1670. DTSTART
  1671. ;VALUE=DATE
  1672. :20050206
  1673. DTEND
  1674. ;VALUE=DATE
  1675. :20050207
  1676. DTSTAMP
  1677. :20050128T011209Z"
  1678. nil
  1679. "&%%(and (diary-block 6 2 2005 6 2 2005)) Waitangi Day
  1680. Desc: abcdef
  1681. Status: CONFIRMED
  1682. Class: PRIVATE
  1683. "
  1684. "&%%(and (diary-block 2 6 2005 2 6 2005)) Waitangi Day
  1685. Desc: abcdef
  1686. Status: CONFIRMED
  1687. Class: PRIVATE
  1688. ")
  1689. ;; 2005-03-01 lt
  1690. (icalendar-tests--test-import
  1691. "DTSTART;VALUE=DATE:20050217
  1692. SUMMARY:Hhhhhh Aaaaa ii Aaaaaaaa
  1693. UID:6AFA7558-6994-11D9-8A3A-000A95A0E830-RID
  1694. DTSTAMP:20050118T210335Z
  1695. DURATION:P7D"
  1696. nil
  1697. "&%%(and (diary-block 17 2 2005 23 2 2005)) Hhhhhh Aaaaa ii Aaaaaaaa\n"
  1698. "&%%(and (diary-block 2 17 2005 2 23 2005)) Hhhhhh Aaaaa ii Aaaaaaaa\n")
  1699. ;; 2005-03-23 lt
  1700. (icalendar-tests--test-export
  1701. nil
  1702. "&%%(diary-cyclic 7 8 2 2005) 16:00-16:45 [WORK] Pppp"
  1703. nil
  1704. "DTSTART;VALUE=DATE-TIME:20050208T160000
  1705. DTEND;VALUE=DATE-TIME:20050208T164500
  1706. RRULE:FREQ=DAILY;INTERVAL=7
  1707. SUMMARY:[WORK] Pppp
  1708. ")
  1709. ;; 2005-05-27 eu
  1710. (icalendar-tests--test-export
  1711. nil
  1712. nil
  1713. ;; FIXME: colon not allowed!
  1714. ;;"Nov 1: NNN Wwwwwwww Wwwww - Aaaaaa Pppppppp rrrrrr ddd oo Nnnnnnnn 30"
  1715. "Nov 1 NNN Wwwwwwww Wwwww - Aaaaaa Pppppppp rrrrrr ddd oo Nnnnnnnn 30"
  1716. "DTSTART;VALUE=DATE:19001101
  1717. DTEND;VALUE=DATE:19001102
  1718. RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=11;BYMONTHDAY=1
  1719. SUMMARY:NNN Wwwwwwww Wwwww - Aaaaaa Pppppppp rrrrrr ddd oo Nnnnnnnn 30
  1720. ")
  1721. )
  1722. (provide 'icalendar-tests)
  1723. ;;; icalendar-tests.el ends here