[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master b42cd524b4: icalendar.el: Add test(s) for bug#56241
From: |
Ulf Jasper |
Subject: |
master b42cd524b4: icalendar.el: Add test(s) for bug#56241 |
Date: |
Wed, 23 Nov 2022 14:37:06 -0500 (EST) |
branch: master
commit b42cd524b46a4f29ef13e9d03be9d3df917f9aa3
Author: Ulf Jasper <ulf.jasper@web.de>
Commit: Ulf Jasper <ulf.jasper@web.de>
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
---
test/lisp/calendar/icalendar-tests.el | 43 +++++++++++++++++++++++++++++++++++
1 file changed, 43 insertions(+)
diff --git a/test/lisp/calendar/icalendar-tests.el
b/test/lisp/calendar/icalendar-tests.el
index 2e9353a09b..d9631310ae 100644
--- a/test/lisp/calendar/icalendar-tests.el
+++ b/test/lisp/calendar/icalendar-tests.el
@@ -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
;; ======================================================================
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master b42cd524b4: icalendar.el: Add test(s) for bug#56241,
Ulf Jasper <=