diff options
| author | F. Jason Park | 2024-12-06 19:09:04 -0800 |
|---|---|---|
| committer | F. Jason Park | 2024-12-09 11:42:45 -0800 |
| commit | dc7c38ed9ec85e2e7cbe3c9fcb3b6d5dbb5aa206 (patch) | |
| tree | e1f56573f0b2e6fbb92aaefdfcf768e8c18dc6ec | |
| parent | d719a8140917e3b1dd6889f064ffb8e8b0621c7d (diff) | |
| download | emacs-dc7c38ed9ec85e2e7cbe3c9fcb3b6d5dbb5aa206.tar.gz emacs-dc7c38ed9ec85e2e7cbe3c9fcb3b6d5dbb5aa206.zip | |
; Slightly improve test case for erc-parse-modes
* lisp/erc/erc.el (erc--merge-local-modes): Look for a symbol's
`erc-module' property before examining its name.
* test/lisp/erc/erc-tests.el (erc-parse-modes): Expand case to cover
alternating plus and minus mode changes.
| -rw-r--r-- | lisp/erc/erc.el | 6 | ||||
| -rw-r--r-- | test/lisp/erc/erc-tests.el | 3 |
2 files changed, 6 insertions, 3 deletions
diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el index ad279a0ff66..7f753e34d03 100644 --- a/lisp/erc/erc.el +++ b/lisp/erc/erc.el | |||
| @@ -2519,9 +2519,9 @@ nil." | |||
| 2519 | (if old-vars | 2519 | (if old-vars |
| 2520 | (let ((out (list (reverse new-modes)))) | 2520 | (let ((out (list (reverse new-modes)))) |
| 2521 | (pcase-dolist (`(,k . ,v) old-vars) | 2521 | (pcase-dolist (`(,k . ,v) old-vars) |
| 2522 | (when (and (string-prefix-p "erc-" (symbol-name k)) | 2522 | (when (and (get k 'erc-module) |
| 2523 | (string-suffix-p "-mode" (symbol-name k)) | 2523 | (string-prefix-p "erc-" (symbol-name k)) |
| 2524 | (get k 'erc-module)) | 2524 | (string-suffix-p "-mode" (symbol-name k))) |
| 2525 | (if v | 2525 | (if v |
| 2526 | (cl-pushnew k (car out)) | 2526 | (cl-pushnew k (car out)) |
| 2527 | (setf (car out) (delq k (car out))) | 2527 | (setf (car out) (delq k (car out))) |
diff --git a/test/lisp/erc/erc-tests.el b/test/lisp/erc/erc-tests.el index d77d8588dad..eaff5640aa0 100644 --- a/test/lisp/erc/erc-tests.el +++ b/test/lisp/erc/erc-tests.el | |||
| @@ -825,8 +825,11 @@ | |||
| 825 | (should (equal (erc-parse-modes "-o bob") '(nil nil (("o" off "bob"))))) | 825 | (should (equal (erc-parse-modes "-o bob") '(nil nil (("o" off "bob"))))) |
| 826 | (should (equal (erc-parse-modes "+uo bob") '(("u") nil (("o" on "bob"))))) | 826 | (should (equal (erc-parse-modes "+uo bob") '(("u") nil (("o" on "bob"))))) |
| 827 | (should (equal (erc-parse-modes "+o-u bob") '(nil ("u") (("o" on "bob"))))) | 827 | (should (equal (erc-parse-modes "+o-u bob") '(nil ("u") (("o" on "bob"))))) |
| 828 | |||
| 828 | (should (equal (erc-parse-modes "+uo-tv bob alice") | 829 | (should (equal (erc-parse-modes "+uo-tv bob alice") |
| 829 | '(("u") ("t") (("o" on "bob") ("v" off "alice"))))) | 830 | '(("u") ("t") (("o" on "bob") ("v" off "alice"))))) |
| 831 | (should (equal (erc-parse-modes "+u-t+o-v bob alice") | ||
| 832 | '(("u") ("t") (("o" on "bob") ("v" off "alice"))))) | ||
| 830 | 833 | ||
| 831 | (ert-info ("Modes of type B are always grouped as unary") | 834 | (ert-info ("Modes of type B are always grouped as unary") |
| 832 | (should (equal (erc-parse-modes "+k h2") '(nil nil (("k" on "h2"))))) | 835 | (should (equal (erc-parse-modes "+k h2") '(nil nil (("k" on "h2"))))) |