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--occurrence-matches-exception-p.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--occurrence-matches-exception-p.el')
| -rw-r--r-- | tests/test-calendar-sync--occurrence-matches-exception-p.el | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/tests/test-calendar-sync--occurrence-matches-exception-p.el b/tests/test-calendar-sync--occurrence-matches-exception-p.el new file mode 100644 index 00000000..416dbb26 --- /dev/null +++ b/tests/test-calendar-sync--occurrence-matches-exception-p.el @@ -0,0 +1,56 @@ +;;; test-calendar-sync--occurrence-matches-exception-p.el --- Tests for occurrence-exception matching -*- lexical-binding: t; -*- + +;;; Commentary: +;; Tests for calendar-sync--occurrence-matches-exception-p. +;; Compares occurrence :start against exception :recurrence-id on year/month/day/hour/minute. + +;;; Code: + +(require 'ert) +(require 'testutil-calendar-sync) +(require 'calendar-sync) + +;;; Normal Cases + +(ert-deftest test-calendar-sync--occurrence-matches-exception-p-normal-exact-match () + "Identical datetime in occurrence and exception returns t." + (let ((occ (list :start '(2026 3 15 14 0))) + (exc (list :recurrence-id '(2026 3 15 14 0)))) + (should (calendar-sync--occurrence-matches-exception-p occ exc)))) + +(ert-deftest test-calendar-sync--occurrence-matches-exception-p-normal-no-match () + "Different dates return nil." + (let ((occ (list :start '(2026 3 15 14 0))) + (exc (list :recurrence-id '(2026 3 16 14 0)))) + (should-not (calendar-sync--occurrence-matches-exception-p occ exc)))) + +(ert-deftest test-calendar-sync--occurrence-matches-exception-p-normal-all-day () + "All-day events (nil hour/minute) match when dates are equal." + (let ((occ (list :start '(2026 3 15 nil nil))) + (exc (list :recurrence-id '(2026 3 15 nil nil)))) + (should (calendar-sync--occurrence-matches-exception-p occ exc)))) + +;;; Boundary Cases + +(ert-deftest test-calendar-sync--occurrence-matches-exception-p-boundary-different-time () + "Same date but different hour returns nil." + (let ((occ (list :start '(2026 3 15 14 0))) + (exc (list :recurrence-id '(2026 3 15 15 0)))) + (should-not (calendar-sync--occurrence-matches-exception-p occ exc)))) + +(ert-deftest test-calendar-sync--occurrence-matches-exception-p-boundary-nil-minute-vs-zero () + "Nil minute treated as 0 for comparison." + (let ((occ (list :start '(2026 3 15 14 nil))) + (exc (list :recurrence-id '(2026 3 15 14 0)))) + (should (calendar-sync--occurrence-matches-exception-p occ exc)))) + +;;; Error Cases + +(ert-deftest test-calendar-sync--occurrence-matches-exception-p-error-nil-start () + "Nil :start returns nil." + (let ((occ (list :summary "No start")) + (exc (list :recurrence-id '(2026 3 15 14 0)))) + (should-not (calendar-sync--occurrence-matches-exception-p occ exc)))) + +(provide 'test-calendar-sync--occurrence-matches-exception-p) +;;; test-calendar-sync--occurrence-matches-exception-p.el ends here |
