aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorF. Jason Park2024-01-03 23:10:55 -0800
committerF. Jason Park2024-01-07 15:11:26 -0800
commit37e87bc3eeb8e62e2900d73cf4dd9fc9e942d66d (patch)
tree520859a64dbb82b243e53680553712f623a2ddaf /test
parentd6f9379d1c708dddc0543bf7242ba1ec6aee9746 (diff)
downloademacs-37e87bc3eeb8e62e2900d73cf4dd9fc9e942d66d.tar.gz
emacs-37e87bc3eeb8e62e2900d73cf4dd9fc9e942d66d.zip
Make ERC's format catalogs more extensible
* lisp/erc/erc-common.el (erc--define-catalog): Accept a `:parent' keyword to allow for extending an existing catalog by overriding some subset of defined entries. (erc-define-message-format-catalog): Add edebug spec. * lisp/erc/erc.el (erc-retrieve-catalog-entry): Check parent for definition before looking to `default-toplevel-value'. * test/lisp/erc/erc-tests.el (erc-retrieve-catalog-entry): Add test case for inheritance. * test/lisp/erc/resources/erc-tests-common.el (erc-tests-common-pp-propertized-parts): Fix bug in convenience command. (Bug#67677)
Diffstat (limited to 'test')
-rw-r--r--test/lisp/erc/erc-tests.el16
-rw-r--r--test/lisp/erc/resources/erc-tests-common.el2
2 files changed, 16 insertions, 2 deletions
diff --git a/test/lisp/erc/erc-tests.el b/test/lisp/erc/erc-tests.el
index a9aa255718d..a71cc806f6a 100644
--- a/test/lisp/erc/erc-tests.el
+++ b/test/lisp/erc/erc-tests.el
@@ -3533,6 +3533,20 @@ connection."
3533 (should (equal (erc-retrieve-catalog-entry 's221) "test-top 221 val")) 3533 (should (equal (erc-retrieve-catalog-entry 's221) "test-top 221 val"))
3534 3534
3535 (makunbound (intern "erc-message-test-top-s221")) 3535 (makunbound (intern "erc-message-test-top-s221"))
3536 (unintern "erc-message-test-top-s221" obarray)) 3536 (unintern "erc-message-test-top-s221" obarray)
3537
3538 ;; Inheritance.
3539 (let ((obarray (obarray-make)))
3540 (set (intern "erc-message-test1-abc") "val test1 abc")
3541 (set (intern "erc-message-test2-abc") "val test2 abc")
3542 (set (intern "erc-message-test2-def") "val test2 def")
3543 (put (intern "test0") 'erc--base-format-catalog (intern "test1"))
3544 (put (intern "test1") 'erc--base-format-catalog (intern "test2"))
3545 (should (equal (erc-retrieve-catalog-entry 'abc (intern "test0"))
3546 "val test1 abc"))
3547 (should (equal (erc-retrieve-catalog-entry 'def (intern "test0"))
3548 "val test2 def"))
3549 ;; Terminates.
3550 (should-not (erc-retrieve-catalog-entry 'ghi (intern "test0")))))
3537 3551
3538;;; erc-tests.el ends here 3552;;; erc-tests.el ends here
diff --git a/test/lisp/erc/resources/erc-tests-common.el b/test/lisp/erc/resources/erc-tests-common.el
index fc5649798b5..906aa891352 100644
--- a/test/lisp/erc/resources/erc-tests-common.el
+++ b/test/lisp/erc/resources/erc-tests-common.el
@@ -150,7 +150,7 @@ between literal strings."
150For simplicity, assume string evaluates to itself." 150For simplicity, assume string evaluates to itself."
151 (interactive "P") 151 (interactive "P")
152 (let ((sexp (erc-tests-common-string-to-propertized-parts (pp-last-sexp)))) 152 (let ((sexp (erc-tests-common-string-to-propertized-parts (pp-last-sexp))))
153 (if arg (insert (pp-to-string sexp)) (pp-eval-expression sexp)))) 153 (if arg (insert (pp-to-string sexp)) (pp-macroexpand-expression sexp))))
154 154
155;; The following utilities are meant to help prepare tests for 155;; The following utilities are meant to help prepare tests for
156;; `erc--get-inserted-msg-bounds' and friends. 156;; `erc--get-inserted-msg-bounds' and friends.