diff options
| author | Craig Jennings <c@cjennings.net> | 2026-05-05 12:24:56 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-05-05 12:24:56 -0500 |
| commit | 0b65f607102c12260c7cca5df3d8586c2b1a24bd (patch) | |
| tree | d3b3128ffb09e8bb44a9f631c72fee9a32a76f65 /tests | |
| parent | ef8d5819b3cab677828e2ac21e780c78227acedb (diff) | |
| download | chime-0b65f607102c12260c7cca5df3d8586c2b1a24bd.tar.gz chime-0b65f607102c12260c7cca5df3d8586c2b1a24bd.zip | |
refactor!: demote chime-validation-max-retries to private defvar
This is an internal startup-timing parameter, not a knob real users have
reason to tune through `M-x customize'. I demoted it from defcustom to
defvar and renamed it to `chime--validation-max-retries' to make the
private status explicit. Anyone who was overriding it can keep doing so
with `setq' (the variable still exists, just under the new name).
The three customize-time validation tests went away with the defcustom —
nothing left to validate at customize-time once it stops being a
customize-target. The setter helper still applies to the other five
numeric defcustoms.
Test files that referenced the variable (`test-chime-validation-retry.el',
`test-integration-chime-mode.el') were renamed mechanically along with
the source.
Breaking change: `(setq chime-validation-max-retries N)' becomes
`(setq chime--validation-max-retries N)' if you actually had it. Most
users won't have touched it.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/test-chime-numeric-defcustom-setters.el | 22 | ||||
| -rw-r--r-- | tests/test-chime-validation-retry.el | 24 | ||||
| -rw-r--r-- | tests/test-integration-chime-mode.el | 2 |
3 files changed, 15 insertions, 33 deletions
diff --git a/tests/test-chime-numeric-defcustom-setters.el b/tests/test-chime-numeric-defcustom-setters.el index 03d7810..7fb5afa 100644 --- a/tests/test-chime-numeric-defcustom-setters.el +++ b/tests/test-chime-numeric-defcustom-setters.el @@ -161,26 +161,8 @@ 'chime-max-consecutive-failures -1) :type 'user-error))) -;;;; chime-validation-max-retries — integer >= 0 - -(ert-deftest test-chime-validation-max-retries-accepts-zero () - "Normal: 0 means show errors immediately without retrying (per docstring)." - (let ((chime-validation-max-retries 3)) - (customize-set-variable 'chime-validation-max-retries 0) - (should (= 0 chime-validation-max-retries)))) - -(ert-deftest test-chime-validation-max-retries-accepts-positive () - "Normal: positive integer is valid." - (let ((chime-validation-max-retries 3)) - (customize-set-variable 'chime-validation-max-retries 5) - (should (= 5 chime-validation-max-retries)))) - -(ert-deftest test-chime-validation-max-retries-rejects-negative () - "Error: negative retry count is meaningless." - (let ((chime-validation-max-retries 3)) - (should-error (customize-set-variable - 'chime-validation-max-retries -1) - :type 'user-error))) +;; Note: `chime--validation-max-retries' was demoted from defcustom to +;; defvar in 0.8 — no customize-time setter, no validation tests here. (provide 'test-chime-numeric-defcustom-setters) ;;; test-chime-numeric-defcustom-setters.el ends here diff --git a/tests/test-chime-validation-retry.el b/tests/test-chime-validation-retry.el index b4e886c..70188bc 100644 --- a/tests/test-chime-validation-retry.el +++ b/tests/test-chime-validation-retry.el @@ -12,7 +12,7 @@ ;; ;; Components tested: ;; - chime--validation-retry-count tracking -;; - chime-validation-max-retries configuration +;; - chime--validation-max-retries configuration ;; - chime-check validation retry logic ;; - chime--stop retry counter reset ;; - Message display behavior (waiting vs error) @@ -24,7 +24,7 @@ ;;; Setup and Teardown (defvar test-chime-validation-retry--original-max-retries nil - "Original value of chime-validation-max-retries for restoration.") + "Original value of chime--validation-max-retries for restoration.") (defvar test-chime-validation-retry--original-agenda-files nil "Original value of org-agenda-files for restoration.") @@ -32,7 +32,7 @@ (defun test-chime-validation-retry-setup () "Set up test environment before each test." ;; Save original values - (setq test-chime-validation-retry--original-max-retries chime-validation-max-retries) + (setq test-chime-validation-retry--original-max-retries chime--validation-max-retries) (setq test-chime-validation-retry--original-agenda-files org-agenda-files) ;; Reset validation state @@ -40,12 +40,12 @@ (setq chime--validation-retry-count 0) ;; Set predictable defaults - (setq chime-validation-max-retries 3)) + (setq chime--validation-max-retries 3)) (defun test-chime-validation-retry-teardown () "Clean up test environment after each test." ;; Restore original values - (setq chime-validation-max-retries test-chime-validation-retry--original-max-retries) + (setq chime--validation-max-retries test-chime-validation-retry--original-max-retries) (setq org-agenda-files test-chime-validation-retry--original-agenda-files) ;; Reset validation state @@ -179,14 +179,14 @@ process events normally." (ert-deftest test-chime-validation-retry-boundary-max-retries-zero () "Test max-retries=0 shows error immediately without retrying. -When chime-validation-max-retries is set to 0, validation failures +When chime--validation-max-retries is set to 0, validation failures should immediately show the full error message without any retry attempts." (test-chime-validation-retry-setup) (unwind-protect (progn ;; Set max retries to 0 - (setq chime-validation-max-retries 0) + (setq chime--validation-max-retries 0) ;; Empty org-agenda-files (setq org-agenda-files nil) @@ -222,7 +222,7 @@ show full error." (unwind-protect (progn ;; Set max retries to 1 - (setq chime-validation-max-retries 1) + (setq chime--validation-max-retries 1) ;; Empty org-agenda-files (setq org-agenda-files nil) @@ -261,7 +261,7 @@ The (retry_count + 1)th attempt should show the error message." (unwind-protect (progn ;; Default max retries = 3 - (setq chime-validation-max-retries 3) + (setq chime--validation-max-retries 3) (setq org-agenda-files nil) (cl-letf (((symbol-function 'chime--fetch-and-process) @@ -346,7 +346,7 @@ displayed with all error details in the *Messages* buffer." (test-chime-validation-retry-setup) (unwind-protect (progn - (setq chime-validation-max-retries 2) + (setq chime--validation-max-retries 2) (setq org-agenda-files nil) (cl-letf (((symbol-function 'chime--fetch-and-process) @@ -380,7 +380,7 @@ validation should never be marked as done." (test-chime-validation-retry-setup) (unwind-protect (progn - (setq chime-validation-max-retries 3) + (setq chime--validation-max-retries 3) (setq org-agenda-files nil) (cl-letf (((symbol-function 'chime--fetch-and-process) @@ -406,7 +406,7 @@ many retry attempts, ensuring no integer overflow issues." (test-chime-validation-retry-setup) (unwind-protect (progn - (setq chime-validation-max-retries 1000) + (setq chime--validation-max-retries 1000) (setq org-agenda-files nil) (cl-letf (((symbol-function 'chime--fetch-and-process) diff --git a/tests/test-integration-chime-mode.el b/tests/test-integration-chime-mode.el index cd1fec5..40436fb 100644 --- a/tests/test-integration-chime-mode.el +++ b/tests/test-integration-chime-mode.el @@ -105,7 +105,7 @@ in the tooltip, not go blank." (org-agenda-files nil) (chime--validation-done nil) (chime--validation-retry-count 0) - (chime-validation-max-retries 0)) + (chime--validation-max-retries 0)) (unwind-protect (progn (chime-mode 1) |
