mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2024-12-16 09:50:25 +00:00
Use lexical-binding in most remaining emacs-lisp tests
* test/lisp/emacs-lisp/edebug-resources/edebug-test-code.el: * test/lisp/emacs-lisp/eieio-tests/eieio-test-methodinvoke.el: * test/lisp/emacs-lisp/eieio-tests/eieio-test-persist.el: * test/lisp/emacs-lisp/faceup-resources/faceup-test-mode.el: * test/lisp/emacs-lisp/faceup-resources/faceup-test-this-file-directory.el: * test/lisp/emacs-lisp/faceup-tests/faceup-test-basics.el: * test/lisp/emacs-lisp/faceup-tests/faceup-test-files.el: * test/lisp/emacs-lisp/package-resources/newer-versions/new-pkg-1.0.el: * test/lisp/emacs-lisp/package-resources/newer-versions/simple-single-1.4.el: * test/lisp/emacs-lisp/package-resources/simple-depend-1.0.el: * test/lisp/emacs-lisp/package-resources/simple-single-1.3.el: * test/lisp/emacs-lisp/package-resources/simple-two-depend-1.1.el: * test/lisp/emacs-lisp/package-tests.el: * test/lisp/emacs-lisp/shadow-resources/p1/foo.el: * test/lisp/emacs-lisp/shadow-resources/p2/FOO.el: Use lexical-binding. * test/lisp/emacs-lisp/eieio-tests/eieio-test-methodinvoke.el (eitest-F, eitest-H, eitest-I, constructor, make-instance) (initialize-instance, CNM-M): * test/lisp/emacs-lisp/package-tests.el (with-package-test) (package-test-update-archives, package-test-signed): Silence byte-compiler.
This commit is contained in:
parent
44d824e7f0
commit
d386f1fb62
@ -1,4 +1,4 @@
|
||||
;;; edebug-test-code.el --- Sample code for the Edebug test suite
|
||||
;;; edebug-test-code.el --- Sample code for the Edebug test suite -*- lexical-binding:t -*-
|
||||
|
||||
;; Copyright (C) 2017-2020 Free Software Foundation, Inc.
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
;;; eieio-testsinvoke.el -- eieio tests for method invocation
|
||||
;;; eieio-testsinvoke.el -- eieio tests for method invocation -*- lexical-binding:t -*-
|
||||
|
||||
;; Copyright (C) 2005, 2008, 2010, 2013-2020 Free Software Foundation,
|
||||
;; Inc.
|
||||
@ -83,36 +83,36 @@
|
||||
(defclass eitest-B-base2 () ())
|
||||
(defclass eitest-B (eitest-B-base1 eitest-B-base2) ())
|
||||
|
||||
(defmethod eitest-F :BEFORE ((p eitest-B-base1))
|
||||
(defmethod eitest-F :BEFORE ((_p eitest-B-base1))
|
||||
(eieio-test-method-store :BEFORE 'eitest-B-base1))
|
||||
|
||||
(defmethod eitest-F :BEFORE ((p eitest-B-base2))
|
||||
(defmethod eitest-F :BEFORE ((_p eitest-B-base2))
|
||||
(eieio-test-method-store :BEFORE 'eitest-B-base2))
|
||||
|
||||
(defmethod eitest-F :BEFORE ((p eitest-B))
|
||||
(defmethod eitest-F :BEFORE ((_p eitest-B))
|
||||
(eieio-test-method-store :BEFORE 'eitest-B))
|
||||
|
||||
(defmethod eitest-F ((p eitest-B))
|
||||
(defmethod eitest-F ((_p eitest-B))
|
||||
(eieio-test-method-store :PRIMARY 'eitest-B)
|
||||
(call-next-method))
|
||||
|
||||
(defmethod eitest-F ((p eitest-B-base1))
|
||||
(defmethod eitest-F ((_p eitest-B-base1))
|
||||
(eieio-test-method-store :PRIMARY 'eitest-B-base1)
|
||||
(call-next-method))
|
||||
|
||||
(defmethod eitest-F ((p eitest-B-base2))
|
||||
(defmethod eitest-F ((_p eitest-B-base2))
|
||||
(eieio-test-method-store :PRIMARY 'eitest-B-base2)
|
||||
(when (next-method-p)
|
||||
(call-next-method))
|
||||
)
|
||||
|
||||
(defmethod eitest-F :AFTER ((p eitest-B-base1))
|
||||
(defmethod eitest-F :AFTER ((_p eitest-B-base1))
|
||||
(eieio-test-method-store :AFTER 'eitest-B-base1))
|
||||
|
||||
(defmethod eitest-F :AFTER ((p eitest-B-base2))
|
||||
(defmethod eitest-F :AFTER ((_p eitest-B-base2))
|
||||
(eieio-test-method-store :AFTER 'eitest-B-base2))
|
||||
|
||||
(defmethod eitest-F :AFTER ((p eitest-B))
|
||||
(defmethod eitest-F :AFTER ((_p eitest-B))
|
||||
(eieio-test-method-store :AFTER 'eitest-B))
|
||||
|
||||
(ert-deftest eieio-test-method-order-list-3 ()
|
||||
@ -136,7 +136,7 @@
|
||||
|
||||
;;; Test static invocation
|
||||
;;
|
||||
(defmethod eitest-H :STATIC ((class eitest-A))
|
||||
(defmethod eitest-H :STATIC ((_class eitest-A))
|
||||
"No need to do work in here."
|
||||
'moose)
|
||||
|
||||
@ -147,15 +147,15 @@
|
||||
|
||||
;;; Return value from :PRIMARY
|
||||
;;
|
||||
(defmethod eitest-I :BEFORE ((a eitest-A))
|
||||
(defmethod eitest-I :BEFORE ((_a eitest-A))
|
||||
(eieio-test-method-store :BEFORE 'eitest-A)
|
||||
":before")
|
||||
|
||||
(defmethod eitest-I :PRIMARY ((a eitest-A))
|
||||
(defmethod eitest-I :PRIMARY ((_a eitest-A))
|
||||
(eieio-test-method-store :PRIMARY 'eitest-A)
|
||||
":primary")
|
||||
|
||||
(defmethod eitest-I :AFTER ((a eitest-A))
|
||||
(defmethod eitest-I :AFTER ((_a eitest-A))
|
||||
(eieio-test-method-store :AFTER 'eitest-A)
|
||||
":after")
|
||||
|
||||
@ -174,17 +174,17 @@
|
||||
(defclass C (C-base1 C-base2) ())
|
||||
|
||||
;; Just use the obsolete name once, to make sure it also works.
|
||||
(defmethod constructor :STATIC ((p C-base1) &rest args)
|
||||
(defmethod constructor :STATIC ((_p C-base1) &rest _args)
|
||||
(eieio-test-method-store :STATIC 'C-base1)
|
||||
(if (next-method-p) (call-next-method))
|
||||
)
|
||||
|
||||
(defmethod make-instance :STATIC ((p C-base2) &rest args)
|
||||
(defmethod make-instance :STATIC ((_p C-base2) &rest _args)
|
||||
(eieio-test-method-store :STATIC 'C-base2)
|
||||
(if (next-method-p) (call-next-method))
|
||||
)
|
||||
|
||||
(cl-defmethod make-instance ((p (subclass C)) &rest args)
|
||||
(cl-defmethod make-instance ((_p (subclass C)) &rest _args)
|
||||
(eieio-test-method-store :STATIC 'C)
|
||||
(cl-call-next-method)
|
||||
)
|
||||
@ -213,24 +213,24 @@
|
||||
(defclass D-base2 (D-base0) () :method-invocation-order :depth-first)
|
||||
(defclass D (D-base1 D-base2) () :method-invocation-order :depth-first)
|
||||
|
||||
(defmethod eitest-F ((p D))
|
||||
(defmethod eitest-F ((_p D))
|
||||
"D"
|
||||
(eieio-test-method-store :PRIMARY 'D)
|
||||
(call-next-method))
|
||||
|
||||
(defmethod eitest-F ((p D-base0))
|
||||
(defmethod eitest-F ((_p D-base0))
|
||||
"D-base0"
|
||||
(eieio-test-method-store :PRIMARY 'D-base0)
|
||||
;; This should have no next
|
||||
;; (when (next-method-p) (call-next-method))
|
||||
)
|
||||
|
||||
(defmethod eitest-F ((p D-base1))
|
||||
(defmethod eitest-F ((_p D-base1))
|
||||
"D-base1"
|
||||
(eieio-test-method-store :PRIMARY 'D-base1)
|
||||
(call-next-method))
|
||||
|
||||
(defmethod eitest-F ((p D-base2))
|
||||
(defmethod eitest-F ((_p D-base2))
|
||||
"D-base2"
|
||||
(eieio-test-method-store :PRIMARY 'D-base2)
|
||||
(when (next-method-p)
|
||||
@ -256,21 +256,21 @@
|
||||
(defclass E-base2 (E-base0) () :method-invocation-order :breadth-first)
|
||||
(defclass E (E-base1 E-base2) () :method-invocation-order :breadth-first)
|
||||
|
||||
(defmethod eitest-F ((p E))
|
||||
(defmethod eitest-F ((_p E))
|
||||
(eieio-test-method-store :PRIMARY 'E)
|
||||
(call-next-method))
|
||||
|
||||
(defmethod eitest-F ((p E-base0))
|
||||
(defmethod eitest-F ((_p E-base0))
|
||||
(eieio-test-method-store :PRIMARY 'E-base0)
|
||||
;; This should have no next
|
||||
;; (when (next-method-p) (call-next-method))
|
||||
)
|
||||
|
||||
(defmethod eitest-F ((p E-base1))
|
||||
(defmethod eitest-F ((_p E-base1))
|
||||
(eieio-test-method-store :PRIMARY 'E-base1)
|
||||
(call-next-method))
|
||||
|
||||
(defmethod eitest-F ((p E-base2))
|
||||
(defmethod eitest-F ((_p E-base2))
|
||||
(eieio-test-method-store :PRIMARY 'E-base2)
|
||||
(when (next-method-p)
|
||||
(call-next-method))
|
||||
@ -293,7 +293,7 @@
|
||||
(defclass eitest-Ja ()
|
||||
())
|
||||
|
||||
(defmethod initialize-instance :after ((this eitest-Ja) &rest slots)
|
||||
(defmethod initialize-instance :after ((_this eitest-Ja) &rest _slots)
|
||||
;(message "+Ja")
|
||||
;; FIXME: Using next-method-p in an after-method is invalid!
|
||||
(when (next-method-p)
|
||||
@ -304,7 +304,7 @@
|
||||
(defclass eitest-Jb ()
|
||||
())
|
||||
|
||||
(defmethod initialize-instance :after ((this eitest-Jb) &rest slots)
|
||||
(defmethod initialize-instance :after ((_this eitest-Jb) &rest _slots)
|
||||
;(message "+Jb")
|
||||
;; FIXME: Using next-method-p in an after-method is invalid!
|
||||
(when (next-method-p)
|
||||
@ -318,7 +318,7 @@
|
||||
(defclass eitest-Jd (eitest-Jc eitest-Ja)
|
||||
())
|
||||
|
||||
(defmethod initialize-instance ((this eitest-Jd) &rest slots)
|
||||
(defmethod initialize-instance ((_this eitest-Jd) &rest _slots)
|
||||
;(message "+Jd")
|
||||
(when (next-method-p)
|
||||
(call-next-method))
|
||||
@ -357,7 +357,7 @@
|
||||
(call-next-method
|
||||
this (cons 'CNM-1-1 args))))
|
||||
|
||||
(defmethod CNM-M ((this CNM-1-2) args)
|
||||
(defmethod CNM-M ((_this CNM-1-2) args)
|
||||
(push (cons 'CNM-1-2 (copy-sequence args))
|
||||
eieio-test-call-next-method-arguments)
|
||||
(when (next-method-p)
|
||||
|
@ -1,4 +1,4 @@
|
||||
;;; eieio-test-persist.el --- Tests for eieio-persistent class
|
||||
;;; eieio-test-persist.el --- Tests for eieio-persistent class -*- lexical-binding:t -*-
|
||||
|
||||
;; Copyright (C) 2011-2020 Free Software Foundation, Inc.
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
;;; faceup-test-mode.el --- Dummy major mode for testing `faceup'.
|
||||
;;; faceup-test-mode.el --- Dummy major mode for testing `faceup'. -*- lexical-binding:t -*-
|
||||
|
||||
;; Copyright (C) 2014-2020 Free Software Foundation, Inc.
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
;;; faceup-test-this-file-directory.el --- Support file for faceup tests
|
||||
;;; faceup-test-this-file-directory.el --- Support file for faceup tests -*- lexical-binding:t -*-
|
||||
|
||||
;; Copyright (C) 2014-2020 Free Software Foundation, Inc.
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
;;; faceup-test-basics.el --- Tests for the `faceup' package.
|
||||
;;; faceup-test-basics.el --- Tests for the `faceup' package. -*- lexical-binding:t -*-
|
||||
|
||||
;; Copyright (C) 2014-2020 Free Software Foundation, Inc.
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
;;; faceup-test-files.el --- Self test of `faceup' using dummy major mode.
|
||||
;;; faceup-test-files.el --- Self test of `faceup' using dummy major mode. -*- lexical-binding:t -*-
|
||||
|
||||
;; Copyright (C) 2014-2020 Free Software Foundation, Inc.
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
;;; new-pkg.el --- A package only seen after "updating" archive-contents
|
||||
;;; new-pkg.el --- A package only seen after "updating" archive-contents -*- lexical-binding:t -*-
|
||||
|
||||
;; Author: J. R. Hacker <jrh@example.com>
|
||||
;; Version: 1.0
|
||||
|
@ -1,4 +1,4 @@
|
||||
;;; simple-single.el --- A single-file package with no dependencies
|
||||
;;; simple-single.el --- A single-file package with no dependencies -*- lexical-binding:t -*-
|
||||
|
||||
;; Author: J. R. Hacker <jrh@example.com>
|
||||
;; Version: 1.4
|
||||
|
@ -1,4 +1,4 @@
|
||||
;;; simple-depend.el --- A single-file package with a dependency.
|
||||
;;; simple-depend.el --- A single-file package with a dependency. -*- lexical-binding:t -*-
|
||||
|
||||
;; Author: J. R. Hacker <jrh@example.com>
|
||||
;; Version: 1.0
|
||||
|
@ -1,4 +1,4 @@
|
||||
;;; simple-single.el --- A single-file package with no dependencies
|
||||
;;; simple-single.el --- A single-file package with no dependencies -*- lexical-binding:t -*-
|
||||
|
||||
;; Author: J. R. Hacker <jrh@example.com>
|
||||
;; Version: 1.3
|
||||
|
@ -1,4 +1,4 @@
|
||||
;;; simple-two-depend.el --- A single-file package with two dependencies.
|
||||
;;; simple-two-depend.el --- A single-file package with two dependencies. -*- lexical-binding:t -*-
|
||||
|
||||
;; Author: J. R. Hacker <jrh@example.com>
|
||||
;; Version: 1.1
|
||||
|
@ -1,4 +1,4 @@
|
||||
;;; package-test.el --- Tests for the Emacs package system
|
||||
;;; package-test.el --- Tests for the Emacs package system -*- lexical-binding:t -*-
|
||||
|
||||
;; Copyright (C) 2013-2020 Free Software Foundation, Inc.
|
||||
|
||||
@ -143,8 +143,8 @@
|
||||
,(if basedir `(cd ,basedir))
|
||||
(unless (file-directory-p package-user-dir)
|
||||
(mkdir package-user-dir))
|
||||
(cl-letf (((symbol-function 'yes-or-no-p) (lambda (&rest r) t))
|
||||
((symbol-function 'y-or-n-p) (lambda (&rest r) t)))
|
||||
(cl-letf (((symbol-function 'yes-or-no-p) (lambda (&rest _) t))
|
||||
((symbol-function 'y-or-n-p) (lambda (&rest _) t)))
|
||||
,@(when install
|
||||
`((package-initialize)
|
||||
(package-refresh-contents)
|
||||
@ -449,7 +449,7 @@ Must called from within a `tar-mode' buffer."
|
||||
(ert-deftest package-test-update-archives ()
|
||||
"Test updating package archives."
|
||||
(with-package-test ()
|
||||
(let ((buf (package-list-packages)))
|
||||
(let ((_buf (package-list-packages)))
|
||||
(revert-buffer)
|
||||
(search-forward-regexp "^ +simple-single")
|
||||
(package-menu-mark-install)
|
||||
@ -593,6 +593,7 @@ Must called from within a `tar-mode' buffer."
|
||||
(should (search-forward "This is a bare-bones readme file for the multi-file"
|
||||
nil t)))))
|
||||
|
||||
(defvar epg-config--program-alist) ; Silence byte-compiler.
|
||||
(ert-deftest package-test-signed ()
|
||||
"Test verifying package signature."
|
||||
(skip-unless (let ((homedir (make-temp-file "package-test" t)))
|
||||
@ -631,7 +632,7 @@ Must called from within a `tar-mode' buffer."
|
||||
(should (progn (package-install 'signed-good) 'noerror))
|
||||
(should (progn (package-install 'signed-bad) 'noerror)))
|
||||
;; Check if the installed package status is updated.
|
||||
(let ((buf (package-list-packages)))
|
||||
(let ((_buf (package-list-packages)))
|
||||
(revert-buffer)
|
||||
(should (re-search-forward
|
||||
"^\\s-+signed-good\\s-+\\(\\S-+\\)\\s-+\\(\\S-+\\)\\s-"
|
||||
|
@ -1 +1 @@
|
||||
;;; This file intentionally left blank.
|
||||
;;; This file intentionally left blank. -*- lexical-binding:t -*-
|
||||
|
@ -1 +1 @@
|
||||
;;; This file intentionally left blank.
|
||||
;;; This file intentionally left blank. -*- lexical-binding:t -*-
|
||||
|
Loading…
Reference in New Issue
Block a user