aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-04-22 09:43:02 -0500
committerCraig Jennings <c@cjennings.net>2026-04-22 09:43:02 -0500
commit74ca4e066bc41ce0a6e94e2d4bc0c838df45a838 (patch)
tree0661131c768050815114bf6214b85abac3956771 /tests
parent8511cf43f2bf4ab2dc539fd28427e6c81c98b901 (diff)
downloadchime-74ca4e066bc41ce0a6e94e2d4bc0c838df45a838.tar.gz
chime-74ca4e066bc41ce0a6e94e2d4bc0c838df45a838.zip
refactor: move 12 internal helpers from chime- to chime-- prefix
Before MELPA submission, tighten the public API surface. Single-dash chime-foo is the convention for user-facing commands and predicates that external code can bind. Anything that is not meant to be bound externally should use the double-dash chime--foo prefix so byte-compile warnings, docstrings, and MELPA package inspection all point in the same direction. Twelve helpers in chime.el had single-dash names but no user-facing role. They are not mentioned in README, they carry no interactive declaration, and their docstrings do not promise a behavior contract. Rename them: chime-get-minutes-into-day, chime-get-hours-minutes-from-time, chime-set-hours-minutes-for-time, chime-current-time-matches-time-of-day-string, chime-current-time-is-day-wide-time, chime-day-wide-notifications, chime-display-as-day-wide-event, chime-event-has-any-day-wide-timestamp, chime-event-within-advance-notice-window, chime-event-has-any-passed-time, chime-event-is-today, chime-environment-regex. The public API surface is now intentional. It covers chime-mode, chime-validate-configuration, chime-refresh-modeline, chime-done-keywords-predicate, and the chime-debug-* interactive commands in chime-debug.el. Breaking change. No alias shims because there are no downstream users yet.
Diffstat (limited to 'tests')
-rw-r--r--tests/test-chime-all-day-events.el28
-rw-r--r--tests/test-chime-day-wide-time-matching.el34
-rw-r--r--tests/test-chime-environment-regex.el20
-rw-r--r--tests/test-chime-event-is-today.el46
-rw-r--r--tests/test-chime-overdue-todos.el36
-rw-r--r--tests/test-chime-process-notifications.el34
-rw-r--r--tests/test-chime-time-utilities.el64
7 files changed, 131 insertions, 131 deletions
diff --git a/tests/test-chime-all-day-events.el b/tests/test-chime-all-day-events.el
index c0923e4..1cacf69 100644
--- a/tests/test-chime-all-day-events.el
+++ b/tests/test-chime-all-day-events.el
@@ -60,8 +60,8 @@ REFACTORED: Uses dynamic timestamps"
(timed-time (test-time-tomorrow-at 10 0))
(all-day-event (test-allday--create-event "Birthday" (test-timestamp-string all-day-time t) nil))
(timed-event (test-allday--create-event "Meeting" (test-timestamp-string timed-time) t)))
- (should (chime-event-has-any-day-wide-timestamp all-day-event))
- (should-not (chime-event-has-any-day-wide-timestamp timed-event))))
+ (should (chime--event-has-any-day-wide-timestamp all-day-event))
+ (should-not (chime--event-has-any-day-wide-timestamp timed-event))))
;;; Tests: Advance notice window
@@ -82,7 +82,7 @@ REFACTORED: Uses dynamic timestamps via testutil-time.el"
(chime-day-wide-advance-notice nil)
(event (test-allday--create-event "Birthday Tomorrow" tomorrow-timestamp nil)))
(with-test-time now
- (should-not (chime-event-within-advance-notice-window event)))))
+ (should-not (chime--event-within-advance-notice-window event)))))
(ert-deftest test-chime-advance-notice-tomorrow ()
"Test advance notice for event tomorrow when set to 1 day.
@@ -101,7 +101,7 @@ REFACTORED: Uses dynamic timestamps via testutil-time.el"
(chime-day-wide-advance-notice 1)
(event (test-allday--create-event "Birthday Tomorrow" tomorrow-timestamp nil)))
(with-test-time now
- (should (chime-event-within-advance-notice-window event)))))
+ (should (chime--event-within-advance-notice-window event)))))
(ert-deftest test-chime-advance-notice-two-days ()
"Test advance notice for event in 2 days when set to 2 days.
@@ -115,7 +115,7 @@ REFACTORED: Uses dynamic timestamps"
(chime-day-wide-advance-notice 2)
(event (test-allday--create-event "Birthday in 2 days" timestamp nil)))
(with-test-time now
- (should (chime-event-within-advance-notice-window event)))))
+ (should (chime--event-within-advance-notice-window event)))))
(ert-deftest test-chime-advance-notice-too-far-future ()
"Test that events beyond advance notice window are not included.
@@ -129,7 +129,7 @@ REFACTORED: Uses dynamic timestamps"
(chime-day-wide-advance-notice 1)
(event (test-allday--create-event "Birthday in 5 days" timestamp nil)))
(with-test-time now
- (should-not (chime-event-within-advance-notice-window event)))))
+ (should-not (chime--event-within-advance-notice-window event)))))
(ert-deftest test-chime-advance-notice-today-not-included ()
"Test that today's events are not in advance notice window.
@@ -144,7 +144,7 @@ REFACTORED: Uses dynamic timestamps"
(with-test-time now
;; Today's event should NOT be in advance notice window
;; It should be handled by regular day-wide logic
- (should-not (chime-event-within-advance-notice-window event)))))
+ (should-not (chime--event-within-advance-notice-window event)))))
(ert-deftest test-chime-advance-notice-timed-events-ignored ()
"Test that timed events are not included in advance notice.
@@ -159,7 +159,7 @@ REFACTORED: Uses dynamic timestamps"
(event (test-allday--create-event "Meeting Tomorrow" timestamp t)))
(with-test-time now
;; Timed events should not trigger advance notices
- (should-not (chime-event-within-advance-notice-window event)))))
+ (should-not (chime--event-within-advance-notice-window event)))))
;;; Tests: Day-wide notification text
@@ -212,7 +212,7 @@ REFACTORED: Uses dynamic timestamps"
;;; Tests: Display as day-wide event
-(ert-deftest test-chime-display-as-day-wide-event-today ()
+(ert-deftest test-chime--display-as-day-wide-event-today ()
"Test that all-day events today are displayed as day-wide.
REFACTORED: Uses dynamic timestamps"
(let* ((now (test-time-now))
@@ -220,9 +220,9 @@ REFACTORED: Uses dynamic timestamps"
(chime-day-wide-advance-notice nil)
(event (test-allday--create-event "Birthday Today" today-timestamp nil)))
(with-test-time now
- (should (chime-display-as-day-wide-event event)))))
+ (should (chime--display-as-day-wide-event event)))))
-(ert-deftest test-chime-display-as-day-wide-event-tomorrow-with-advance ()
+(ert-deftest test-chime--display-as-day-wide-event-tomorrow-with-advance ()
"Test that all-day events tomorrow are displayed when advance notice is enabled.
REFACTORED: Uses dynamic timestamps"
(let* ((now (test-time-now))
@@ -231,9 +231,9 @@ REFACTORED: Uses dynamic timestamps"
(chime-day-wide-advance-notice 1)
(event (test-allday--create-event "Birthday Tomorrow" timestamp nil)))
(with-test-time now
- (should (chime-display-as-day-wide-event event)))))
+ (should (chime--display-as-day-wide-event event)))))
-(ert-deftest test-chime-display-as-day-wide-event-tomorrow-without-advance ()
+(ert-deftest test-chime--display-as-day-wide-event-tomorrow-without-advance ()
"Test that all-day events tomorrow are NOT displayed without advance notice.
REFACTORED: Uses dynamic timestamps"
(let* ((now (test-time-now))
@@ -242,7 +242,7 @@ REFACTORED: Uses dynamic timestamps"
(chime-day-wide-advance-notice nil)
(event (test-allday--create-event "Birthday Tomorrow" timestamp nil)))
(with-test-time now
- (should-not (chime-display-as-day-wide-event event)))))
+ (should-not (chime--display-as-day-wide-event event)))))
;;; Tests: Tooltip configuration
diff --git a/tests/test-chime-day-wide-time-matching.el b/tests/test-chime-day-wide-time-matching.el
index 2136325..7a7c7d4 100644
--- a/tests/test-chime-day-wide-time-matching.el
+++ b/tests/test-chime-day-wide-time-matching.el
@@ -20,8 +20,8 @@
;;; Commentary:
;; Unit tests for day-wide time matching functions:
-;; - chime-current-time-matches-time-of-day-string
-;; - chime-current-time-is-day-wide-time
+;; - chime--current-time-matches-time-of-day-string
+;; - chime--current-time-is-day-wide-time
;;
;; These functions determine when to fire notifications for all-day events
;; by comparing the current time to configured alert times like "08:00".
@@ -37,7 +37,7 @@
(require 'testutil-general (expand-file-name "testutil-general.el"))
(require 'testutil-time (expand-file-name "testutil-time.el"))
-;;;; Tests for chime-current-time-matches-time-of-day-string
+;;;; Tests for chime--current-time-matches-time-of-day-string
;;; Normal Cases
@@ -45,19 +45,19 @@
"Should return truthy when current time matches the time-of-day string."
(let ((mock-time (test-time-today-at 8 0)))
(with-test-time mock-time
- (should (chime-current-time-matches-time-of-day-string "8:00")))))
+ (should (chime--current-time-matches-time-of-day-string "8:00")))))
(ert-deftest test-chime-time-matches-string-no-match ()
"Should return nil when current time does not match."
(let ((mock-time (test-time-today-at 9 0)))
(with-test-time mock-time
- (should-not (chime-current-time-matches-time-of-day-string "8:00")))))
+ (should-not (chime--current-time-matches-time-of-day-string "8:00")))))
(ert-deftest test-chime-time-matches-string-afternoon ()
"Should match afternoon times correctly."
(let ((mock-time (test-time-today-at 17 0)))
(with-test-time mock-time
- (should (chime-current-time-matches-time-of-day-string "17:00")))))
+ (should (chime--current-time-matches-time-of-day-string "17:00")))))
;;; Boundary Cases
@@ -65,27 +65,27 @@
"Should match midnight (00:00)."
(let ((mock-time (test-time-today-at 0 0)))
(with-test-time mock-time
- (should (chime-current-time-matches-time-of-day-string "0:00")))))
+ (should (chime--current-time-matches-time-of-day-string "0:00")))))
(ert-deftest test-chime-time-matches-string-end-of-day ()
"Should match 23:59."
(let ((mock-time (test-time-today-at 23 59)))
(with-test-time mock-time
- (should (chime-current-time-matches-time-of-day-string "23:59")))))
+ (should (chime--current-time-matches-time-of-day-string "23:59")))))
(ert-deftest test-chime-time-matches-string-off-by-one-minute ()
"One minute off should not match."
(let ((mock-time (test-time-today-at 8 1)))
(with-test-time mock-time
- (should-not (chime-current-time-matches-time-of-day-string "8:00")))))
+ (should-not (chime--current-time-matches-time-of-day-string "8:00")))))
(ert-deftest test-chime-time-matches-string-leading-zero ()
"Should match with leading zero in time string (08:00)."
(let ((mock-time (test-time-today-at 8 0)))
(with-test-time mock-time
- (should (chime-current-time-matches-time-of-day-string "08:00")))))
+ (should (chime--current-time-matches-time-of-day-string "08:00")))))
-;;;; Tests for chime-current-time-is-day-wide-time
+;;;; Tests for chime--current-time-is-day-wide-time
;;; Normal Cases
@@ -94,21 +94,21 @@
(let ((mock-time (test-time-today-at 8 0)))
(with-test-time mock-time
(let ((chime-day-wide-alert-times '("08:00")))
- (should (chime-current-time-is-day-wide-time))))))
+ (should (chime--current-time-is-day-wide-time))))))
(ert-deftest test-chime-is-day-wide-time-matches-second-entry ()
"Should return truthy when current time matches any entry, not just first."
(let ((mock-time (test-time-today-at 17 0)))
(with-test-time mock-time
(let ((chime-day-wide-alert-times '("08:00" "17:00")))
- (should (chime-current-time-is-day-wide-time))))))
+ (should (chime--current-time-is-day-wide-time))))))
(ert-deftest test-chime-is-day-wide-time-no-match ()
"Should return nil when current time matches no configured alert times."
(let ((mock-time (test-time-today-at 12 0)))
(with-test-time mock-time
(let ((chime-day-wide-alert-times '("08:00" "17:00")))
- (should-not (chime-current-time-is-day-wide-time))))))
+ (should-not (chime--current-time-is-day-wide-time))))))
;;; Boundary Cases
@@ -117,21 +117,21 @@
(let ((mock-time (test-time-today-at 8 0)))
(with-test-time mock-time
(let ((chime-day-wide-alert-times '()))
- (should-not (chime-current-time-is-day-wide-time))))))
+ (should-not (chime--current-time-is-day-wide-time))))))
(ert-deftest test-chime-is-day-wide-time-nil-list ()
"Should return nil when alert times list is nil."
(let ((mock-time (test-time-today-at 8 0)))
(with-test-time mock-time
(let ((chime-day-wide-alert-times nil))
- (should-not (chime-current-time-is-day-wide-time))))))
+ (should-not (chime--current-time-is-day-wide-time))))))
(ert-deftest test-chime-is-day-wide-time-matches-first-of-many ()
"Should return truthy when matching the first of several alert times."
(let ((mock-time (test-time-today-at 8 0)))
(with-test-time mock-time
(let ((chime-day-wide-alert-times '("08:00" "12:00" "17:00")))
- (should (chime-current-time-is-day-wide-time))))))
+ (should (chime--current-time-is-day-wide-time))))))
(provide 'test-chime-day-wide-time-matching)
;;; test-chime-day-wide-time-matching.el ends here
diff --git a/tests/test-chime-environment-regex.el b/tests/test-chime-environment-regex.el
index 2499ad0..2179198 100644
--- a/tests/test-chime-environment-regex.el
+++ b/tests/test-chime-environment-regex.el
@@ -1,4 +1,4 @@
-;;; test-chime-environment-regex.el --- Tests for chime-environment-regex -*- lexical-binding: t; -*-
+;;; test-chime--environment-regex.el --- Tests for chime--environment-regex -*- lexical-binding: t; -*-
;; Copyright (C) 2026 Craig Jennings
@@ -19,7 +19,7 @@
;;; Commentary:
-;; Unit tests for chime-environment-regex function.
+;; Unit tests for chime--environment-regex function.
;; This function generates the regex used by async-inject-variables to
;; copy chime's config into the async subprocess.
@@ -29,9 +29,9 @@
;;; Normal Cases
-(ert-deftest test-chime-environment-regex-matches-default-variables ()
+(ert-deftest test-chime--environment-regex-matches-default-variables ()
"The generated regex should match all default chime variable names."
- (let ((regex (chime-environment-regex))
+ (let ((regex (chime--environment-regex))
(chime-additional-environment-regexes nil))
(dolist (var '("org-agenda-files" "load-path" "org-todo-keywords"
"chime-alert-intervals" "chime-keyword-whitelist"
@@ -40,10 +40,10 @@
"chime-predicate-blacklist"))
(should (string-match-p regex var)))))
-(ert-deftest test-chime-environment-regex-includes-additional-regexes ()
+(ert-deftest test-chime--environment-regex-includes-additional-regexes ()
"With additional regexes configured, the result should match those too."
(let ((chime-additional-environment-regexes '("my-custom-var")))
- (let ((regex (chime-environment-regex)))
+ (let ((regex (chime--environment-regex)))
;; Should still match defaults
(should (string-match-p regex "org-agenda-files"))
;; Should also match the custom variable
@@ -51,12 +51,12 @@
;;; Boundary Cases
-(ert-deftest test-chime-environment-regex-empty-additional-list ()
+(ert-deftest test-chime--environment-regex-empty-additional-list ()
"Empty additional regexes list should produce a valid regex matching defaults."
(let ((chime-additional-environment-regexes nil))
- (let ((regex (chime-environment-regex)))
+ (let ((regex (chime--environment-regex)))
(should (stringp regex))
(should (string-match-p regex "chime-alert-intervals")))))
-(provide 'test-chime-environment-regex)
-;;; test-chime-environment-regex.el ends here
+(provide 'test-chime--environment-regex)
+;;; test-chime--environment-regex.el ends here
diff --git a/tests/test-chime-event-is-today.el b/tests/test-chime-event-is-today.el
index f825174..305749a 100644
--- a/tests/test-chime-event-is-today.el
+++ b/tests/test-chime-event-is-today.el
@@ -1,4 +1,4 @@
-;;; test-chime-event-is-today.el --- Tests for chime-event-is-today -*- lexical-binding: t; -*-
+;;; test-chime--event-is-today.el --- Tests for chime--event-is-today -*- lexical-binding: t; -*-
;; Copyright (C) 2026 Craig Jennings
@@ -19,12 +19,12 @@
;;; Commentary:
-;; Unit tests for chime-event-is-today function.
+;; Unit tests for chime--event-is-today function.
;; This function checks if an event has any timestamps specifically on today's
;; date (not past days, not future days).
;;
;; NOTE: These tests use real dates (not with-test-time) because
-;; chime-event-is-today uses (decode-time) without arguments internally,
+;; chime--event-is-today uses (decode-time) without arguments internally,
;; which calls the C-level current_time and bypasses Lisp-level mocking.
;;; Code:
@@ -73,54 +73,54 @@
;;; Normal Cases
-(ert-deftest test-chime-event-is-today-timed-event-today ()
+(ert-deftest test-chime--event-is-today-timed-event-today ()
"A timed event happening today should return truthy."
(let ((event (test--make-timed-event (test--real-today-at 14 30))))
- (should (chime-event-is-today event))))
+ (should (chime--event-is-today event))))
-(ert-deftest test-chime-event-is-today-all-day-event-today ()
+(ert-deftest test-chime--event-is-today-all-day-event-today ()
"An all-day event for today should return truthy."
(let ((event (test--make-all-day-event (test--real-today-at 0 0))))
- (should (chime-event-is-today event))))
+ (should (chime--event-is-today event))))
-(ert-deftest test-chime-event-is-today-yesterday-returns-nil ()
+(ert-deftest test-chime--event-is-today-yesterday-returns-nil ()
"An event from yesterday should return nil."
(let ((event (test--make-timed-event (test--real-yesterday-at 14 30))))
- (should-not (chime-event-is-today event))))
+ (should-not (chime--event-is-today event))))
-(ert-deftest test-chime-event-is-today-tomorrow-returns-nil ()
+(ert-deftest test-chime--event-is-today-tomorrow-returns-nil ()
"An event for tomorrow should return nil."
(let ((event (test--make-timed-event (test--real-tomorrow-at 14 30))))
- (should-not (chime-event-is-today event))))
+ (should-not (chime--event-is-today event))))
-(ert-deftest test-chime-event-is-today-past-timed-event-today ()
+(ert-deftest test-chime--event-is-today-past-timed-event-today ()
"A timed event earlier today (in the past) should return truthy."
(let ((event (test--make-timed-event (test--real-today-at 0 1))))
- (should (chime-event-is-today event))))
+ (should (chime--event-is-today event))))
-(ert-deftest test-chime-event-is-today-future-timed-event-today ()
+(ert-deftest test-chime--event-is-today-future-timed-event-today ()
"A timed event later today (in the future) should return truthy."
(let ((event (test--make-timed-event (test--real-today-at 23 58))))
- (should (chime-event-is-today event))))
+ (should (chime--event-is-today event))))
;;; Boundary Cases
-(ert-deftest test-chime-event-is-today-event-at-2359-today ()
+(ert-deftest test-chime--event-is-today-event-at-2359-today ()
"An event at 23:59 today should return truthy."
(let ((event (test--make-timed-event (test--real-today-at 23 59))))
- (should (chime-event-is-today event))))
+ (should (chime--event-is-today event))))
-(ert-deftest test-chime-event-is-today-event-at-0000-today ()
+(ert-deftest test-chime--event-is-today-event-at-0000-today ()
"An event at 00:00 today should return truthy."
(let ((event (test--make-timed-event (test--real-today-at 0 0))))
- (should (chime-event-is-today event))))
+ (should (chime--event-is-today event))))
;;; Error Cases
-(ert-deftest test-chime-event-is-today-empty-times-returns-nil ()
+(ert-deftest test-chime--event-is-today-empty-times-returns-nil ()
"An event with no times should return nil."
(let ((event '((times . ()))))
- (should-not (chime-event-is-today event))))
+ (should-not (chime--event-is-today event))))
-(provide 'test-chime-event-is-today)
-;;; test-chime-event-is-today.el ends here
+(provide 'test-chime--event-is-today)
+;;; test-chime--event-is-today.el ends here
diff --git a/tests/test-chime-overdue-todos.el b/tests/test-chime-overdue-todos.el
index 919ceeb..84bc091 100644
--- a/tests/test-chime-overdue-todos.el
+++ b/tests/test-chime-overdue-todos.el
@@ -57,7 +57,7 @@ HAS-TIME determines if timestamp has time component."
"Teardown function run after each test."
(chime-delete-test-base-dir))
-;;; Tests for chime-event-has-any-passed-time
+;;; Tests for chime--event-has-any-passed-time
(ert-deftest test-overdue-has-passed-time-yesterday-all-day ()
"Test that all-day event from yesterday is recognized as passed.
@@ -80,7 +80,7 @@ REFACTORED: Uses dynamic timestamps via testutil-time.el"
yesterday-timestamp
nil))) ; all-day event
(with-test-time now
- (should (chime-event-has-any-passed-time event))))
+ (should (chime--event-has-any-passed-time event))))
(test-chime-overdue-teardown)))
(ert-deftest test-overdue-has-passed-time-today-all-day ()
@@ -100,7 +100,7 @@ SPECIAL PROPERTIES:
- Range: No
EXPECTED BEHAVIOR:
- chime-event-has-any-passed-time should return t because the event
+ chime--event-has-any-passed-time should return t because the event
date (today) is not in the future.
CURRENT IMPLEMENTATION (as of 2025-10-28):
@@ -120,7 +120,7 @@ REFACTORED: Uses dynamic timestamps via testutil-time.el"
today-timestamp
nil))) ; all-day event
(with-test-time now
- (should (chime-event-has-any-passed-time event))))
+ (should (chime--event-has-any-passed-time event))))
(test-chime-overdue-teardown)))
(ert-deftest test-overdue-has-passed-time-tomorrow-all-day ()
@@ -144,7 +144,7 @@ REFACTORED: Uses dynamic timestamps via testutil-time.el"
tomorrow-timestamp
nil))) ; all-day event
(with-test-time now
- (should-not (chime-event-has-any-passed-time event))))
+ (should-not (chime--event-has-any-passed-time event))))
(test-chime-overdue-teardown)))
(ert-deftest test-overdue-has-passed-time-timed-event-past ()
@@ -168,7 +168,7 @@ REFACTORED: Uses dynamic timestamps via testutil-time.el"
past-timestamp
t))) ; timed event
(with-test-time now
- (should (chime-event-has-any-passed-time event))))
+ (should (chime--event-has-any-passed-time event))))
(test-chime-overdue-teardown)))
(ert-deftest test-overdue-has-passed-time-timed-event-future ()
@@ -192,10 +192,10 @@ REFACTORED: Uses dynamic timestamps via testutil-time.el"
future-timestamp
t))) ; timed event
(with-test-time now
- (should-not (chime-event-has-any-passed-time event))))
+ (should-not (chime--event-has-any-passed-time event))))
(test-chime-overdue-teardown)))
-;;; Tests for chime-display-as-day-wide-event with overdue setting
+;;; Tests for chime--display-as-day-wide-event with overdue setting
(ert-deftest test-overdue-display-yesterday-all-day-with-overdue-enabled ()
"Test that yesterday's all-day event is displayed when overdue is enabled.
@@ -221,7 +221,7 @@ REFACTORED: Uses dynamic timestamps via testutil-time.el"
yesterday-timestamp
nil)))
(with-test-time now
- (should (chime-display-as-day-wide-event event))))
+ (should (chime--display-as-day-wide-event event))))
(test-chime-overdue-teardown)))
(ert-deftest test-overdue-display-yesterday-all-day-with-overdue-disabled ()
@@ -241,7 +241,7 @@ REFACTORED: Uses dynamic timestamps via testutil-time.el"
yesterday-timestamp
nil)))
(with-test-time now
- (should-not (chime-display-as-day-wide-event event))))
+ (should-not (chime--display-as-day-wide-event event))))
(test-chime-overdue-teardown)))
(ert-deftest test-overdue-display-yesterday-timed-with-overdue-enabled ()
@@ -263,7 +263,7 @@ REFACTORED: Uses dynamic timestamps via testutil-time.el"
yesterday-timestamp
t)))
(with-test-time now
- (should (chime-display-as-day-wide-event event))))
+ (should (chime--display-as-day-wide-event event))))
(test-chime-overdue-teardown)))
(ert-deftest test-overdue-display-yesterday-timed-with-overdue-disabled ()
@@ -285,7 +285,7 @@ REFACTORED: Uses dynamic timestamps via testutil-time.el"
yesterday-timestamp
t)))
(with-test-time now
- (should-not (chime-display-as-day-wide-event event))))
+ (should-not (chime--display-as-day-wide-event event))))
(test-chime-overdue-teardown)))
(ert-deftest test-overdue-display-today-all-day-always-shown ()
@@ -307,10 +307,10 @@ REFACTORED: Uses dynamic timestamps via testutil-time.el"
(with-test-time now
;; Should show with overdue enabled
(let ((chime-show-any-overdue-with-day-wide-alerts t))
- (should (chime-display-as-day-wide-event event)))
+ (should (chime--display-as-day-wide-event event)))
;; Should also show with overdue disabled (it's today, not overdue)
(let ((chime-show-any-overdue-with-day-wide-alerts nil))
- (should (chime-display-as-day-wide-event event)))))
+ (should (chime--display-as-day-wide-event event)))))
(test-chime-overdue-teardown)))
(ert-deftest test-overdue-display-week-old-all-day-with-overdue-enabled ()
@@ -332,7 +332,7 @@ REFACTORED: Uses dynamic timestamps via testutil-time.el"
week-ago-timestamp
nil)))
(with-test-time now
- (should (chime-display-as-day-wide-event event))))
+ (should (chime--display-as-day-wide-event event))))
(test-chime-overdue-teardown)))
(ert-deftest test-overdue-display-week-old-all-day-with-overdue-disabled ()
@@ -355,7 +355,7 @@ REFACTORED: Uses dynamic timestamps via testutil-time.el"
week-ago-timestamp
nil)))
(with-test-time now
- (should-not (chime-display-as-day-wide-event event))))
+ (should-not (chime--display-as-day-wide-event event))))
(test-chime-overdue-teardown)))
;;; Tests verifying overdue doesn't affect future events
@@ -380,10 +380,10 @@ REFACTORED: Uses dynamic timestamps via testutil-time.el"
(with-test-time now
;; Should NOT show with overdue enabled (it's future, not today)
(let ((chime-show-any-overdue-with-day-wide-alerts t))
- (should-not (chime-display-as-day-wide-event event)))
+ (should-not (chime--display-as-day-wide-event event)))
;; Should NOT show with overdue disabled (it's future, not today)
(let ((chime-show-any-overdue-with-day-wide-alerts nil))
- (should-not (chime-display-as-day-wide-event event)))))
+ (should-not (chime--display-as-day-wide-event event)))))
(test-chime-overdue-teardown)))
(provide 'test-chime-overdue-todos)
diff --git a/tests/test-chime-process-notifications.el b/tests/test-chime-process-notifications.el
index 181f146..75cac9b 100644
--- a/tests/test-chime-process-notifications.el
+++ b/tests/test-chime-process-notifications.el
@@ -59,7 +59,7 @@ REFACTORED: Uses dynamic timestamps and with-test-time"
(lambda (msg)
(setq notify-called t)
(push msg notify-messages)))
- ((symbol-function 'chime-current-time-is-day-wide-time)
+ ((symbol-function 'chime--current-time-is-day-wide-time)
(lambda () nil)))
(let* ((event `((times . ((,timestamp-str . ,event-time)))
(title . "Team Meeting")
@@ -89,7 +89,7 @@ REFACTORED: Uses dynamic timestamps and with-test-time"
(with-test-time now
(cl-letf (((symbol-function 'chime--notify)
(lambda (msg) (setq notify-count (1+ notify-count))))
- ((symbol-function 'chime-current-time-is-day-wide-time)
+ ((symbol-function 'chime--current-time-is-day-wide-time)
(lambda () nil)))
(let* ((event1 `((times . ((,timestamp-str-1 . ,event-time-1)))
(title . "Meeting 1")
@@ -117,7 +117,7 @@ REFACTORED: Uses dynamic timestamps and with-test-time"
(with-test-time now
(cl-letf (((symbol-function 'chime--notify)
(lambda (msg) (push msg notify-messages)))
- ((symbol-function 'chime-current-time-is-day-wide-time)
+ ((symbol-function 'chime--current-time-is-day-wide-time)
(lambda () nil)))
(let* ((event1 `((times . ((,timestamp-str . ,event-time)))
(title . "Team Meeting")
@@ -146,9 +146,9 @@ REFACTORED: Uses dynamic timestamps and with-test-time"
(cl-letf (((symbol-function 'chime--notify)
(lambda (msg) (setq notify-count (1+ notify-count))))
;; Mock day-wide time to return true
- ((symbol-function 'chime-current-time-is-day-wide-time)
+ ((symbol-function 'chime--current-time-is-day-wide-time)
(lambda () t))
- ((symbol-function 'chime-day-wide-notifications)
+ ((symbol-function 'chime--day-wide-notifications)
(lambda (events) (list "Day-wide alert"))))
(let* ((event `((times . ((,timestamp-str . ,event-time)))
(title . "All Day Event")
@@ -172,9 +172,9 @@ REFACTORED: Uses dynamic timestamps and with-test-time"
(with-test-time now
(cl-letf (((symbol-function 'chime--notify) (lambda (msg) nil))
;; Mock day-wide time to return false
- ((symbol-function 'chime-current-time-is-day-wide-time)
+ ((symbol-function 'chime--current-time-is-day-wide-time)
(lambda () nil))
- ((symbol-function 'chime-day-wide-notifications)
+ ((symbol-function 'chime--day-wide-notifications)
(lambda (events)
(setq day-wide-called t)
'())))
@@ -198,7 +198,7 @@ REFACTORED: No timestamps used"
(let ((notify-called nil))
(cl-letf (((symbol-function 'chime--notify)
(lambda (msg) (setq notify-called t)))
- ((symbol-function 'chime-current-time-is-day-wide-time)
+ ((symbol-function 'chime--current-time-is-day-wide-time)
(lambda () nil)))
(let ((events '()))
(chime--process-notifications events)
@@ -220,7 +220,7 @@ REFACTORED: Uses dynamic timestamps and with-test-time"
(with-test-time now
(cl-letf (((symbol-function 'chime--notify)
(lambda (msg) (setq notify-called t)))
- ((symbol-function 'chime-current-time-is-day-wide-time)
+ ((symbol-function 'chime--current-time-is-day-wide-time)
(lambda () nil)))
(let* ((event `((times . ((,timestamp-str . ,event-time)))
(title . "Future Event")
@@ -244,7 +244,7 @@ REFACTORED: Uses dynamic timestamps and with-test-time"
(with-test-time now
(cl-letf (((symbol-function 'chime--notify)
(lambda (msg) (setq notify-count (1+ notify-count))))
- ((symbol-function 'chime-current-time-is-day-wide-time)
+ ((symbol-function 'chime--current-time-is-day-wide-time)
(lambda () nil)))
(let* ((event `((times . ((,timestamp-str . ,event-time)))
(title . "Single Event")
@@ -266,7 +266,7 @@ REFACTORED: No timestamps used"
(let ((notify-called nil))
(cl-letf (((symbol-function 'chime--notify)
(lambda (msg) (setq notify-called t)))
- ((symbol-function 'chime-current-time-is-day-wide-time)
+ ((symbol-function 'chime--current-time-is-day-wide-time)
(lambda () nil)))
;; Should not error with nil events
(should-not (condition-case nil
@@ -287,7 +287,7 @@ REFACTORED: Uses dynamic timestamps and with-test-time"
(with-test-time now
(cl-letf (((symbol-function 'chime--notify)
(lambda (msg) (setq notify-called t)))
- ((symbol-function 'chime-current-time-is-day-wide-time)
+ ((symbol-function 'chime--current-time-is-day-wide-time)
(lambda () nil)))
(let* (;; Invalid event: missing required fields
(events (list '((invalid . "structure")))))
@@ -311,7 +311,7 @@ REFACTORED: Uses dynamic timestamps and with-test-time"
(with-test-time now
(cl-letf (((symbol-function 'chime--notify)
(lambda (msg) (setq notify-count (1+ notify-count))))
- ((symbol-function 'chime-current-time-is-day-wide-time)
+ ((symbol-function 'chime--current-time-is-day-wide-time)
(lambda () nil)))
(let* ((valid-event `((times . ((,timestamp-str . ,event-time)))
(title . "Valid Event")
@@ -342,9 +342,9 @@ not one notification per event."
(lambda (msg)
(setq notify-count (1+ notify-count))
(push msg notify-messages)))
- ((symbol-function 'chime-current-time-is-day-wide-time)
+ ((symbol-function 'chime--current-time-is-day-wide-time)
(lambda () t))
- ((symbol-function 'chime-day-wide-notifications)
+ ((symbol-function 'chime--day-wide-notifications)
(lambda (events)
(list (cons "Blake's birthday is today" 'medium)
(cons "Holiday: Memorial Day is today" 'medium)
@@ -371,9 +371,9 @@ not one notification per event."
(lambda (msg)
(setq notify-count (1+ notify-count))
(push msg notify-messages)))
- ((symbol-function 'chime-current-time-is-day-wide-time)
+ ((symbol-function 'chime--current-time-is-day-wide-time)
(lambda () t))
- ((symbol-function 'chime-day-wide-notifications)
+ ((symbol-function 'chime--day-wide-notifications)
(lambda (events)
(list (cons "Blake's birthday is today" 'medium)))))
(chime--process-notifications '())
diff --git a/tests/test-chime-time-utilities.el b/tests/test-chime-time-utilities.el
index 4e14df2..26e4d96 100644
--- a/tests/test-chime-time-utilities.el
+++ b/tests/test-chime-time-utilities.el
@@ -20,9 +20,9 @@
;;; Commentary:
;; Unit tests for chime time utility functions:
-;; - chime-get-minutes-into-day
-;; - chime-get-hours-minutes-from-time
-;; - chime-set-hours-minutes-for-time
+;; - chime--get-minutes-into-day
+;; - chime--get-hours-minutes-from-time
+;; - chime--set-hours-minutes-for-time
;;; Code:
@@ -32,78 +32,78 @@
(require 'testutil-general (expand-file-name "testutil-general.el"))
(require 'testutil-time (expand-file-name "testutil-time.el"))
-;;;; Tests for chime-get-minutes-into-day
+;;;; Tests for chime--get-minutes-into-day
;;; Normal Cases
-(ert-deftest test-chime-get-minutes-into-day-noon ()
+(ert-deftest test-chime--get-minutes-into-day-noon ()
"Noon (12:00) should be 720 minutes into the day."
- (should (= 720 (chime-get-minutes-into-day "12:00"))))
+ (should (= 720 (chime--get-minutes-into-day "12:00"))))
-(ert-deftest test-chime-get-minutes-into-day-afternoon ()
+(ert-deftest test-chime--get-minutes-into-day-afternoon ()
"14:30 should be 870 minutes into the day."
- (should (= 870 (chime-get-minutes-into-day "14:30"))))
+ (should (= 870 (chime--get-minutes-into-day "14:30"))))
-(ert-deftest test-chime-get-minutes-into-day-morning ()
+(ert-deftest test-chime--get-minutes-into-day-morning ()
"8:00 should be 480 minutes into the day."
- (should (= 480 (chime-get-minutes-into-day "8:00"))))
+ (should (= 480 (chime--get-minutes-into-day "8:00"))))
;;; Boundary Cases
-(ert-deftest test-chime-get-minutes-into-day-midnight ()
+(ert-deftest test-chime--get-minutes-into-day-midnight ()
"Midnight (0:00) should be 0 minutes into the day."
- (should (= 0 (chime-get-minutes-into-day "0:00"))))
+ (should (= 0 (chime--get-minutes-into-day "0:00"))))
-(ert-deftest test-chime-get-minutes-into-day-end-of-day ()
+(ert-deftest test-chime--get-minutes-into-day-end-of-day ()
"23:59 should be 1439 minutes into the day."
- (should (= 1439 (chime-get-minutes-into-day "23:59"))))
+ (should (= 1439 (chime--get-minutes-into-day "23:59"))))
-(ert-deftest test-chime-get-minutes-into-day-one-minute-past-midnight ()
+(ert-deftest test-chime--get-minutes-into-day-one-minute-past-midnight ()
"0:01 should be 1 minute into the day."
- (should (= 1 (chime-get-minutes-into-day "0:01"))))
+ (should (= 1 (chime--get-minutes-into-day "0:01"))))
-;;;; Tests for chime-get-hours-minutes-from-time
+;;;; Tests for chime--get-hours-minutes-from-time
;;; Normal Cases
(ert-deftest test-chime-get-hours-minutes-afternoon ()
"14:30 should return (14 30)."
- (should (equal '(14 30) (chime-get-hours-minutes-from-time "14:30"))))
+ (should (equal '(14 30) (chime--get-hours-minutes-from-time "14:30"))))
(ert-deftest test-chime-get-hours-minutes-morning ()
"8:00 should return (8 0)."
- (should (equal '(8 0) (chime-get-hours-minutes-from-time "8:00"))))
+ (should (equal '(8 0) (chime--get-hours-minutes-from-time "8:00"))))
(ert-deftest test-chime-get-hours-minutes-with-minutes ()
"9:45 should return (9 45)."
- (should (equal '(9 45) (chime-get-hours-minutes-from-time "9:45"))))
+ (should (equal '(9 45) (chime--get-hours-minutes-from-time "9:45"))))
;;; Boundary Cases
(ert-deftest test-chime-get-hours-minutes-midnight ()
"0:00 should return (0 0)."
- (should (equal '(0 0) (chime-get-hours-minutes-from-time "0:00"))))
+ (should (equal '(0 0) (chime--get-hours-minutes-from-time "0:00"))))
(ert-deftest test-chime-get-hours-minutes-exact-hour ()
"10:00 should return (10 0) with no leftover minutes."
- (should (equal '(10 0) (chime-get-hours-minutes-from-time "10:00"))))
+ (should (equal '(10 0) (chime--get-hours-minutes-from-time "10:00"))))
(ert-deftest test-chime-get-hours-minutes-end-of-day ()
"23:59 should return (23 59)."
- (should (equal '(23 59) (chime-get-hours-minutes-from-time "23:59"))))
+ (should (equal '(23 59) (chime--get-hours-minutes-from-time "23:59"))))
(ert-deftest test-chime-get-hours-minutes-noon ()
"12:00 should return (12 0)."
- (should (equal '(12 0) (chime-get-hours-minutes-from-time "12:00"))))
+ (should (equal '(12 0) (chime--get-hours-minutes-from-time "12:00"))))
-;;;; Tests for chime-set-hours-minutes-for-time
+;;;; Tests for chime--set-hours-minutes-for-time
;;; Normal Cases
(ert-deftest test-chime-set-hours-minutes-preserves-date ()
"Setting hours/minutes should preserve the date."
(let* ((base (test-time-tomorrow-at 10 0))
- (result (chime-set-hours-minutes-for-time base 14 30))
+ (result (chime--set-hours-minutes-for-time base 14 30))
(decoded (decode-time result))
(base-decoded (decode-time base)))
;; Date should be the same
@@ -118,7 +118,7 @@
(ert-deftest test-chime-set-hours-minutes-changes-time ()
"Setting different hours/minutes should produce different time."
(let* ((base (test-time-tomorrow-at 10 0))
- (result (chime-set-hours-minutes-for-time base 15 45))
+ (result (chime--set-hours-minutes-for-time base 15 45))
(decoded (decode-time result)))
(should (= 15 (decoded-time-hour decoded)))
(should (= 45 (decoded-time-minute decoded)))))
@@ -128,7 +128,7 @@
(ert-deftest test-chime-set-hours-minutes-midnight ()
"Setting to midnight (0, 0) should work."
(let* ((base (test-time-tomorrow-at 10 0))
- (result (chime-set-hours-minutes-for-time base 0 0))
+ (result (chime--set-hours-minutes-for-time base 0 0))
(decoded (decode-time result)))
(should (= 0 (decoded-time-hour decoded)))
(should (= 0 (decoded-time-minute decoded)))))
@@ -136,7 +136,7 @@
(ert-deftest test-chime-set-hours-minutes-end-of-day ()
"Setting to 23:59 should work."
(let* ((base (test-time-tomorrow-at 10 0))
- (result (chime-set-hours-minutes-for-time base 23 59))
+ (result (chime--set-hours-minutes-for-time base 23 59))
(decoded (decode-time result)))
(should (= 23 (decoded-time-hour decoded)))
(should (= 59 (decoded-time-minute decoded)))))
@@ -144,8 +144,8 @@
(ert-deftest test-chime-set-hours-minutes-roundtrip ()
"Extracting hours/minutes and setting them back should produce same time-of-day."
(let* ((base (test-time-tomorrow-at 14 30))
- (hm (chime-get-hours-minutes-from-time "14:30"))
- (result (chime-set-hours-minutes-for-time base (car hm) (cadr hm)))
+ (hm (chime--get-hours-minutes-from-time "14:30"))
+ (result (chime--set-hours-minutes-for-time base (car hm) (cadr hm)))
(decoded (decode-time result)))
(should (= 14 (decoded-time-hour decoded)))
(should (= 30 (decoded-time-minute decoded)))))
@@ -153,7 +153,7 @@
(ert-deftest test-chime-set-hours-minutes-seconds-always-zero ()
"Seconds should always be set to 0 regardless of base time."
(let* ((base (test-time-now)) ;; may have non-zero seconds internally
- (result (chime-set-hours-minutes-for-time base 10 0))
+ (result (chime--set-hours-minutes-for-time base 10 0))
(decoded (decode-time result)))
(should (= 0 (decoded-time-second decoded)))))