diff options
| author | Craig Jennings <c@cjennings.net> | 2026-05-16 02:48:18 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-05-16 02:48:18 -0500 |
| commit | 19a73261008dc8d4fa497f1d64ad57fa845674ce (patch) | |
| tree | a0f3907bf2d915ce3b29702da82790fffe59a395 /tests | |
| parent | 9ef8a29f27a5ed645adb484e2332e2ad8de5a8e1 (diff) | |
| download | dotemacs-19a73261008dc8d4fa497f1d64ad57fa845674ce.tar.gz dotemacs-19a73261008dc8d4fa497f1d64ad57fa845674ce.zip | |
refactor(custom-editing): five hygiene fixes from the module-by-module re-review
- Guard `cj/duplicate-line-or-region' when COMMENT is non-nil but the
current mode has no `comment-start' (e.g. fundamental-mode).
Previously the function silently produced malformed output via
`comment-region'; now it signals a clear `user-error'.
- Factor the `find-file' advice install in external-open.el into
`cj/external-open-install-advice'. Same idempotent shape
(remove-then-add) but the intent is named.
- Add `cj/--validate-decoration-char' in custom-comments.el and
wire it into all six divider / border / box helpers. Rejects
multi-char strings, empty strings, and control characters like
newline/tab that would corrupt subsequent `M-q' flows. Updated
the five nil-decoration ERT tests from `:type 'wrong-type-argument'
(the old crash signal from `string-to-char' on nil) to
`:type 'user-error', since the validator produces a clear
message instead of a deep crash.
- Extract `cj/--require-spell-checker' in flyspell-and-abbrev.el.
Both `cj/flyspell-toggle' and `cj/flyspell-then-abbrev' now call
the shared helper; the checker list lives in
`cj/--spell-checker-executables', so adding nuspell or any other
checker is a one-line edit.
- Preserve trailing newlines in custom-ordering output. Both
`cj/--arrayify' and `cj/--unarrayify' now detect a trailing
newline on the input region and re-append it to the result,
matching the pattern custom-text-enclose.el already uses.
Diffstat (limited to 'tests')
6 files changed, 9 insertions, 7 deletions
diff --git a/tests/test-custom-comments-comment-block-banner.el b/tests/test-custom-comments-comment-block-banner.el index 6561ebfab..da0b1fa7f 100644 --- a/tests/test-custom-comments-comment-block-banner.el +++ b/tests/test-custom-comments-comment-block-banner.el @@ -194,7 +194,7 @@ Returns the buffer string for assertions." "Should error when decoration-char is nil." (should-error (test-block-banner-at-column 0 "/*" "*/" nil "Header" 70) - :type 'wrong-type-argument)) + :type 'user-error)) (ert-deftest test-block-banner-c-nil-text () "Should error when text is nil." diff --git a/tests/test-custom-comments-comment-box.el b/tests/test-custom-comments-comment-box.el index 10b1a67d0..d7ee2830c 100644 --- a/tests/test-custom-comments-comment-box.el +++ b/tests/test-custom-comments-comment-box.el @@ -203,7 +203,7 @@ Returns the buffer string for assertions." "Should error when decoration-char is nil." (should-error (test-comment-box-at-column 0 ";;" "" nil "Header" 70) - :type 'wrong-type-argument)) + :type 'user-error)) (ert-deftest test-comment-box-elisp-non-integer-length () "Should error when length is not an integer." diff --git a/tests/test-custom-comments-comment-heavy-box.el b/tests/test-custom-comments-comment-heavy-box.el index 302896252..94d4aaa5f 100644 --- a/tests/test-custom-comments-comment-heavy-box.el +++ b/tests/test-custom-comments-comment-heavy-box.el @@ -207,7 +207,7 @@ Returns the buffer string for assertions." "Should error when decoration-char is nil." (should-error (test-heavy-box-at-column 0 ";;" "" nil "Header" 70) - :type 'wrong-type-argument)) + :type 'user-error)) (ert-deftest test-heavy-box-elisp-nil-text () "Should error when text is nil." diff --git a/tests/test-custom-comments-comment-inline-border.el b/tests/test-custom-comments-comment-inline-border.el index ca2bef06c..78e860353 100644 --- a/tests/test-custom-comments-comment-inline-border.el +++ b/tests/test-custom-comments-comment-inline-border.el @@ -190,10 +190,12 @@ Returns the buffer string for assertions." :type 'error)) (ert-deftest test-inline-border-elisp-nil-decoration () - "Should error when decoration-char is nil." + "Should error when decoration-char is nil. +The decoration-char validator signals `user-error' for any non-printable +or non-single-character input." (should-error (test-inline-border-at-column 0 ";;" "" nil "Header" 70) - :type 'wrong-type-argument)) + :type 'user-error)) (ert-deftest test-inline-border-elisp-non-integer-length () "Should error when length is not an integer." diff --git a/tests/test-custom-comments-comment-padded-divider.el b/tests/test-custom-comments-comment-padded-divider.el index 702a4c675..d4c189052 100644 --- a/tests/test-custom-comments-comment-padded-divider.el +++ b/tests/test-custom-comments-comment-padded-divider.el @@ -200,7 +200,7 @@ Returns the buffer string for assertions." "Should error when decoration-char is nil." (should-error (test-padded-divider-at-column 0 ";;" "" nil "Header" 70 2) - :type 'wrong-type-argument)) + :type 'user-error)) (ert-deftest test-padded-divider-elisp-nil-text () "Should error when text is nil." diff --git a/tests/test-custom-comments-comment-simple-divider.el b/tests/test-custom-comments-comment-simple-divider.el index a61e6b4cf..7979f18b7 100644 --- a/tests/test-custom-comments-comment-simple-divider.el +++ b/tests/test-custom-comments-comment-simple-divider.el @@ -195,7 +195,7 @@ Returns the buffer string for assertions." "Should error when decoration-char is nil." (should-error (test-simple-divider-at-column 0 ";;" "" nil "Header" 70) - :type 'wrong-type-argument)) + :type 'user-error)) (ert-deftest test-simple-divider-elisp-nil-text () "Should error when text is nil." |
