emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master a43b062ee57 2/7: ; Load erc-compat before ert-x in ERC tests


From: F. Jason Park
Subject: master a43b062ee57 2/7: ; Load erc-compat before ert-x in ERC tests
Date: Fri, 16 Feb 2024 23:04:41 -0500 (EST)

branch: master
commit a43b062ee57fd9b7c410e741946e51281db5b92a
Author: F. Jason Park <jp@neverwas.me>
Commit: F. Jason Park <jp@neverwas.me>

    ; Load erc-compat before ert-x in ERC tests
    
    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'.
---
 lisp/erc/erc-speedbar.el                   | 5 +++--
 lisp/erc/erc-stamp.el                      | 1 +
 lisp/erc/erc.el                            | 1 +
 test/lisp/erc/erc-button-tests.el          | 3 +--
 test/lisp/erc/erc-fill-tests.el            | 4 ++--
 test/lisp/erc/erc-goodies-tests.el         | 4 ++--
 test/lisp/erc/erc-networks-tests.el        | 1 +
 test/lisp/erc/erc-scenarios-base-renick.el | 8 ++++----
 test/lisp/erc/erc-stamp-tests.el           | 6 +++---
 test/lisp/erc/erc-tests.el                 | 2 +-
 10 files changed, 19 insertions(+), 16 deletions(-)

diff --git a/lisp/erc/erc-speedbar.el b/lisp/erc/erc-speedbar.el
index e3d28aa60dd..a81a3869436 100644
--- a/lisp/erc/erc-speedbar.el
+++ b/lisp/erc/erc-speedbar.el
@@ -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
diff --git a/lisp/erc/erc-stamp.el b/lisp/erc/erc-stamp.el
index a11739a4195..a8190a2c94a 100644
--- a/lisp/erc/erc-stamp.el
+++ b/lisp/erc/erc-stamp.el
@@ -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
diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el
index 08dfa4b8f1b..88227688064 100644
--- a/lisp/erc/erc.el
+++ b/lisp/erc/erc.el
@@ -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))
diff --git a/test/lisp/erc/erc-button-tests.el 
b/test/lisp/erc/erc-button-tests.el
index ba6fe9fd8c1..603b3745a27 100644
--- a/test/lisp/erc/erc-button-tests.el
+++ b/test/lisp/erc/erc-button-tests.el
@@ -20,14 +20,13 @@
 ;;; 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")
diff --git a/test/lisp/erc/erc-fill-tests.el b/test/lisp/erc/erc-fill-tests.el
index 0f19b481f37..2c3537676a7 100644
--- a/test/lisp/erc/erc-fill-tests.el
+++ b/test/lisp/erc/erc-fill-tests.el
@@ -23,13 +23,13 @@
 ;; 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)
 
diff --git a/test/lisp/erc/erc-goodies-tests.el 
b/test/lisp/erc/erc-goodies-tests.el
index 170e28bda96..7013ce0c8fc 100644
--- a/test/lisp/erc/erc-goodies-tests.el
+++ b/test/lisp/erc/erc-goodies-tests.el
@@ -19,13 +19,13 @@
 
 ;;; 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)))))
diff --git a/test/lisp/erc/erc-networks-tests.el 
b/test/lisp/erc/erc-networks-tests.el
index 53cff8f489c..90b8aa99741 100644
--- a/test/lisp/erc/erc-networks-tests.el
+++ b/test/lisp/erc/erc-networks-tests.el
@@ -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
diff --git a/test/lisp/erc/erc-scenarios-base-renick.el 
b/test/lisp/erc/erc-scenarios-base-renick.el
index ca22728b152..e0fcb8b9366 100644
--- a/test/lisp/erc/erc-scenarios-base-renick.el
+++ b/test/lisp/erc/erc-scenarios-base-renick.el
@@ -281,12 +281,12 @@
     (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))
diff --git a/test/lisp/erc/erc-stamp-tests.el b/test/lisp/erc/erc-stamp-tests.el
index 70ca224ac74..a49173ffa2f 100644
--- a/test/lisp/erc/erc-stamp-tests.el
+++ b/test/lisp/erc/erc-stamp-tests.el
@@ -20,14 +20,14 @@
 ;;; 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.
diff --git a/test/lisp/erc/erc-tests.el b/test/lisp/erc/erc-tests.el
index 7d189d37929..dad161a2827 100644
--- a/test/lisp/erc/erc-tests.el
+++ b/test/lisp/erc/erc-tests.el
@@ -20,13 +20,13 @@
 ;; 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 _) "")))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]