summaryrefslogtreecommitdiff
path: root/test/lisp/erc/erc-tests.el
diff options
context:
space:
mode:
authorF. Jason Park <jp@neverwas.me>2021-06-13 02:15:55 -0700
committerLars Ingebrigtsen <larsi@gnus.org>2021-11-06 19:13:35 +0100
commit1b1d387b96ebeb8330a76240db0cda6b8cefdf1f (patch)
treeb4c94c283b90f139bbb5c1f822dca0a4230a232c /test/lisp/erc/erc-tests.el
parentdedab1c30da26d3741928cdad5e9fcf3075a2726 (diff)
downloademacs-1b1d387b96ebeb8330a76240db0cda6b8cefdf1f.tar.gz
Don't send empty lines for unknown commands in ERC
* lisp/erc/erc.el (erc-cmd-default): prevent excess trailing newlines from being sent. * test/lisp/erc/erc-tests.el: Update `erc-process-input-line' test to check for excess line feeds with unknown commands.
Diffstat (limited to 'test/lisp/erc/erc-tests.el')
-rw-r--r--test/lisp/erc/erc-tests.el15
1 files changed, 12 insertions, 3 deletions
diff --git a/test/lisp/erc/erc-tests.el b/test/lisp/erc/erc-tests.el
index 685f4e2bea2..b2dbc1012de 100644
--- a/test/lisp/erc/erc-tests.el
+++ b/test/lisp/erc/erc-tests.el
@@ -236,6 +236,7 @@
(let (erc-server-last-sent-time
erc-server-flood-queue
(orig-erc-cmd-MSG (symbol-function 'erc-cmd-MSG))
+ (erc-default-recipients '("#chan"))
calls)
(with-temp-buffer
(cl-letf (((symbol-function 'erc-cmd-MSG)
@@ -247,9 +248,7 @@
((symbol-function 'erc-server-process-alive)
(lambda () t))
((symbol-function 'erc-server-send-queue)
- #'ignore)
- ((symbol-function 'erc-default-target)
- (lambda () "" "#chan")))
+ #'ignore))
(ert-info ("Dispatch to user command handler")
@@ -259,6 +258,16 @@
(should (equal (pop erc-server-flood-queue)
'("PRIVMSG #chan :hi\r\n" . utf-8))))
+ (ert-info ("Quote preserves line intact")
+ (erc-process-input-line "/QUOTE FAKE foo bar\n")
+ (should (equal (pop erc-server-flood-queue)
+ '("FAKE foo bar\r\n" . utf-8))))
+
+ (ert-info ("Unknown command respected")
+ (erc-process-input-line "/FAKE foo bar\n")
+ (should (equal (pop erc-server-flood-queue)
+ '("FAKE foo bar\r\n" . utf-8))))
+
(ert-info ("Spaces preserved")
(erc-process-input-line "/msg #chan hi you\n")
(should (equal (pop calls) " #chan hi you"))