all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
blob cd5e051ca63690ffa53115cc66f384ea8d9a4b6c 4022 bytes (raw)
name: test/lisp/erc/erc-goodies-tests.el 	 # note: path name is non-authoritative(*)

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
 
;;; erc-goodies-tests.el --- Tests for erc-goodies  -*- lexical-binding:t -*-

;; Copyright (C) 2023 Free Software Foundation, Inc.

;; This file is part of GNU Emacs.
;;
;; GNU Emacs is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published
;; by the Free Software Foundation, either version 3 of the License,
;; or (at your option) any later version.
;;
;; GNU Emacs is distributed in the hope that it will be useful, but
;; WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
;; General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.

;;; Commentary:
;;; Code:
(require 'ert-x)
(require 'erc)
(require 'erc-goodies)
(declare-function erc--initialize-markers "erc" (old-point continued) t)

;; Among other things, this test also asserts that a local module's
;; minor-mode toggle is allowed to disable its mode variable as
;; needed.

(ert-deftest erc-keep-place-indicator-mode ()
  (unless (fboundp 'erc--initialize-markers)
    (ert-skip "Required patch set for bug#60954 not yet applied"))
  (with-current-buffer (get-buffer-create "*erc-keep-place-indicator-mode*")
    (erc-mode)
    (erc--initialize-markers (point) nil)
    (let ((assert-off
           (lambda ()
             (should-not erc-keep-place-indicator-mode)
             (should-not (local-variable-p 'window-configuration-change-hook))
             (should-not erc--keep-place-indicator-overlay)))
          (assert-on
           (lambda ()
             (should erc--keep-place-indicator-overlay)
             (should (local-variable-p 'window-configuration-change-hook))
             (should window-configuration-change-hook)
             (should erc-keep-place-mode)))
          ;;
          erc-insert-pre-hook
          erc-modules)

      (funcall assert-off)

      (ert-info ("Value t")
        (should (eq erc-keep-place-indicator-buffer-type t))
        (erc-keep-place-indicator-mode +1)
        (funcall assert-on)
        (goto-char (point-min))
        (should (search-forward "Enabling" nil t))
        (should (memq 'keep-place erc-modules)))

      (erc-keep-place-indicator-mode -1)
      (funcall assert-off)

      (ert-info ("Value `target'")
        (let ((erc-keep-place-indicator-buffer-type 'target))
          (erc-keep-place-indicator-mode +1)
          (funcall assert-off)
          (setq erc--target (erc--target-from-string "#chan"))
          (erc-keep-place-indicator-mode +1)
          (funcall assert-on)))

      (erc-keep-place-indicator-mode -1)
      (funcall assert-off)

      (ert-info ("Value `server'")
        (let ((erc-keep-place-indicator-buffer-type 'server))
          (erc-keep-place-indicator-mode +1)
          (funcall assert-off)
          (setq erc--target nil)
          (erc-keep-place-indicator-mode +1)
          (funcall assert-on)))

      ;; Populate buffer
      (erc-display-message nil 'notice (current-buffer)
                           "This buffer is for text that is not saved")
      (erc-display-message nil 'notice (current-buffer)
                           "and for lisp evaluation")
      (should (search-forward "saved" nil t))
      (erc-keep-place-move nil)
      (goto-char erc-input-marker)

      (ert-info ("Indicator survives reconnect")
        (let ((erc--server-reconnecting (buffer-local-variables)))
          (cl-letf (((symbol-function 'erc-server-connect) #'ignore))
            (erc-open "localhost" 6667 "tester" "Tester" 'connect
                      nil nil nil nil nil "tester" nil)))
        (funcall assert-on)
        (should (= (point) erc-input-marker))
        (goto-char (overlay-start erc--keep-place-indicator-overlay))
        (should (looking-at (rx "*** This buffer is for text")))))

    (when noninteractive
      (kill-buffer))))

;;; erc-goodies-tests.el ends here

debug log:

solving cd5e051ca63 ...
found cd5e051ca63 in https://yhetil.org/emacs/87ilfakmw5.fsf__29244.1518673272$1678372939$gmane$org@neverwas.me/
found f08404be687 in https://yhetil.org/emacs/87k00ctkql.fsf__21004.3000684649$1676907257$gmane$org@neverwas.me/

applying [1/2] https://yhetil.org/emacs/87k00ctkql.fsf__21004.3000684649$1676907257$gmane$org@neverwas.me/
diff --git a/test/lisp/erc/erc-goodies-tests.el b/test/lisp/erc/erc-goodies-tests.el
new file mode 100644
index 00000000000..f08404be687

Checking patch test/lisp/erc/erc-goodies-tests.el...
Applied patch test/lisp/erc/erc-goodies-tests.el cleanly.

skipping https://yhetil.org/emacs/87k00ctkql.fsf__21004.3000684649$1676907257$gmane$org@neverwas.me/ for f08404be687
index at:
100644 f08404be68770b93fe20310900661a0fae22abd9	test/lisp/erc/erc-goodies-tests.el

applying [2/2] https://yhetil.org/emacs/87ilfakmw5.fsf__29244.1518673272$1678372939$gmane$org@neverwas.me/
diff --git a/test/lisp/erc/erc-goodies-tests.el b/test/lisp/erc/erc-goodies-tests.el
index f08404be687..cd5e051ca63 100644

Checking patch test/lisp/erc/erc-goodies-tests.el...
Applied patch test/lisp/erc/erc-goodies-tests.el cleanly.

skipping https://yhetil.org/emacs/87ilfakmw5.fsf__29244.1518673272$1678372939$gmane$org@neverwas.me/ for cd5e051ca63
index at:
100644 cd5e051ca63690ffa53115cc66f384ea8d9a4b6c	test/lisp/erc/erc-goodies-tests.el

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.