diff options
| author | F. Jason Park | 2023-11-25 19:23:55 -0800 |
|---|---|---|
| committer | F. Jason Park | 2023-11-26 14:25:27 -0800 |
| commit | 2407f810136739da376ff0929b247a49dc196299 (patch) | |
| tree | 3475b93b1548bb75631adaaf11c6c289b1873729 /test | |
| parent | 01e7178917743470d05a5b1a5d883d07191e3014 (diff) | |
| download | emacs-2407f810136739da376ff0929b247a49dc196299.tar.gz emacs-2407f810136739da376ff0929b247a49dc196299.zip | |
Restore prompt correctly when reconnecting in ERC
* lisp/erc/erc.el (erc--initialize-markers): Commit 0d6c8d41ab7 "Use
overlay instead of text prop to hide ERC's prompt" introduced a bug
that caused the prompt to remain hidden upon reconnecting because the
stashed overlay would get clobbered by ERC's major-mode setup.
Binding its old value while unhiding fixes the issue.
* test/lisp/erc/erc-tests.el (erc-hide-prompt): Don't permanently set
the default value of `erc-hide-prompt'.
* test/lisp/erc/resources/erc-scenarios-common.el
(erc-scenarios-common--join-network-id): Add assertions for prompt
hiding and unhiding on reconnect. (Bug#51082)
Diffstat (limited to 'test')
| -rw-r--r-- | test/lisp/erc/erc-tests.el | 4 | ||||
| -rw-r--r-- | test/lisp/erc/resources/erc-scenarios-common.el | 23 |
2 files changed, 22 insertions, 5 deletions
diff --git a/test/lisp/erc/erc-tests.el b/test/lisp/erc/erc-tests.el index 0d6ddf12380..912a85ad5e0 100644 --- a/test/lisp/erc/erc-tests.el +++ b/test/lisp/erc/erc-tests.el | |||
| @@ -155,7 +155,9 @@ | |||
| 155 | (set-process-query-on-exit-flag erc-server-process nil)) | 155 | (set-process-query-on-exit-flag erc-server-process nil)) |
| 156 | 156 | ||
| 157 | (ert-deftest erc-hide-prompt () | 157 | (ert-deftest erc-hide-prompt () |
| 158 | (let (erc-kill-channel-hook erc-kill-server-hook erc-kill-buffer-hook) | 158 | (let ((erc-hide-prompt erc-hide-prompt) |
| 159 | ;; | ||
| 160 | erc-kill-channel-hook erc-kill-server-hook erc-kill-buffer-hook) | ||
| 159 | 161 | ||
| 160 | (with-current-buffer (get-buffer-create "ServNet") | 162 | (with-current-buffer (get-buffer-create "ServNet") |
| 161 | (erc-tests--send-prep) | 163 | (erc-tests--send-prep) |
diff --git a/test/lisp/erc/resources/erc-scenarios-common.el b/test/lisp/erc/resources/erc-scenarios-common.el index 802ccaeedaa..311d8a82d72 100644 --- a/test/lisp/erc/resources/erc-scenarios-common.el +++ b/test/lisp/erc/resources/erc-scenarios-common.el | |||
| @@ -654,10 +654,17 @@ Bug#48598: 28.0.50; buffer-naming collisions involving bouncers in ERC." | |||
| 654 | (with-current-buffer erc-server-buffer-foo (erc-cmd-JOIN "#chan")) | 654 | (with-current-buffer erc-server-buffer-foo (erc-cmd-JOIN "#chan")) |
| 655 | (with-current-buffer (erc-d-t-wait-for 5 (get-buffer "#chan")) | 655 | (with-current-buffer (erc-d-t-wait-for 5 (get-buffer "#chan")) |
| 656 | (funcall expect 5 "vile thing") | 656 | (funcall expect 5 "vile thing") |
| 657 | (erc-cmd-QUIT ""))) | 657 | (erc-cmd-QUIT "") |
| 658 | 658 | ||
| 659 | (erc-d-t-wait-for 2 "Foonet connection deceased" | 659 | (ert-info ("Prompt hidden in channel buffer upon quitting") |
| 660 | (not (erc-server-process-alive erc-server-buffer-foo))) | 660 | (erc-d-t-wait-for 10 (erc--prompt-hidden-p)) |
| 661 | (should (overlays-in erc-insert-marker erc-input-marker))))) | ||
| 662 | |||
| 663 | (with-current-buffer erc-server-buffer-foo | ||
| 664 | (ert-info ("Prompt hidden after process dies in server buffer") | ||
| 665 | (erc-d-t-wait-for 2 (not (erc-server-process-alive))) | ||
| 666 | (erc-d-t-wait-for 10 (erc--prompt-hidden-p)) | ||
| 667 | (should (overlays-in erc-insert-marker erc-input-marker)))) | ||
| 661 | 668 | ||
| 662 | (should (equal erc-autojoin-channels-alist | 669 | (should (equal erc-autojoin-channels-alist |
| 663 | (if foo-id '((oofnet "#chan")) '((foonet "#chan"))))) | 670 | (if foo-id '((oofnet "#chan")) '((foonet "#chan"))))) |
| @@ -706,6 +713,10 @@ Bug#48598: 28.0.50; buffer-naming collisions involving bouncers in ERC." | |||
| 706 | (setq erc-server-process-foo erc-server-process) | 713 | (setq erc-server-process-foo erc-server-process) |
| 707 | (erc-d-t-wait-for 2 (eq erc-network 'foonet)) | 714 | (erc-d-t-wait-for 2 (eq erc-network 'foonet)) |
| 708 | (should (string= (buffer-name) (if foo-id "oofnet" "foonet"))) | 715 | (should (string= (buffer-name) (if foo-id "oofnet" "foonet"))) |
| 716 | |||
| 717 | (ert-info ("Prompt unhidden") | ||
| 718 | (should-not (erc--prompt-hidden-p)) | ||
| 719 | (should-not (overlays-in erc-insert-marker erc-input-marker))) | ||
| 709 | (funcall expect 5 "foonet"))) | 720 | (funcall expect 5 "foonet"))) |
| 710 | 721 | ||
| 711 | (ert-info ("#chan@foonet is clean, no cross-contamination") | 722 | (ert-info ("#chan@foonet is clean, no cross-contamination") |
| @@ -713,7 +724,11 @@ Bug#48598: 28.0.50; buffer-naming collisions involving bouncers in ERC." | |||
| 713 | (erc-d-t-wait-for 3 (eq erc-server-process erc-server-process-foo)) | 724 | (erc-d-t-wait-for 3 (eq erc-server-process erc-server-process-foo)) |
| 714 | (funcall expect 3 "<bob>") | 725 | (funcall expect 3 "<bob>") |
| 715 | (erc-d-t-absent-for 0.1 "<joe>") | 726 | (erc-d-t-absent-for 0.1 "<joe>") |
| 716 | (funcall expect 20 "not given me"))) | 727 | (funcall expect 30 "not given me") |
| 728 | |||
| 729 | (ert-info ("Prompt unhidden") | ||
| 730 | (should-not (erc--prompt-hidden-p)) | ||
| 731 | (should-not (overlays-in erc-insert-marker erc-input-marker))))) | ||
| 717 | 732 | ||
| 718 | (ert-info ("All #chan@barnet output received") | 733 | (ert-info ("All #chan@barnet output received") |
| 719 | (with-current-buffer chan-buf-bar | 734 | (with-current-buffer chan-buf-bar |