summaryrefslogtreecommitdiff
path: root/tests/test-calendar-sync--date-weekday.el
blob: 61a499bd54a9d8f851aa0678aab0fd9fa20e2189 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
;;; test-calendar-sync--date-weekday.el --- Tests for date weekday calculation -*- lexical-binding: t; -*-

;;; Commentary:
;; Tests for calendar-sync--date-weekday. Returns 1 (Mon) through 7 (Sun).

;;; Code:

(require 'ert)
(require 'testutil-calendar-sync)
(require 'calendar-sync)

;;; Normal Cases

(ert-deftest test-calendar-sync--date-weekday-normal-known-date ()
  "2026-03-15 is a Sunday (7)."
  (should (= 7 (calendar-sync--date-weekday '(2026 3 15)))))

(ert-deftest test-calendar-sync--date-weekday-normal-monday ()
  "2026-03-16 is a Monday (1)."
  (should (= 1 (calendar-sync--date-weekday '(2026 3 16)))))

;;; Boundary Cases

(ert-deftest test-calendar-sync--date-weekday-boundary-sunday-is-7 ()
  "Sunday returns 7, not 0 (Emacs decode-time returns 0 for Sunday)."
  ;; 2026-01-04 is a Sunday
  (should (= 7 (calendar-sync--date-weekday '(2026 1 4)))))

(ert-deftest test-calendar-sync--date-weekday-boundary-saturday ()
  "Saturday returns 6."
  ;; 2026-01-03 is a Saturday
  (should (= 6 (calendar-sync--date-weekday '(2026 1 3)))))

(provide 'test-calendar-sync--date-weekday)
;;; test-calendar-sync--date-weekday.el ends here