aboutsummaryrefslogtreecommitdiff
path: root/tests/test-chime-day-wide-time-matching.el
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/test-chime-day-wide-time-matching.el
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/test-chime-day-wide-time-matching.el')
-rw-r--r--tests/test-chime-day-wide-time-matching.el34
1 files changed, 17 insertions, 17 deletions
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