From d9763647f85629ffb80ac85b136880ad3b7da627 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Mon, 29 Jun 2026 04:19:31 -0400 Subject: 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. --- tests/test-local-repository--car-member.el | 40 +++++++++++++++--------------- 1 file changed, 20 insertions(+), 20 deletions(-) (limited to 'tests/test-local-repository--car-member.el') diff --git a/tests/test-local-repository--car-member.el b/tests/test-local-repository--car-member.el index 8b8c9a7d..30ae58c6 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 -- cgit v1.2.3