summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorF. Jason Park <jp@neverwas.me>2022-08-17 00:00:53 -0700
committerF. Jason Park <jp@neverwas.me>2022-09-19 17:54:46 -0700
commite98465e5418497a925e795c358231a4d70d6e5ff (patch)
tree2e7eb36aedea441d7d359e0a4f6962e782e7b77c
parent33fdb1daa354e5045e6e4a798db18d2ba1fbc38b (diff)
downloademacs-e98465e5418497a925e795c358231a4d70d6e5ff.tar.gz
emacs-e98465e5418497a925e795c358231a4d70d6e5ff.tar.bz2
emacs-e98465e5418497a925e795c358231a4d70d6e5ff.zip
Stabilize channels variant of erc-reuse-buffers test
* lisp/erc/erc-networks.el (erc-networks--id-sort-buffers): Use `buffer-local-value' instead of `with-current-buffer'. * test/lisp/erc/erc-scenarios-base-reuse-buffers.el (erc-scenarios-common--base-reuse-buffers-channel-buffers): Wait for buffers to be created by server-initiated JOINs. (erc-scenarios-base-reuse-buffers-channel-buffers--disabled): Remove `:unstable' tag. * test/lisp/erc-tests.el (erc-ring-previous-command): Remove unnecessary `goto-char'.
-rw-r--r--lisp/erc/erc-networks.el4
-rw-r--r--test/lisp/erc/erc-scenarios-base-reuse-buffers.el35
-rw-r--r--test/lisp/erc/erc-tests.el2
3 files changed, 18 insertions, 23 deletions
diff --git a/lisp/erc/erc-networks.el b/lisp/erc/erc-networks.el
index c54b12fcb0b..2c8f8fb72bb 100644
--- a/lisp/erc/erc-networks.el
+++ b/lisp/erc/erc-networks.el
@@ -996,8 +996,8 @@ Rename the current buffer if its NID has grown."
"Return a list of target BUFFERS, newest to oldest."
(sort buffers
(lambda (a b)
- (> (with-current-buffer a (erc-networks--id-ts erc-networks--id))
- (with-current-buffer b (erc-networks--id-ts erc-networks--id))))))
+ (> (erc-networks--id-ts (buffer-local-value 'erc-networks--id a))
+ (erc-networks--id-ts (buffer-local-value 'erc-networks--id b))))))
;;;; Buffer association
diff --git a/test/lisp/erc/erc-scenarios-base-reuse-buffers.el b/test/lisp/erc/erc-scenarios-base-reuse-buffers.el
index f134f3ffb69..8e7e939d046 100644
--- a/test/lisp/erc/erc-scenarios-base-reuse-buffers.el
+++ b/test/lisp/erc/erc-scenarios-base-reuse-buffers.el
@@ -131,43 +131,38 @@ Adapted from scenario clash-of-chans/uniquify described in Bug#48598:
(get-buffer (format "127.0.0.1:%d/127.0.0.1" port)))
(server-buffer-bar
(get-buffer (format "127.0.0.1:%d/127.0.0.1<2>" port)))
- (chan-buffer-foo (get-buffer "#chan/127.0.0.1"))
- (chan-buffer-bar (get-buffer "#chan/127.0.0.1<2>"))
- (server-process-foo (with-current-buffer server-buffer-foo
- erc-server-process))
- (server-process-bar (with-current-buffer server-buffer-bar
- erc-server-process)))
+ (server-process-foo
+ (buffer-local-value 'erc-server-process server-buffer-foo))
+ (server-process-bar
+ (buffer-local-value 'erc-server-process server-buffer-bar)))
(ert-info ("Unique #chan buffers exist")
- (let ((chan-bufs (erc-scenarios-common-buflist "#chan"))
- (known (list chan-buffer-bar chan-buffer-foo)))
- (should (memq (pop chan-bufs) known))
- (should (memq (pop chan-bufs) known))
- (should-not chan-bufs)))
+ (erc-d-t-wait-for 3 (get-buffer "#chan/127.0.0.1<2>"))
+ (erc-d-t-wait-for 3 (get-buffer "#chan/127.0.0.1")))
(ert-info ("#chan@foonet is exclusive and not contaminated")
- (with-current-buffer chan-buffer-foo
+ (with-current-buffer "#chan/127.0.0.1"
(funcall expect 1 "<bob>")
(erc-d-t-absent-for 0.1 "<joe>")
(funcall expect 1 "strength to climb")
(should (eq erc-server-process server-process-foo))))
(ert-info ("#chan@barnet is exclusive and not contaminated")
- (with-current-buffer chan-buffer-bar
+ (with-current-buffer "#chan/127.0.0.1<2>"
(funcall expect 1 "<joe>")
(erc-d-t-absent-for 0.1 "<bob>")
(funcall expect 1 "the loudest noise")
(should (eq erc-server-process server-process-bar))))
(ert-info ("Part #chan@foonet")
- (with-current-buffer chan-buffer-foo
+ (with-current-buffer "#chan/127.0.0.1"
(erc-d-t-search-for 1 "shake my sword")
(erc-cmd-PART "#chan")
(funcall expect 3 "You have left channel #chan")
(erc-cmd-JOIN "#chan")))
(ert-info ("Part #chan@barnet")
- (with-current-buffer chan-buffer-bar
+ (with-current-buffer "#chan/127.0.0.1<2>"
(funcall expect 10 "Arm it in rags")
(should (erc-get-channel-user (erc-current-nick)))
(erc-cmd-PART "#chan")
@@ -179,7 +174,7 @@ Adapted from scenario clash-of-chans/uniquify described in Bug#48598:
(get-buffer "#chan/127.0.0.1<3>"))
(ert-info ("Activity continues in new, <n>-suffixed #chan@foonet buffer")
- (with-current-buffer chan-buffer-foo
+ (with-current-buffer "#chan/127.0.0.1"
(should-not (erc-get-channel-user (erc-current-nick))))
(with-current-buffer "#chan/127.0.0.1<3>"
(should (erc-get-channel-user (erc-current-nick)))
@@ -194,7 +189,7 @@ Adapted from scenario clash-of-chans/uniquify described in Bug#48598:
(get-buffer "#chan/127.0.0.1<4>"))
(ert-info ("Activity continues in new, <n>-suffixed #chan@barnet buffer")
- (with-current-buffer chan-buffer-bar
+ (with-current-buffer "#chan/127.0.0.1<2>"
(should-not (erc-get-channel-user (erc-current-nick))))
(with-current-buffer "#chan/127.0.0.1<4>"
(funcall expect 2 "You have joined channel #chan")
@@ -221,12 +216,12 @@ Adapted from scenario clash-of-chans/uniquify described in Bug#48598:
(ert-info ("Buffers are exempt from shortening")
(kill-buffer "#chan/127.0.0.1<4>")
(kill-buffer "#chan/127.0.0.1<3>")
- (kill-buffer chan-buffer-bar)
+ (kill-buffer "#chan/127.0.0.1<2>")
(should-not (get-buffer "#chan"))
- (should chan-buffer-foo))))
+ (should (get-buffer "#chan/127.0.0.1")))))
(ert-deftest erc-scenarios-base-reuse-buffers-channel-buffers--disabled ()
- :tags '(:expensive-test :unstable)
+ :tags '(:expensive-test)
(with-suppressed-warnings ((obsolete erc-reuse-buffers))
(should erc-reuse-buffers)
(let ((erc-scenarios-common-dialog "base/reuse-buffers/channel")
diff --git a/test/lisp/erc/erc-tests.el b/test/lisp/erc/erc-tests.el
index 55efe2fd2d9..b2ed29e80ec 100644
--- a/test/lisp/erc/erc-tests.el
+++ b/test/lisp/erc/erc-tests.el
@@ -522,7 +522,7 @@
(erc-send-current-line)
(should (ring-p erc-input-ring))
(should (zerop (ring-member erc-input-ring "/one"))) ; equal
- (should (save-excursion (forward-line -1) (goto-char (pos-bol))
+ (should (save-excursion (forward-line -1)
(looking-at-p "[*]+ echo: one")))
(should-not erc-input-ring-index)
(erc-bol)