diff options
| author | Craig Jennings <c@cjennings.net> | 2026-04-05 07:04:37 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-04-05 07:04:37 -0500 |
| commit | 4fa136a0f8bfde7852655a9fce2c44422bd32b3a (patch) | |
| tree | 5e5029e640cc003c58a022471a9c631fd628d2bf /tests/test-calendar-sync--unfold-continuation.el | |
| parent | 10e2929d5be68ec1fda8b5b4ed08511eac02e7b3 (diff) | |
test(calendar-sync): add 32 tests for recurrence exceptions, helpers, unfolding
Cover occurrence-matches-exception-p (6), apply-single-exception (6),
exdate-matches-p (6), extract-cn (5), extract-email (4), unfold-continuation (5).
Diffstat (limited to 'tests/test-calendar-sync--unfold-continuation.el')
| -rw-r--r-- | tests/test-calendar-sync--unfold-continuation.el | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/tests/test-calendar-sync--unfold-continuation.el b/tests/test-calendar-sync--unfold-continuation.el new file mode 100644 index 00000000..6c6e1705 --- /dev/null +++ b/tests/test-calendar-sync--unfold-continuation.el @@ -0,0 +1,53 @@ +;;; test-calendar-sync--unfold-continuation.el --- Tests for RFC 5545 line unfolding -*- lexical-binding: t; -*- + +;;; Commentary: +;; Tests for calendar-sync--unfold-continuation. +;; Unfolds RFC 5545 continuation lines (lines starting with space/tab after newline). +;; Returns (unfolded-value . new-position) cons. + +;;; Code: + +(require 'ert) +(require 'testutil-calendar-sync) +(require 'calendar-sync) + +;;; Normal Cases + +(ert-deftest test-calendar-sync--unfold-continuation-normal-single-continuation () + "Single continuation line is appended to value." + ;; Simulate how get-property calls unfold-continuation: match-end is + ;; the position right after the matched value on the first line. + ;; "DESCRIPTION:First part" is 22 chars, so match-end for the value = 22. + ;; The \n at position 22 starts the continuation check. + (let* ((text "DESCRIPTION:First part\n Second part\nNEXT:value")) + ;; Use get-property which exercises unfold-continuation with correct positions + (should (equal "First partSecond part" + (calendar-sync--get-property text "DESCRIPTION"))))) + +(ert-deftest test-calendar-sync--unfold-continuation-normal-multiple-continuations () + "Multiple continuation lines are all appended." + (let* ((text "DESC:Line1\n Line2\n Line3\nNEXT:x")) + (should (equal "Line1Line2Line3" + (calendar-sync--get-property text "DESC"))))) + +;;; Boundary Cases + +(ert-deftest test-calendar-sync--unfold-continuation-boundary-no-continuation () + "No continuation lines returns value unchanged." + (let* ((text "SUMMARY:Test\nDTSTART:20260315")) + (should (equal "Test" (calendar-sync--get-property text "SUMMARY"))))) + +(ert-deftest test-calendar-sync--unfold-continuation-boundary-tab-continuation () + "Tab-indented continuation lines are also unfolded." + (let* ((text "DESC:Start\n\tTabbed\nNEXT:x")) + (should (equal "StartTabbed" (calendar-sync--get-property text "DESC"))))) + +;;; Error Cases + +(ert-deftest test-calendar-sync--unfold-continuation-error-start-at-end () + "Value at end of text with no continuation returns unchanged." + (let* ((text "SUMMARY:Test")) + (should (equal "Test" (calendar-sync--get-property text "SUMMARY"))))) + +(provide 'test-calendar-sync--unfold-continuation) +;;; test-calendar-sync--unfold-continuation.el ends here |
