aboutsummaryrefslogtreecommitdiff
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
commit1ba7eedcdb83e17a900c448fd1a6de67b950d108 (patch)
treec6cea3de5395131e682661c909c87855e321961a /tests/test-calendar-sync--event-to-org.el
parent01be937e4a8e014865df6f6ac3121589e80d600f (diff)
downloaddotemacs-1ba7eedcdb83e17a900c448fd1a6de67b950d108.tar.gz
dotemacs-1ba7eedcdb83e17a900c448fd1a6de67b950d108.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."