1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-15 10:30:25 -08:00

icalendar.el: Add test(s) for bug#56241

* test/lisp/calendar/icalendar-tests.el
(icalendar-tests--get-error-string-for-export): new.
* icalendar-tests.el (icalendar-export-bug-56241-dotted-pair): new
This commit is contained in:
Ulf Jasper 2022-11-23 20:31:42 +01:00
parent 21b387c39b
commit b42cd524b4

View file

@ -61,6 +61,15 @@
(ert-resource-file filename))
(buffer-string))))
(defun icalendar-tests--get-error-string-for-export (diary-string)
"Call icalendar-export for DIARY-STRING and return resulting error-string."
(let ((file (make-temp-file "export.ics")))
(with-temp-buffer
(insert diary-string)
(icalendar-export-region (point-min) (point-max) file))
(with-current-buffer (get-buffer "*icalendar-errors*")
(buffer-string))))
;; ======================================================================
;; Tests of functions
;; ======================================================================
@ -981,6 +990,40 @@ END:VALARM
"
'(2 ((email ("att.one@email.com" "att.two@email.com")) (audio) (display)))))
;; ======================================================================
;; #bug56241
;; ======================================================================
(defun icalendar-tests--diary-float (&rest args)
(apply #'diary-float args))
(ert-deftest icalendar-export-bug-56241-dotted-pair ()
"See https://debbugs.gnu.org/cgi/bugreport.cgi?bug=56241#5"
(let ((icalendar-export-sexp-enumeration-days 366))
(mapc (lambda (diary-string)
(should (string= "" (icalendar-tests--get-error-string-for-export
diary-string))))
'("%%(diary-float 7 0 1) First Sunday in July 1"
"%%(icalendar-tests--diary-float 7 0 1) First Sunday in July 2"))))
;; (ert-deftest icalendar-export-bug-56241-sexp-does-not-match ()
;; "Reported in #bug56241 -- needs to be fixed!"
;; (let ((icalendar-export-sexp-enumeration-days 0))
;; (mapc (lambda (diary-string)
;; (should (string= "" (icalendar-tests--get-error-string-for-export
;; diary-string))))
;; '("%%(diary-float 7 0 1) First Sunday in July 1"
;; "%%(icalendar-tests--diary-float 7 0 1) First Sunday in July 2"))))
;;
;; (ert-deftest icalendar-export-bug-56241-nested-sexps ()
;; "Reported in #bug56241 -- needs to be fixed!"
;; (let ((icalendar-export-sexp-enumeration-days 366))
;; (mapc (lambda (diary-string)
;; (should (string= "" (icalendar-tests--get-error-string-for-export
;; diary-string))))
;; '("%%(= (calendar-day-of-week date) 0) Sunday 1"
;; "%%(= 0 (calendar-day-of-week date)) Sunday 2"))))
;; ======================================================================
;; Import tests
;; ======================================================================