emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master dc7c38ed9ec 1/2: ; Slightly improve test case for erc-parse-modes


From: F. Jason Park
Subject: master dc7c38ed9ec 1/2: ; Slightly improve test case for erc-parse-modes
Date: Mon, 9 Dec 2024 14:49:58 -0500 (EST)

branch: master
commit dc7c38ed9ec85e2e7cbe3c9fcb3b6d5dbb5aa206
Author: F. Jason Park <jp@neverwas.me>
Commit: F. Jason Park <jp@neverwas.me>

    ; 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.
---
 lisp/erc/erc.el            | 6 +++---
 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."
   (if old-vars
       (let ((out (list (reverse new-modes))))
         (pcase-dolist (`(,k . ,v) old-vars)
-          (when (and (string-prefix-p "erc-" (symbol-name k))
-                     (string-suffix-p "-mode" (symbol-name k))
-                     (get k 'erc-module))
+          (when (and (get k 'erc-module)
+                     (string-prefix-p "erc-" (symbol-name k))
+                     (string-suffix-p "-mode" (symbol-name k)))
             (if v
                 (cl-pushnew k (car out))
               (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 @@
     (should (equal (erc-parse-modes "-o bob") '(nil nil (("o" off "bob")))))
     (should (equal (erc-parse-modes "+uo bob") '(("u") nil (("o" on "bob")))))
     (should (equal (erc-parse-modes "+o-u bob") '(nil ("u") (("o" on "bob")))))
+
     (should (equal (erc-parse-modes "+uo-tv bob alice")
                    '(("u") ("t") (("o" on "bob") ("v" off "alice")))))
+    (should (equal (erc-parse-modes "+u-t+o-v bob alice")
+                   '(("u") ("t") (("o" on "bob") ("v" off "alice")))))
 
     (ert-info ("Modes of type B are always grouped as unary")
       (should (equal (erc-parse-modes "+k h2") '(nil nil (("k" on "h2")))))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]