summaryrefslogtreecommitdiff
path: root/tests/test-calendar-sync--event-to-org.el
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-02-06 10:15:08 -0600
committerCraig Jennings <c@cjennings.net>2026-02-06 10:15:08 -0600
commit7bef314c41f108c4db79b5ed40c974b010a95659 (patch)
tree48c3859a1895d26dffc5b87d42b022f4b77d90cf /tests/test-calendar-sync--event-to-org.el
parent9cbf88c58134c411168aaeecc56ba9609807344d (diff)
downloaddotemacs-7bef314c41f108c4db79b5ed40c974b010a95659.tar.gz
dotemacs-7bef314c41f108c4db79b5ed40c974b010a95659.zip
fix(calendar-sync): sanitize description text to prevent org heading corruption
Event descriptions containing lines starting with * were being interpreted as org headings, breaking file structure. Replace leading asterisks with dashes before writing descriptions.
Diffstat (limited to 'tests/test-calendar-sync--event-to-org.el')
-rw-r--r--tests/test-calendar-sync--event-to-org.el11
1 files changed, 8 insertions, 3 deletions
diff --git a/tests/test-calendar-sync--event-to-org.el b/tests/test-calendar-sync--event-to-org.el
index 96ce49d5..a3dc0106 100644
--- a/tests/test-calendar-sync--event-to-org.el
+++ b/tests/test-calendar-sync--event-to-org.el
@@ -92,7 +92,7 @@
(should (string-match-p ":END:" result)))))
(ert-deftest test-calendar-sync--event-to-org-boundary-description-with-asterisks ()
- "Test event description containing org-special asterisks."
+ "Test event description containing org-special asterisks are sanitized."
(let* ((start (test-calendar-sync-time-days-from-now 5 14 0))
(end (test-calendar-sync-time-days-from-now 5 15 0))
(event (list :summary "Meeting"
@@ -100,8 +100,13 @@
:end end
:description "* agenda item 1\n** sub-item")))
(let ((result (calendar-sync--event-to-org event)))
- ;; Description should be present
- (should (string-match-p "agenda item" result)))))
+ ;; Description content should be present
+ (should (string-match-p "agenda item" result))
+ ;; Leading asterisks replaced with dashes to prevent org heading conflicts
+ (should (string-match-p "^- agenda item 1" result))
+ (should (string-match-p "^-- sub-item" result))
+ ;; Only the event heading should use *
+ (should (= 1 (length (split-string result "^\\* " t)))))))
(ert-deftest test-calendar-sync--event-to-org-boundary-organizer-email-only ()
"Test organizer without CN shows email."