summaryrefslogtreecommitdiff
path: root/tests/test-calendar-sync--exdate-matches-p.el
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-04-05 07:04:37 -0500
committerCraig Jennings <c@cjennings.net>2026-04-05 07:04:37 -0500
commit4fa136a0f8bfde7852655a9fce2c44422bd32b3a (patch)
tree5e5029e640cc003c58a022471a9c631fd628d2bf /tests/test-calendar-sync--exdate-matches-p.el
parent10e2929d5be68ec1fda8b5b4ed08511eac02e7b3 (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--exdate-matches-p.el')
-rw-r--r--tests/test-calendar-sync--exdate-matches-p.el47
1 files changed, 47 insertions, 0 deletions
diff --git a/tests/test-calendar-sync--exdate-matches-p.el b/tests/test-calendar-sync--exdate-matches-p.el
new file mode 100644
index 00000000..62c2f21e
--- /dev/null
+++ b/tests/test-calendar-sync--exdate-matches-p.el
@@ -0,0 +1,47 @@
+;;; test-calendar-sync--exdate-matches-p.el --- Tests for EXDATE matching -*- lexical-binding: t; -*-
+
+;;; Commentary:
+;; Tests for calendar-sync--exdate-matches-p.
+;; Checks if an occurrence start matches an excluded date.
+;; Date-only EXDATEs (nil hour) match any time on that day.
+
+;;; Code:
+
+(require 'ert)
+(require 'testutil-calendar-sync)
+(require 'calendar-sync)
+
+;;; Normal Cases
+
+(ert-deftest test-calendar-sync--exdate-matches-p-normal-exact-match ()
+ "Exact datetime match returns t."
+ (should (calendar-sync--exdate-matches-p '(2026 3 15 14 0) '(2026 3 15 14 0))))
+
+(ert-deftest test-calendar-sync--exdate-matches-p-normal-no-match ()
+ "Different date returns nil."
+ (should-not (calendar-sync--exdate-matches-p '(2026 3 15 14 0) '(2026 3 16 14 0))))
+
+(ert-deftest test-calendar-sync--exdate-matches-p-normal-date-only-wildcard ()
+ "Date-only EXDATE (nil hour) matches any time on that day."
+ (should (calendar-sync--exdate-matches-p '(2026 3 15 14 0) '(2026 3 15 nil nil)))
+ (should (calendar-sync--exdate-matches-p '(2026 3 15 9 30) '(2026 3 15 nil nil))))
+
+;;; Boundary Cases
+
+(ert-deftest test-calendar-sync--exdate-matches-p-boundary-different-time ()
+ "Same date but different time with timed EXDATE returns nil."
+ (should-not (calendar-sync--exdate-matches-p '(2026 3 15 14 0) '(2026 3 15 15 0))))
+
+(ert-deftest test-calendar-sync--exdate-matches-p-boundary-nil-minute-vs-zero ()
+ "Nil minute in occurrence treated as 0."
+ (should (calendar-sync--exdate-matches-p '(2026 3 15 14 nil) '(2026 3 15 14 0))))
+
+;;; Error Cases
+
+(ert-deftest test-calendar-sync--exdate-matches-p-error-nil-inputs ()
+ "Nil occurrence-start or exdate returns nil."
+ (should-not (calendar-sync--exdate-matches-p nil '(2026 3 15 14 0)))
+ (should-not (calendar-sync--exdate-matches-p '(2026 3 15 14 0) nil)))
+
+(provide 'test-calendar-sync--exdate-matches-p)
+;;; test-calendar-sync--exdate-matches-p.el ends here