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 | 133ae97a854fa511a858ac6801ea636d7696e6e7 (patch) | |
| tree | 8d4beef1cccd1a566c581bd9d3a3966c05b5c5c2 /tests/test-calendar-sync--extract-cn.el | |
| parent | 83ecfadd39719eb5bb0df7d8f98062b196ba98c5 (diff) | |
| download | dotemacs-133ae97a854fa511a858ac6801ea636d7696e6e7.tar.gz dotemacs-133ae97a854fa511a858ac6801ea636d7696e6e7.zip | |
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--extract-cn.el')
| -rw-r--r-- | tests/test-calendar-sync--extract-cn.el | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/tests/test-calendar-sync--extract-cn.el b/tests/test-calendar-sync--extract-cn.el new file mode 100644 index 00000000..0cb8f80c --- /dev/null +++ b/tests/test-calendar-sync--extract-cn.el @@ -0,0 +1,48 @@ +;;; test-calendar-sync--extract-cn.el --- Tests for CN parameter extraction -*- lexical-binding: t; -*- + +;;; Commentary: +;; Tests for calendar-sync--extract-cn. +;; Extracts and dequotes the CN= parameter from iCal property lines. + +;;; Code: + +(require 'ert) +(require 'testutil-calendar-sync) +(require 'calendar-sync) + +;;; Normal Cases + +(ert-deftest test-calendar-sync--extract-cn-normal-unquoted () + "Extracts unquoted CN value." + (should (equal "Craig Jennings" + (calendar-sync--extract-cn + "ATTENDEE;CN=Craig Jennings;PARTSTAT=ACCEPTED:mailto:c@test.com")))) + +(ert-deftest test-calendar-sync--extract-cn-normal-quoted () + "Strips surrounding quotes from CN value." + (should (equal "Craig Jennings" + (calendar-sync--extract-cn + "ATTENDEE;CN=\"Craig Jennings\";PARTSTAT=ACCEPTED:mailto:c@test.com")))) + +;;; Boundary Cases + +(ert-deftest test-calendar-sync--extract-cn-boundary-cn-at-end () + "CN as last parameter before colon." + (should (equal "Bob" + (calendar-sync--extract-cn "ORGANIZER;CN=Bob:mailto:bob@test.com")))) + +(ert-deftest test-calendar-sync--extract-cn-boundary-special-chars () + "CN with accented characters." + (should (equal "José García" + (calendar-sync--extract-cn + "ATTENDEE;CN=José García;PARTSTAT=ACCEPTED:mailto:j@test.com")))) + +;;; Error Cases + +(ert-deftest test-calendar-sync--extract-cn-error-no-cn () + "Line without CN= returns nil." + (should (null (calendar-sync--extract-cn + "ATTENDEE;PARTSTAT=ACCEPTED:mailto:c@test.com")))) + +(provide 'test-calendar-sync--extract-cn) +;;; test-calendar-sync--extract-cn.el ends here |
