aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorF. Jason Park2023-11-10 13:34:31 -0800
committerF. Jason Park2023-11-12 20:37:49 -0800
commit1d2aa130caeb6494e647db02237cfd414249a3db (patch)
tree0ad3cfafb9ce182bca7d2cc499d01b1ab158f824 /test
parent583d73e9a0edb8cb79c4a821b39685aa220bbefa (diff)
downloademacs-1d2aa130caeb6494e647db02237cfd414249a3db.tar.gz
emacs-1d2aa130caeb6494e647db02237cfd414249a3db.zip
Revive erc-command-indicator as new module
* doc/misc/erc.texi: Add entry for `command-indicator' to Modules chapter. * etc/ERC-NEWS: Mention new module `command-indicator'. * lisp/erc/erc-goodies.el (erc-noncommands-list): Replace the nonexistent `erc-cmd-SMV' with function `erc-cmd-SAY'. (erc-noncommands-mode, erc-noncommands-enable, erc-noncommands-disable): Deprecate this module because it's a no-op. (erc-command-indicator-face, erc-command-indicator): Migrate from main library. (erc-command-indicator-mode, erc-command-indicator-enable, erc-command-indicator-disable): New module to take the spiritual place of `noncommands'. (erc-command-indicator): Move function here from main library, along with option namesake mentioned above. (erc-command-indicator-toggle-hidden): New command to toggle echoed command-line visibility. (erc--command-indicator-permit-insertion): New function. (erc--command-indicator-display): New function, a slightly revised version of the old `erc-display-command' from the main library. Its only call site was removed back in d1036d288de "backport: erc bugfixes". However, references were left behind to associated assets, like `erc-command-indicator', etc. The function was later commented out in 0c599ee2e2c "* lisp/erc/erc.el: Use `run-hook-with-args` for `erc-pre-send-functions`", and then removed by a63ed6f78a6 "Remove duplicate ERC prompt on reconnect". * lisp/erc/erc-match.el (erc-match-toggle-hidden-fools): Use new non-module-specific name for `erc-match--toggle-hidden'. (erc-match--toggle-hidden): Move to main library for shared use by other modules. * lisp/erc/erc.el (erc-hide-prompt): Leave note explaining updated role. (erc-command-indicator): Move option and function of same name to erc-goodies. (erc-command-indicator-face): Move to erc-goodies. (erc-modules): Remove module `noncommands' from standard value and Custom set. Add `command-indicator' to set. (erc--toggle-hidden): "New" function, a rebranded version of the utility `erc-match--toggle-hidden' from erc-match. (erc--send-input-lines): Accommodate modules wanting alternate insertion functions. (erc-load-irc-script-lines): Account for `erc-command-indicator' no longer being defined in this library. * test/lisp/erc/erc-scenarios-base-send-message.el (erc-scenarios-base-send-message--command-indicator): New test. * test/lisp/erc/erc-tests.el (erc-tests--modules): Remove deprecated module `noncommands' from manifest. (Bug#67031)
Diffstat (limited to 'test')
-rw-r--r--test/lisp/erc/erc-scenarios-base-send-message.el54
-rw-r--r--test/lisp/erc/erc-tests.el3
2 files changed, 56 insertions, 1 deletions
diff --git a/test/lisp/erc/erc-scenarios-base-send-message.el b/test/lisp/erc/erc-scenarios-base-send-message.el
index 904381abe6a..bf9e0f5ae3a 100644
--- a/test/lisp/erc/erc-scenarios-base-send-message.el
+++ b/test/lisp/erc/erc-scenarios-base-send-message.el
@@ -69,4 +69,58 @@
69 (funcall expect 10 "<alice> No, not till Thursday;")))))) 69 (funcall expect 10 "<alice> No, not till Thursday;"))))))
70 70
71 71
72;; This asserts that the `command-indicator' module only inserts
73;; prompt-like prefixes for normal slash commands, like /JOIN.
74
75(ert-deftest erc-scenarios-base-send-message--command-indicator ()
76 :tags '(:expensive-test)
77 (erc-scenarios-common-with-cleanup
78 ((erc-scenarios-common-dialog "base/send-message")
79 (erc-server-flood-penalty 0.1)
80 (dumb-server (erc-d-run "localhost" t 'noncommands))
81 (erc-modules `(command-indicator fill-wrap ,@erc-modules))
82 (expect (erc-d-t-make-expecter)))
83
84 (ert-info ("Connect to foonet")
85 (with-current-buffer (erc :server "127.0.0.1"
86 :port (process-contact dumb-server :service)
87 :nick "tester"
88 :full-name "tester")
89 (funcall expect 5 "debug mode")
90 (erc-scenarios-common-say "/join #chan")
91 (funcall expect 10 "ERC> /join #chan")))
92
93 (with-current-buffer (erc-d-t-wait-for 5 (get-buffer "#chan"))
94 (ert-info ("Prompt absent for CTCP ACTION")
95 (funcall expect 10 "<bob> alice: For hands, to do Rome")
96 (erc-scenarios-common-say "/me sad")
97 (funcall expect -0.1 "ERC> /me sad")
98 (funcall expect 10 "* tester sad"))
99
100 (ert-info ("Prompt absent for literal command")
101 (funcall expect 10 "<alice> bob: Spotted, detested")
102 (erc-scenarios-common-say "/say /me sad")
103 (funcall expect -0.1 "ERC> /say /me sad")
104 (funcall expect 10 "<tester> /me sad"))
105
106 (ert-info ("Prompt absent for /SV")
107 (funcall expect 10 "<bob> Marcus, my brother!")
108 (erc-scenarios-common-say "/sv")
109 (funcall expect -0.1 "ERC> /sv")
110 (funcall expect 10 "<tester> I'm using ERC"))
111
112 (ert-info ("Prompt absent module list via /SM")
113 (funcall expect 10 "<bob> alice: You still wrangle")
114 (erc-scenarios-common-say "/sm")
115 (funcall expect -0.1 "ERC> /sm")
116 (funcall expect 10 "<tester> I'm using the following modules: ")
117 (funcall expect 10 "<alice> No, not till Thursday;"))
118
119 (ert-info ("Prompt present for /QUIT in issuing buffer")
120 (erc-scenarios-common-say "/quit")
121 (funcall expect 10 "ERC> /quit"))
122
123 (with-current-buffer "foonet"
124 (funcall expect 10 "ERC finished")))))
125
72;;; erc-scenarios-base-send-message.el ends here 126;;; erc-scenarios-base-send-message.el ends here
diff --git a/test/lisp/erc/erc-tests.el b/test/lisp/erc/erc-tests.el
index 2898ca7be75..e7422d330c0 100644
--- a/test/lisp/erc/erc-tests.el
+++ b/test/lisp/erc/erc-tests.el
@@ -2543,7 +2543,8 @@
2543 (kill-buffer "#chan"))) 2543 (kill-buffer "#chan")))
2544 2544
2545(defconst erc-tests--modules 2545(defconst erc-tests--modules
2546 '( autoaway autojoin bufbar button capab-identify completion dcc fill identd 2546 '( autoaway autojoin bufbar button capab-identify
2547 command-indicator completion dcc fill identd
2547 imenu irccontrols keep-place list log match menu move-to-prompt netsplit 2548 imenu irccontrols keep-place list log match menu move-to-prompt netsplit
2548 networks nickbar nicks noncommands notifications notify page readonly 2549 networks nickbar nicks noncommands notifications notify page readonly
2549 replace ring sasl scrolltobottom services smiley sound 2550 replace ring sasl scrolltobottom services smiley sound