mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2025-01-12 16:23:57 +00:00
Fixed bug#5549 (icalendar.el)
This commit is contained in:
parent
e3670e004d
commit
b4340b3f0b
@ -1,3 +1,13 @@
|
||||
2010-02-19 Ulf Jasper <ulf.jasper@web.de>
|
||||
|
||||
* calendar/icalendar.el (icalendar--convert-ordinary-to-ical)
|
||||
(icalendar--convert-weekly-to-ical)
|
||||
(icalendar--convert-yearly-to-ical)
|
||||
(icalendar--convert-block-to-ical)
|
||||
(icalendar--convert-cyclic-to-ical)
|
||||
(icalendar--convert-anniversary-to-ical): Take care of time
|
||||
specifications where hour has 1-digit only (Bug#5549).
|
||||
|
||||
2010-02-19 Nick Roberts <nickrob@snap.net.nz>
|
||||
|
||||
* progmodes/gdb-ui.el (gdb-assembler-handler): Accommodate change
|
||||
|
@ -1175,9 +1175,9 @@ entries. ENTRY-MAIN is the first line of the diary entry."
|
||||
(if (string-match
|
||||
(concat nonmarker
|
||||
"\\([^ /]+[ /]+[^ /]+[ /]+[^ ]+\\)\\s-*" ; date
|
||||
"\\(0?\\([1-9][0-9]?:[0-9][0-9]\\)\\([ap]m\\)?" ; start time
|
||||
"\\(\\([0-9][0-9]?:[0-9][0-9]\\)\\([ap]m\\)?" ; start time
|
||||
"\\("
|
||||
"-0?\\([1-9][0-9]?:[0-9][0-9]\\)\\([ap]m\\)?\\)?" ; end time
|
||||
"-\\([0-9][0-9]?:[0-9][0-9]\\)\\([ap]m\\)?\\)?" ; end time
|
||||
"\\)?"
|
||||
"\\s-*\\(.*?\\) ?$")
|
||||
entry-main)
|
||||
@ -1271,10 +1271,10 @@ NONMARKER is a regular expression matching the start of non-marking
|
||||
entries. ENTRY-MAIN is the first line of the diary entry."
|
||||
(if (and (string-match (concat nonmarker
|
||||
"\\([a-z]+\\)\\s-+"
|
||||
"\\(0?\\([1-9][0-9]?:[0-9][0-9]\\)"
|
||||
"\\(\\([0-9][0-9]?:[0-9][0-9]\\)"
|
||||
"\\([ap]m\\)?"
|
||||
"\\(-0?"
|
||||
"\\([1-9][0-9]?:[0-9][0-9]\\)"
|
||||
"\\(-"
|
||||
"\\([0-9][0-9]?:[0-9][0-9]\\)"
|
||||
"\\([ap]m\\)?\\)?"
|
||||
"\\)?"
|
||||
"\\s-*\\(.*?\\) ?$")
|
||||
@ -1353,12 +1353,12 @@ NONMARKER is a regular expression matching the start of non-marking
|
||||
entries. ENTRY-MAIN is the first line of the diary entry."
|
||||
(if (string-match (concat nonmarker
|
||||
(if (eq (icalendar--date-style) 'european)
|
||||
"0?\\([1-9]+[0-9]?\\)\\s-+\\([a-z]+\\)\\s-+"
|
||||
"\\([a-z]+\\)\\s-+0?\\([1-9]+[0-9]?\\)\\s-+")
|
||||
"\\([0-9]+[0-9]?\\)\\s-+\\([a-z]+\\)\\s-+"
|
||||
"\\([a-z]+\\)\\s-+\\([0-9]+[0-9]?\\)\\s-+")
|
||||
"\\*?\\s-*"
|
||||
"\\(0?\\([1-9][0-9]?:[0-9][0-9]\\)\\([ap]m\\)?"
|
||||
"\\(\\([0-9][0-9]?:[0-9][0-9]\\)\\([ap]m\\)?"
|
||||
"\\("
|
||||
"-0?\\([1-9][0-9]?:[0-9][0-9]\\)\\([ap]m\\)?\\)?"
|
||||
"-\\([0-9][0-9]?:[0-9][0-9]\\)\\([ap]m\\)?\\)?"
|
||||
"\\)?"
|
||||
"\\s-*\\([^0-9]+.*?\\) ?$" ; must not match years
|
||||
)
|
||||
@ -1461,9 +1461,9 @@ entries. ENTRY-MAIN is the first line of the diary entry."
|
||||
(if (string-match (concat nonmarker
|
||||
"%%(diary-block \\([^ /]+[ /]+[^ /]+[ /]+[^ ]+\\)"
|
||||
" +\\([^ /]+[ /]+[^ /]+[ /]+[^ ]+\\))\\s-*"
|
||||
"\\(0?\\([1-9][0-9]?:[0-9][0-9]\\)\\([ap]m\\)?"
|
||||
"\\(\\([0-9][0-9]?:[0-9][0-9]\\)\\([ap]m\\)?"
|
||||
"\\("
|
||||
"-0?\\([1-9][0-9]?:[0-9][0-9]\\)\\([ap]m\\)?\\)?"
|
||||
"-\\([0-9][0-9]?:[0-9][0-9]\\)\\([ap]m\\)?\\)?"
|
||||
"\\)?"
|
||||
"\\s-*\\(.*?\\) ?$")
|
||||
entry-main)
|
||||
@ -1569,9 +1569,9 @@ entries. ENTRY-MAIN is the first line of the diary entry."
|
||||
(if (string-match (concat nonmarker
|
||||
"%%(diary-cyclic \\([^ ]+\\) +"
|
||||
"\\([^ /]+[ /]+[^ /]+[ /]+[^ ]+\\))\\s-*"
|
||||
"\\(0?\\([1-9][0-9]?:[0-9][0-9]\\)\\([ap]m\\)?"
|
||||
"\\(\\([0-9][0-9]?:[0-9][0-9]\\)\\([ap]m\\)?"
|
||||
"\\("
|
||||
"-0?\\([1-9][0-9]?:[0-9][0-9]\\)\\([ap]m\\)?\\)?"
|
||||
"-\\([0-9][0-9]?:[0-9][0-9]\\)\\([ap]m\\)?\\)?"
|
||||
"\\)?"
|
||||
"\\s-*\\(.*?\\) ?$")
|
||||
entry-main)
|
||||
@ -1642,9 +1642,9 @@ NONMARKER is a regular expression matching the start of non-marking
|
||||
entries. ENTRY-MAIN is the first line of the diary entry."
|
||||
(if (string-match (concat nonmarker
|
||||
"%%(diary-anniversary \\([^)]+\\))\\s-*"
|
||||
"\\(0?\\([1-9][0-9]?:[0-9][0-9]\\)\\([ap]m\\)?"
|
||||
"\\(\\([0-9][0-9]?:[0-9][0-9]\\)\\([ap]m\\)?"
|
||||
"\\("
|
||||
"-0?\\([1-9][0-9]?:[0-9][0-9]\\)\\([ap]m\\)?\\)?"
|
||||
"-\\([0-9][0-9]?:[0-9][0-9]\\)\\([ap]m\\)?\\)?"
|
||||
"\\)?"
|
||||
"\\s-*\\(.*?\\) ?$")
|
||||
entry-main)
|
||||
|
@ -1,3 +1,16 @@
|
||||
2010-02-19 Ulf Jasper <ulf.jasper@web.de>
|
||||
|
||||
* icalendar-testsuite.el
|
||||
(icalendar-testsuite--run-function-tests): Added new tests.
|
||||
(icalendar-testsuite--test-diarytime-to-isotime): Added another
|
||||
testcase.
|
||||
(icalendar-testsuite--test-convert-ordinary-to-ical): New.
|
||||
(icalendar-testsuite--test-convert-weekly-to-ical): New.
|
||||
(icalendar-testsuite--test-convert-yearly-to-ical): New.
|
||||
(icalendar-testsuite--test-convert-block-to-ical): New.
|
||||
(icalendar-testsuite--test-convert-cyclic-to-ical): New.
|
||||
(icalendar-testsuite--test-convert-anniversary-to-ical): New.
|
||||
|
||||
2010-01-18 Juanma Barranquero <lekktu@gmail.com>
|
||||
|
||||
* cedet/semantic-tests.el (semanticdb-test-gnu-global)
|
||||
|
@ -52,6 +52,12 @@
|
||||
(icalendar-testsuite--test-datestring-to-isodate)
|
||||
(icalendar-testsuite--test-datetime-to-diary-date)
|
||||
(icalendar-testsuite--test-diarytime-to-isotime)
|
||||
(icalendar-testsuite--test-convert-ordinary-to-ical)
|
||||
(icalendar-testsuite--test-convert-weekly-to-ical)
|
||||
(icalendar-testsuite--test-convert-yearly-to-ical)
|
||||
(icalendar-testsuite--test-convert-block-to-ical)
|
||||
(icalendar-testsuite--test-convert-cyclic-to-ical)
|
||||
(icalendar-testsuite--test-convert-anniversary-to-ical)
|
||||
(icalendar-testsuite--test-calendar-style)
|
||||
(icalendar-testsuite--test-create-uid)
|
||||
(icalendar-testsuite--test-parse-vtimezone))
|
||||
@ -213,6 +219,12 @@ END:VEVENT
|
||||
|
||||
(defun icalendar-testsuite--test-diarytime-to-isotime ()
|
||||
"Test method for `icalendar--diarytime-to-isotime'."
|
||||
(assert (string= (icalendar--diarytime-to-isotime "01:15" "")
|
||||
"T011500"))
|
||||
(assert (string= (icalendar--diarytime-to-isotime "1:15" "")
|
||||
"T011500"))
|
||||
(assert (string= (icalendar--diarytime-to-isotime "0:01" "")
|
||||
"T000100"))
|
||||
(assert (string= (icalendar--diarytime-to-isotime "0100" "")
|
||||
"T010000"))
|
||||
(assert (string= (icalendar--diarytime-to-isotime "0100" "am")
|
||||
@ -236,6 +248,106 @@ END:VEVENT
|
||||
(assert (string= (icalendar--diarytime-to-isotime "1259" "pm")
|
||||
"T125900")))
|
||||
|
||||
(defun icalendar-testsuite--test-convert-ordinary-to-ical ()
|
||||
"Test method for `icalendar--convert-ordinary-to-ical'."
|
||||
(let* ((calendar-date-style 'iso)
|
||||
result)
|
||||
;; without time
|
||||
(setq result (icalendar--convert-ordinary-to-ical "&?" "2010 2 15 subject"))
|
||||
(assert (= 2 (length result)))
|
||||
(assert (string= "\nDTSTART;VALUE=DATE:20100215\nDTEND;VALUE=DATE:20100216"
|
||||
(car result)))
|
||||
(assert (string= "subject" (cadr result)))
|
||||
|
||||
;; with time
|
||||
(setq result (icalendar--convert-ordinary-to-ical
|
||||
"&?" "&2010 2 15 12:34-23:45 s"))
|
||||
(assert (= 2 (length result)))
|
||||
(assert (string= (concat "\nDTSTART;VALUE=DATE-TIME:20100215T123400"
|
||||
"\nDTEND;VALUE=DATE-TIME:20100215T234500")
|
||||
(car result)))
|
||||
(assert (string= "s" (cadr result)))
|
||||
|
||||
;; with time, again -- test bug#5549
|
||||
(setq result (icalendar--convert-ordinary-to-ical
|
||||
"x?" "x2010 2 15 0:34-1:45 s"))
|
||||
(assert (= 2 (length result)))
|
||||
(assert (string= (concat "\nDTSTART;VALUE=DATE-TIME:20100215T003400"
|
||||
"\nDTEND;VALUE=DATE-TIME:20100215T014500")
|
||||
(car result)))
|
||||
(assert (string= "s" (cadr result)))))
|
||||
|
||||
(defun icalendar-testsuite--test-convert-weekly-to-ical ()
|
||||
"Test method for `icalendar--convert-weekly-to-ical'."
|
||||
(let* ((calendar-date-style 'iso)
|
||||
result
|
||||
(calendar-day-name-array
|
||||
["Sunday" "Monday" "Tuesday" "Wednesday" "Thursday" "Friday"
|
||||
"Saturday"]))
|
||||
(setq result (icalendar--convert-weekly-to-ical "" "Monday 8:30 subject"))
|
||||
(assert (= 2 (length result)))
|
||||
(assert (string= (concat "\nDTSTART;VALUE=DATE-TIME:20050103T083000"
|
||||
"\nDTEND;VALUE=DATE-TIME:20050103T093000"
|
||||
"\nRRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=MO")
|
||||
(car result)))
|
||||
(assert (string= "subject" (cadr result)))))
|
||||
|
||||
(defun icalendar-testsuite--test-convert-yearly-to-ical ()
|
||||
"Test method for `icalendar--convert-yearly-to-ical'."
|
||||
(let* ((calendar-date-style 'iso)
|
||||
result
|
||||
(calendar-month-name-array
|
||||
["January" "February" "March" "April" "May" "June" "July" "August"
|
||||
"September" "October" "November" "December"]))
|
||||
(setq result (icalendar--convert-yearly-to-ical "" "May 1 Tag der Arbeit"))
|
||||
(assert (= 2 (length result)))
|
||||
(assert (string= (concat
|
||||
"\nDTSTART;VALUE=DATE:19000501"
|
||||
"\nDTEND;VALUE=DATE:19000502"
|
||||
"\nRRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=5;BYMONTHDAY=1")
|
||||
(car result)))
|
||||
(assert (string= "Tag der Arbeit" (cadr result)))))
|
||||
|
||||
(defun icalendar-testsuite--test-convert-block-to-ical ()
|
||||
"Test method for `icalendar--convert-block-to-ical'."
|
||||
(let* ((calendar-date-style 'iso)
|
||||
result)
|
||||
(setq result (icalendar--convert-block-to-ical
|
||||
"" "%%(diary-block 2004 7 19 2004 8 27) Sommerferien"))
|
||||
(assert (= 2 (length result)))
|
||||
(assert (string= (concat
|
||||
"\nDTSTART;VALUE=DATE:20040719"
|
||||
"\nDTEND;VALUE=DATE:20040828")
|
||||
(car result)))
|
||||
(assert (string= "Sommerferien" (cadr result)))))
|
||||
|
||||
(defun icalendar-testsuite--test-convert-cyclic-to-ical ()
|
||||
"Test method for `icalendar--convert-cyclic-to-ical'."
|
||||
(let* ((calendar-date-style 'iso)
|
||||
result)
|
||||
(setq result (icalendar--convert-block-to-ical
|
||||
"" "%%(diary-block 2004 7 19 2004 8 27) Sommerferien"))
|
||||
(assert (= 2 (length result)))
|
||||
(assert (string= (concat
|
||||
"\nDTSTART;VALUE=DATE:20040719"
|
||||
"\nDTEND;VALUE=DATE:20040828")
|
||||
(car result)))
|
||||
(assert (string= "Sommerferien" (cadr result)))))
|
||||
|
||||
(defun icalendar-testsuite--test-convert-anniversary-to-ical ()
|
||||
"Test method for `icalendar--convert-anniversary-to-ical'."
|
||||
(let* ((calendar-date-style 'iso)
|
||||
result)
|
||||
(setq result (icalendar--convert-anniversary-to-ical
|
||||
"" "%%(diary-anniversary 1964 6 30) g"))
|
||||
(assert (= 2 (length result)))
|
||||
(assert (string= (concat
|
||||
"\nDTSTART;VALUE=DATE:19640630"
|
||||
"\nDTEND;VALUE=DATE:19640701"
|
||||
"\nRRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=06;BYMONTHDAY=30")
|
||||
(car result)))
|
||||
(assert (string= "g" (cadr result)))))
|
||||
|
||||
(defun icalendar-testsuite--test-calendar-style ()
|
||||
"Test method for `icalendar--date-style'."
|
||||
(dolist (calendar-date-style '(iso american european))
|
||||
|
Loading…
Reference in New Issue
Block a user