]> git.eshelyaron.com Git - emacs.git/commitdiff
; Load erc-compat before ert-x in ERC tests
authorF. Jason Park <jp@neverwas.me>
Fri, 9 Feb 2024 03:19:53 +0000 (19:19 -0800)
committerEshel Yaron <me@eshelyaron.com>
Sat, 17 Feb 2024 13:02:39 +0000 (14:02 +0100)
Avoid eager macro-expansion error in tests files on Emacs 27 and 28 by
ensuring definitions provided by Compat, like `macroexp-file-name',
load first.

* lisp/erc/erc-speedbar.el (erc-speedbar--reset-last-ran-on-timer):
Suppress "`buffer-local-value' is an obsolete generalized variable"
warning on Emacs 29 and below.
* lisp/erc/erc-stamp.el (erc-stamp--time-as-day): Avoid "unused
lexical variable `current-time-list'" warning on 28 and below.
* lisp/erc/erc.el (erc-check-text-conversion): Add `defvar' for
`text-conversion-style' to avoid "reference to free variable" warning
on Emacs 29 and below.
* test/lisp/erc/erc-button-tests.el: Load `erc-button' before `ert-x'.
* test/lisp/erc/erc-fill-tests.el: Load `erc-fill' before `ert-x'.
* test/lisp/erc/erc-goodies-tests.el: Load `erc-goodies' before
`ert-x'.
* test/lisp/erc/erc-networks-tests.el: Explicitly load `erc-compat'
before anything else.
* test/lisp/erc/erc-scenarios-base-renick.el: Update timeouts.
* test/lisp/erc/erc-stamp-tests.el: Load `erc-stamp' before `ert-x'.
* test/lisp/erc/erc-tests.el: Load `erc-ring' before `ert-x'.

(cherry picked from commit a43b062ee57fd9b7c410e741946e51281db5b92a)

lisp/erc/erc-speedbar.el
lisp/erc/erc-stamp.el
lisp/erc/erc.el
test/lisp/erc/erc-button-tests.el
test/lisp/erc/erc-fill-tests.el
test/lisp/erc/erc-goodies-tests.el
test/lisp/erc/erc-networks-tests.el
test/lisp/erc/erc-scenarios-base-renick.el
test/lisp/erc/erc-stamp-tests.el
test/lisp/erc/erc-tests.el

