aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-06-29 04:19:31 -0400
committerCraig Jennings <c@cjennings.net>2026-06-29 04:19:31 -0400
commit256027866f9ff2cbc3b6155950f21a92b54ea307 (patch)
treee63cd2b63bfbd8f893313e5a900710c353e905e9 /tests
parent8c91731f5ba177d9f0f7c078576ddd91c606ed7c (diff)
downloaddotemacs-256027866f9ff2cbc3b6155950f21a92b54ea307.tar.gz
dotemacs-256027866f9ff2cbc3b6155950f21a92b54ea307.zip
refactor: prefix two collision-prone helpers, document naming audit
Two owned helpers carried unprefixed generic names that risk colliding in the single Emacs namespace: car-member (local-repository.el) and unpropertize-kill-ring (system-defaults.el). I renamed them to localrepo--car-member and cj/--unpropertize-kill-ring and updated their callers and tests. Both are non-interactive and contained, so no alias was needed. docs/design/naming-audit.org records the rest of the scan: the allowlist of deliberate module prefixes, the foreign forward-declarations that aren't owned definitions, and a deferred list (keybound commands, the with-timer macro, the ui-theme defcustoms, the user-constants paths) that each want a focused pass rather than an unattended rename.
Diffstat (limited to 'tests')
-rw-r--r--tests/test-local-repository--car-member.el40
-rw-r--r--tests/test-system-defaults-functions.el8
-rw-r--r--tests/test-system-defaults.el2
3 files changed, 25 insertions, 25 deletions
diff --git a/tests/test-local-repository--car-member.el b/tests/test-local-repository--car-member.el
index 8b8c9a7db..30ae58c6b 100644
--- a/tests/test-local-repository--car-member.el
+++ b/tests/test-local-repository--car-member.el
@@ -1,7 +1,7 @@
-;;; test-local-repository--car-member.el --- Tests for car-member -*- lexical-binding: t -*-
+;;; test-local-repository--car-member.el --- Tests for localrepo--car-member -*- lexical-binding: t -*-
;;; Commentary:
-;; Tests for `car-member' in local-repository.el — the predicate
+;; Tests for `localrepo--car-member' in local-repository.el — the predicate
;; localrepo-initialize uses to check whether an archive id is already
;; registered in package-archives / package-archive-priorities.
@@ -12,47 +12,47 @@
;;; Normal Cases
-(ert-deftest test-local-repository-car-member-found ()
+(ert-deftest test-local-repository-localrepo--car-member-found ()
"Normal: VALUE present as a car returns the matching tail (non-nil)."
- (should (equal (car-member 'b '((a . 1) (b . 2) (c . 3)))
+ (should (equal (localrepo--car-member 'b '((a . 1) (b . 2) (c . 3)))
'(b c))))
-(ert-deftest test-local-repository-car-member-not-found ()
+(ert-deftest test-local-repository-localrepo--car-member-not-found ()
"Normal: VALUE absent from every car returns nil."
- (should-not (car-member 'z '((a . 1) (b . 2)))))
+ (should-not (localrepo--car-member 'z '((a . 1) (b . 2)))))
-(ert-deftest test-local-repository-car-member-string-car ()
+(ert-deftest test-local-repository-localrepo--car-member-string-car ()
"Normal: car comparison uses `equal', so string keys match by value."
- (should (car-member "localrepo"
+ (should (localrepo--car-member "localrepo"
'(("gnu" . "url1") ("localrepo" . "url2")))))
;;; Boundary Cases
-(ert-deftest test-local-repository-car-member-empty-list ()
+(ert-deftest test-local-repository-localrepo--car-member-empty-list ()
"Boundary: an empty list never matches."
- (should-not (car-member 'a nil)))
+ (should-not (localrepo--car-member 'a nil)))
-(ert-deftest test-local-repository-car-member-single-match ()
+(ert-deftest test-local-repository-localrepo--car-member-single-match ()
"Boundary: a single-element list whose car matches returns non-nil."
- (should (car-member 'only '((only . 1)))))
+ (should (localrepo--car-member 'only '((only . 1)))))
-(ert-deftest test-local-repository-car-member-single-no-match ()
+(ert-deftest test-local-repository-localrepo--car-member-single-no-match ()
"Boundary: a single-element list whose car differs returns nil."
- (should-not (car-member 'x '((only . 1)))))
+ (should-not (localrepo--car-member 'x '((only . 1)))))
-(ert-deftest test-local-repository-car-member-nil-value-with-nil-car ()
+(ert-deftest test-local-repository-localrepo--car-member-nil-value-with-nil-car ()
"Boundary: a nil VALUE matches a cons whose car is nil."
- (should (car-member nil '((nil . 1) (a . 2)))))
+ (should (localrepo--car-member nil '((nil . 1) (a . 2)))))
-(ert-deftest test-local-repository-car-member-nil-value-no-nil-car ()
+(ert-deftest test-local-repository-localrepo--car-member-nil-value-no-nil-car ()
"Boundary: a nil VALUE with no nil car returns nil."
- (should-not (car-member nil '((a . 1) (b . 2)))))
+ (should-not (localrepo--car-member nil '((a . 1) (b . 2)))))
;;; Error Cases
-(ert-deftest test-local-repository-car-member-non-cons-element ()
+(ert-deftest test-local-repository-localrepo--car-member-non-cons-element ()
"Error: a non-cons element makes `car' signal wrong-type-argument."
- (should-error (car-member 'x '(1 2)) :type 'wrong-type-argument))
+ (should-error (localrepo--car-member 'x '(1 2)) :type 'wrong-type-argument))
(provide 'test-local-repository--car-member)
;;; test-local-repository--car-member.el ends here
diff --git a/tests/test-system-defaults-functions.el b/tests/test-system-defaults-functions.el
index 2562ff6aa..c603fc7eb 100644
--- a/tests/test-system-defaults-functions.el
+++ b/tests/test-system-defaults-functions.el
@@ -9,7 +9,7 @@
;; cj/minibuffer-setup-hook -- inflate gc-cons-threshold while
;; typing in the minibuffer
;; cj/minibuffer-exit-hook -- restore gc-cons-threshold on exit
-;; unpropertize-kill-ring -- strip text properties from
+;; cj/--unpropertize-kill-ring -- strip text properties from
;; kill-ring at shutdown
;; cj/log-comp-warning -- route native-comp warnings to a
;; file rather than the *Warnings*
@@ -79,13 +79,13 @@
(should (eq (cj/disabled) nil))
(should (commandp #'cj/disabled)))
-;;; unpropertize-kill-ring
+;;; cj/--unpropertize-kill-ring
(ert-deftest test-system-defaults-unpropertize-kill-ring-strips-properties ()
"Normal: every kill-ring entry comes back with no text properties."
(let ((kill-ring (list (propertize "alpha" 'face 'bold)
(propertize "beta" 'face 'underline))))
- (unpropertize-kill-ring)
+ (cj/--unpropertize-kill-ring)
(should (equal kill-ring '("alpha" "beta")))
(should-not (text-properties-at 0 (nth 0 kill-ring)))
(should-not (text-properties-at 0 (nth 1 kill-ring)))))
@@ -93,7 +93,7 @@
(ert-deftest test-system-defaults-unpropertize-kill-ring-boundary-empty-ring ()
"Boundary: an empty `kill-ring' stays empty after the strip pass."
(let ((kill-ring nil))
- (unpropertize-kill-ring)
+ (cj/--unpropertize-kill-ring)
(should (null kill-ring))))
;;; cj/log-comp-warning
diff --git a/tests/test-system-defaults.el b/tests/test-system-defaults.el
index f653e1fbb..a641adea1 100644
--- a/tests/test-system-defaults.el
+++ b/tests/test-system-defaults.el
@@ -8,7 +8,7 @@
;; writes land, where backups go, and whether the minibuffer GC hooks are
;; installed. Load happens in the shared sandbox (testutil-system-defaults.el).
;;
-;; The module's functions (cj/disabled, the GC hook bodies, unpropertize-kill-ring,
+;; The module's functions (cj/disabled, the GC hook bodies, cj/--unpropertize-kill-ring,
;; cj/log-comp-warning) are covered by test-system-defaults-functions.el, and the
;; vc-follow-symlinks default by test-system-defaults-vc-follow-symlinks.el.