From 74ca4e066bc41ce0a6e94e2d4bc0c838df45a838 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Wed, 22 Apr 2026 09:43:02 -0500 Subject: 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. --- tests/test-chime-time-utilities.el | 64 +++++++++++++++++++------------------- 1 file changed, 32 insertions(+), 32 deletions(-) (limited to 'tests/test-chime-time-utilities.el') 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))))) -- cgit v1.2.3