summaryrefslogtreecommitdiff
path: root/test/lisp/erc/erc-tests.el
diff options
context:
space:
mode:
authorF. Jason Park <jp@neverwas.me>2021-08-16 05:01:16 -0700
committerF. Jason Park <jp@neverwas.me>2022-06-30 15:03:26 -0700
commit1c24af0fcb8a8326fe5cdc75672bf4099b191a00 (patch)
treee6015d2a97e73b22f9208b406f34543a1dcfb287 /test/lisp/erc/erc-tests.el
parent4e312c07f7a6998a818901e46341356316d248e0 (diff)
downloademacs-1c24af0fcb8a8326fe5cdc75672bf4099b191a00.tar.gz
emacs-1c24af0fcb8a8326fe5cdc75672bf4099b191a00.tar.bz2
emacs-1c24af0fcb8a8326fe5cdc75672bf4099b191a00.zip
Add helper to determine local channels in ERC
* lisp/erc/erc.el (erc--valid-local-channel-p): Add internal helper to determine whether an IRC channel is local according to its network's CHANTYPES ISUPPORT parameter. * test/lisp/erc/erc-tests.el (erc--valid-local-channel-p): Add test for this helper.
Diffstat (limited to 'test/lisp/erc/erc-tests.el')
-rw-r--r--test/lisp/erc/erc-tests.el12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/lisp/erc/erc-tests.el b/test/lisp/erc/erc-tests.el
index cffb61f7084..4026ebaf335 100644
--- a/test/lisp/erc/erc-tests.el
+++ b/test/lisp/erc/erc-tests.el
@@ -466,6 +466,18 @@
(should (equal (erc-downcase "Tilde~") "tilde~" ))
(should (equal (erc-downcase "\\O/") "|o/" )))))
+(ert-deftest erc--valid-local-channel-p ()
+ (ert-info ("Local channels not supported")
+ (let ((erc--isupport-params (make-hash-table)))
+ (puthash 'CHANTYPES '("#") erc--isupport-params)
+ (should-not (erc--valid-local-channel-p "#chan"))
+ (should-not (erc--valid-local-channel-p "&local"))))
+ (ert-info ("Local channels supported")
+ (let ((erc--isupport-params (make-hash-table)))
+ (puthash 'CHANTYPES '("&#") erc--isupport-params)
+ (should-not (erc--valid-local-channel-p "#chan"))
+ (should (erc--valid-local-channel-p "&local")))))
+
(ert-deftest erc-ring-previous-command-base-case ()
(ert-info ("Create ring when nonexistent and do nothing")
(let (erc-input-ring