From: Stefan Kangas Date: Sat, 29 Aug 2020 18:55:46 +0000 (+0200) Subject: Use lexical-binding in more tests X-Git-Tag: emacs-28.0.90~6325 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=2aeff0794a2b2b86ffe4325a8c677ebbfb2afa1f;p=emacs.git Use lexical-binding in more tests * test/lib-src/emacsclient-tests.el: * test/lisp/emacs-lisp/hierarchy-tests.el: * test/lisp/eshell/eshell-tests.el: * test/lisp/gnus/gnus-util-tests.el: * test/lisp/progmodes/js-tests.el: * test/lisp/textmodes/bibtex-tests.el: * test/src/editfns-tests.el: * test/src/fns-tests.el: Use lexical-binding. * test/lisp/emacs-lisp/hierarchy-tests.el (hierarchy-leafs-includes-lonely-roots): * test/src/editfns-tests.el (transpose-test-get-byte-positions): * test/src/fns-tests.el (fns-tests-func-arity): Adjust for lexical-binding. --- diff --git a/test/lib-src/emacsclient-tests.el b/test/lib-src/emacsclient-tests.el index 901922c03e1..a502bb782f2 100644 --- a/test/lib-src/emacsclient-tests.el +++ b/test/lib-src/emacsclient-tests.el @@ -1,4 +1,4 @@ -;;; emacsclient-tests.el --- Test emacsclient +;;; emacsclient-tests.el --- Test emacsclient -*- lexical-binding:t -*- ;; Copyright (C) 2016-2020 Free Software Foundation, Inc. diff --git a/test/lisp/emacs-lisp/hierarchy-tests.el b/test/lisp/emacs-lisp/hierarchy-tests.el index 23cfc79d848..41d3f2f3ccf 100644 --- a/test/lisp/emacs-lisp/hierarchy-tests.el +++ b/test/lisp/emacs-lisp/hierarchy-tests.el @@ -1,4 +1,4 @@ -;;; hierarchy-tests.el --- Tests for hierarchy.el +;;; hierarchy-tests.el --- Tests for hierarchy.el -*- lexical-binding:t -*- ;; Copyright (C) 2017-2019 Damien Cassou @@ -274,7 +274,7 @@ '(dove pigeon dolphin cow))))) (ert-deftest hierarchy-leafs-includes-lonely-roots () - (let ((parentfn (lambda (item) nil)) + (let ((parentfn (lambda (_) nil)) (hierarchy (hierarchy-new))) (hierarchy-add-tree hierarchy 'foo parentfn) (should (equal (hierarchy-leafs hierarchy) diff --git a/test/lisp/eshell/eshell-tests.el b/test/lisp/eshell/eshell-tests.el index 16a04647723..1b93fb0fbbc 100644 --- a/test/lisp/eshell/eshell-tests.el +++ b/test/lisp/eshell/eshell-tests.el @@ -1,4 +1,4 @@ -;;; tests/eshell-tests.el --- Eshell test suite +;;; tests/eshell-tests.el --- Eshell test suite -*- lexical-binding:t -*- ;; Copyright (C) 1999-2020 Free Software Foundation, Inc. @@ -61,6 +61,8 @@ (eshell-insert-command text func) (eshell-match-result regexp)) +(defvar eshell-history-file-name) + (defun eshell-test-command-result (command) "Like `eshell-command-result', but not using HOME." (let ((eshell-directory-name (make-temp-file "eshell" t)) diff --git a/test/lisp/gnus/gnus-util-tests.el b/test/lisp/gnus/gnus-util-tests.el index b01e2fc2966..7eadb0de716 100644 --- a/test/lisp/gnus/gnus-util-tests.el +++ b/test/lisp/gnus/gnus-util-tests.el @@ -1,4 +1,4 @@ -;;; gnus-util-tests.el --- Selectived tests only. +;;; gnus-util-tests.el --- Selectived tests only. -*- lexical-binding:t -*- ;; Copyright (C) 2015-2020 Free Software Foundation, Inc. ;; Author: Jens Lechtenbörger diff --git a/test/lisp/progmodes/js-tests.el b/test/lisp/progmodes/js-tests.el index 0d53c0681bf..681e51de0ed 100644 --- a/test/lisp/progmodes/js-tests.el +++ b/test/lisp/progmodes/js-tests.el @@ -1,4 +1,4 @@ -;;; js-tests.el --- Test suite for js-mode +;;; js-tests.el --- Test suite for js-mode -*- lexical-binding:t -*- ;; Copyright (C) 2017-2020 Free Software Foundation, Inc. diff --git a/test/lisp/textmodes/bibtex-tests.el b/test/lisp/textmodes/bibtex-tests.el index b3858de9e61..c12722fca13 100644 --- a/test/lisp/textmodes/bibtex-tests.el +++ b/test/lisp/textmodes/bibtex-tests.el @@ -1,4 +1,4 @@ -;;; bibtex-tests.el --- Test suite for bibtex. +;;; bibtex-tests.el --- Test suite for bibtex. -*- lexical-binding:t -*- ;; Copyright (C) 2013-2020 Free Software Foundation, Inc. diff --git a/test/src/editfns-tests.el b/test/src/editfns-tests.el index d7c7aec17c3..de0aeabfe78 100644 --- a/test/src/editfns-tests.el +++ b/test/src/editfns-tests.el @@ -1,4 +1,4 @@ -;;; editfns-tests.el -- tests for editfns.c +;;; editfns-tests.el -- tests for editfns.c -*- lexical-binding:t -*- ;; Copyright (C) 2016-2020 Free Software Foundation, Inc. @@ -124,8 +124,8 @@ "Validate character position to byte position translation." (let ((bytes '())) (dotimes (pos len) - (setq bytes (add-to-list 'bytes (position-bytes (1+ pos)) t))) - bytes)) + (push (position-bytes (1+ pos)) bytes)) + (nreverse bytes))) (ert-deftest transpose-ascii-regions-test () (with-temp-buffer diff --git a/test/src/fns-tests.el b/test/src/fns-tests.el index 400e9126486..b9a7d29895a 100644 --- a/test/src/fns-tests.el +++ b/test/src/fns-tests.el @@ -1,4 +1,4 @@ -;;; fns-tests.el --- tests for src/fns.c +;;; fns-tests.el --- tests for src/fns.c -*- lexical-binding:t -*- ;; Copyright (C) 2014-2020 Free Software Foundation, Inc. @@ -229,8 +229,8 @@ (require 'info) (should (equal (func-arity 'Info-goto-node) '(1 . 3))) (should (equal (func-arity (lambda (&rest x))) '(0 . many))) - (should (equal (func-arity (eval (lambda (x &optional y)) nil)) '(1 . 2))) - (should (equal (func-arity (eval (lambda (x &optional y)) t)) '(1 . 2))) + (should (equal (func-arity (eval '(lambda (x &optional y)) nil)) '(1 . 2))) + (should (equal (func-arity (eval '(lambda (x &optional y)) t)) '(1 . 2))) (should (equal (func-arity 'let) '(1 . unevalled)))) (defun fns-tests--string-repeat (s o)