aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/lisp/erc/erc-tests.el30
1 files changed, 30 insertions, 0 deletions
diff --git a/test/lisp/erc/erc-tests.el b/test/lisp/erc/erc-tests.el
index 3b278959dc1..05d45b2d027 100644
--- a/test/lisp/erc/erc-tests.el
+++ b/test/lisp/erc/erc-tests.el
@@ -560,6 +560,36 @@
560 (pop calls))) 560 (pop calls)))
561 (should-not calls))) 561 (should-not calls)))
562 562
563 ;; Mimic simplistic version of example in "(erc) display-buffer".
564 (when (>= emacs-major-version 29)
565 (let ((proc erc-server-process))
566 (with-temp-buffer
567 (should-not (eq (window-buffer) (current-buffer)))
568 (erc-mode)
569 (setq erc-server-process proc)
570
571 (cl-letf (((symbol-function 'erc--test-fun-p)
572 (lambda (buf action)
573 (should (eql 1 (alist-get 'erc-buffer-display action)))
574 (push (cons 'erc--test-fun-p buf) calls)))
575 ((symbol-function 'action-fn)
576 (lambda (buf action)
577 (should (eql 1 (alist-get 'erc-buffer-display action)))
578 (should (eql 42 (alist-get 'foo action)))
579 (push (cons 'action-fn buf) calls)
580 (selected-window))))
581
582 (let ((erc--display-context '((erc-buffer-display . 1)))
583 (display-buffer-alist
584 `(((and (major-mode . erc-mode) erc--test-fun-p)
585 action-fn (foo . 42))))
586 (erc-buffer-display 'display-buffer))
587
588 (erc-setup-buffer (current-buffer))
589 (should (equal 'action-fn (car (pop calls))))
590 (should (equal 'erc--test-fun-p (car (pop calls))))
591 (should-not calls))))))
592
563 (should (eq owin (selected-window))) 593 (should (eq owin (selected-window)))
564 (should (eq obuf (window-buffer))))) 594 (should (eq obuf (window-buffer)))))
565 595