index e3d28aa60ddfcefc76f11372a1c1daa05f02166a..a81a3869436142dd8a548d0a188c1160e0df7d05 100644 (file)
@@ -566,8 +566,9 @@ The INDENT level is ignored."
 (defun erc-speedbar--reset-last-ran-on-timer ()
   "Reset `erc-speedbar--last-ran'."
   (when speedbar-buffer
-    (setf (buffer-local-value 'erc-speedbar--last-ran speedbar-buffer)
-          (current-time))))
+    (with-suppressed-warnings ((obsolete buffer-local-value)) ; <=29
+      (setf (buffer-local-value 'erc-speedbar--last-ran speedbar-buffer)
+            (current-time)))))
 
 ;;;###autoload(autoload 'erc-nickbar-mode "erc-speedbar" nil t)
 (define-erc-module nickbar nil
index a11739a4195aa08e601e713b15fd1c0721ee03e3..a8190a2c94a009285b045efd74fc690226547533 100644 (file)
@@ -828,6 +828,7 @@ left-sided stamps and date stamps inserted by this function."
 ;; perform day alignments via this function only when needed.
 (defun erc-stamp--time-as-day (current-time)
   "Discard hour, minute, and second info from timestamp CURRENT-TIME."
+  (defvar current-time-list) ; <=28
   (let* ((current-time-list) ; flag
          (decoded (decode-time current-time erc-stamp--tz)))
     (setf (decoded-time-second decoded) 0
index 08dfa4b8f1bb2faf9762e18a580b2878150f57e6..882276880641167aca9848064b9f1dda3eebde21 100644 (file)
@@ -9492,6 +9492,7 @@ guarantee that the input method functions properly for the
 purpose of typing within the ERC prompt."
   (when (and (eq major-mode 'erc-mode)
              (fboundp 'set-text-conversion-style))
+    (defvar text-conversion-style) ; avoid free variable warning on <=29
     (if (>= (point) (erc-beg-of-input-line))
         (unless (eq text-conversion-style 'action)
           (set-text-conversion-style 'action))
index ba6fe9fd8c12db40da90399358b89fa78313cf99..603b3745a27b950429a40d00a09b2d1af4e187a7 100644 (file)
 ;;; Commentary:
 
 ;;; Code:
+(require 'erc-button)
 
 (require 'ert-x) ; cl-lib
 (eval-and-compile
   (let ((load-path (cons (ert-resource-directory) load-path)))
     (require 'erc-tests-common)))
 
-(require 'erc-button)
-
 (ert-deftest erc-button-alist--url ()
   (erc-tests-common-init-server-proc "sleep" "1")
   (with-current-buffer (erc--open-target "#chan")
index 0f19b481f3773a7b6f8bbd77dcc4931db1fe6447..2c3537676a799b3d0cc5410676691498ace96ace 100644 (file)
 ;; scenarios.
 
 ;;; Code:
+(require 'erc-fill)
+
 (require 'ert-x)
 (eval-and-compile
   (let ((load-path (cons (ert-resource-directory) load-path)))
     (require 'erc-tests-common)))
 
-(require 'erc-fill)
-
 (defvar erc-fill-tests--buffers nil)
 (defvar erc-fill-tests--current-time-value nil)
 
index 170e28bda960adbf9bbb8c87ee803251c2e13b74..7013ce0c8fc040c421b5c88d8df8f68f982cfba3 100644 (file)
 
 ;;; Commentary:
 ;;; Code:
+(require 'erc-goodies)
+
 (require 'ert-x)
 (eval-and-compile
   (let ((load-path (cons (ert-resource-directory) load-path)))
     (require 'erc-tests-common)))
 
-(require 'erc-goodies)
-
 (defun erc-goodies-tests--assert-face (beg end-str present &optional absent)
   (setq beg (+ beg (point-min)))
   (let ((end (+ beg (1- (length end-str)))))
index 53cff8f489c958a53ce937ebe6fe1ee3ffb422da..90b8aa99741fb5c72381683c601657bc45d68350 100644 (file)
@@ -18,6 +18,7 @@
 ;; along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.
 
 ;;; Code:
+(require 'erc-compat)
 
 (require 'ert-x) ; cl-lib
 (eval-and-compile
index ca22728b15233b29354f5047ef3bef2135109c77..e0fcb8b9366323e45f6f7cc76d462afc82865484 100644 (file)
     (should-not (get-buffer "rando@barnet"))
 
     (with-current-buffer "frenemy@foonet"
-      (funcall expect 1 "now known as")
-      (funcall expect 1 "doubly so"))
+      (funcall expect 10 "now known as")
+      (funcall expect 10 "doubly so"))
 
     (with-current-buffer "frenemy@barnet"
-      (funcall expect 1 "now known as")
-      (funcall expect 1 "reality picture"))
+      (funcall expect 10 "now known as")
+      (funcall expect 10 "reality picture"))
 
     (when noninteractive
       (with-current-buffer "frenemy@barnet" (kill-buffer))
index 70ca224ac74689511d7003079364109592222ef3..a49173ffa2f4191b8d9293659d2819b22dd1f61c 100644 (file)
 ;;; Commentary:
 
 ;;; Code:
+(require 'erc-stamp)
+(require 'erc-goodies) ; for `erc-make-read-only'
+
 (require 'ert-x)
 (eval-and-compile
   (let ((load-path (cons (ert-resource-directory) load-path)))
     (require 'erc-tests-common)))
 
-(require 'erc-stamp)
-(require 'erc-goodies) ; for `erc-make-read-only'
-
 ;; These display-oriented tests are brittle because many factors
 ;; influence how text properties are applied.  We should just
 ;; rework these into full scenarios.
index 7d189d37929fc62cfb50283a8ead9d6cb7fec7b3..dad161a28277017d320390fcf1c5a0d3d6b6e42b 100644 (file)
 ;; along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.
 
 ;;; Code:
+(require 'erc-ring)
 
 (require 'ert-x)
 (eval-and-compile
   (let ((load-path (cons (ert-resource-directory) load-path)))
     (require 'erc-tests-common)))
 
-(require 'erc-ring)
 
 (ert-deftest erc--read-time-period ()
   (cl-letf (((symbol-function 'read-string) (lambda (&rest _) "")))