From 7c68c84674d67d7bee9d78b99ce01ad789a77961 Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Sat, 4 Dec 2021 15:49:42 +0100 Subject: Silence byte-compiler in some tests * test/lisp/dired-tests.el: * test/lisp/emacs-lisp/cl-macs-tests.el: * test/lisp/emacs-lisp/derived-tests.el: * test/lisp/emacs-lisp/eieio-tests/eieio-tests.el: * test/lisp/emacs-lisp/generator-tests.el: * test/lisp/emacs-lisp/lisp-tests.el: * test/lisp/emacs-lisp/seq-tests.el (test-seq-let) (test-seq-setq): * test/lisp/emacs-lisp/subr-x-tests.el (subr-x-test-if-let*-false) (subr-x-test-if-let*-and-laziness-is-preserved) (subr-x-test-when-let*-false) (subr-x-test-when-let*-and-laziness-is-preserved): * test/lisp/emacs-lisp/timer-tests.el (timer-tests-debug-timer-check): * test/lisp/format-spec-tests.el (format-spec-do-flags-truncate) (format-spec-do-flags-pad): * test/lisp/ls-lisp-tests.el (ls-lisp-test-bug27762): * test/lisp/obsolete/cl-tests.el (labels-function-quoting): * test/lisp/progmodes/elisp-mode-tests.el: * test/lisp/replace-tests.el (replace-regexp-bug45973): * test/lisp/ses-tests.el: * test/lisp/subr-tests.el: * test/lisp/tar-mode-tests.el (tar-mode-test-tar-grind-file-mode): * test/src/data-tests.el (data-tests--set-default-per-buffer): * test/src/search-tests.el (test-replace-match-modification-hooks): Silence byte-compiler. --- test/lisp/emacs-lisp/seq-tests.el | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'test/lisp/emacs-lisp/seq-tests.el') diff --git a/test/lisp/emacs-lisp/seq-tests.el b/test/lisp/emacs-lisp/seq-tests.el index 8dc0b93b5af..8cfa3bdb862 100644 --- a/test/lisp/emacs-lisp/seq-tests.el +++ b/test/lisp/emacs-lisp/seq-tests.el @@ -172,17 +172,23 @@ Evaluate BODY for each created sequence. (should-not (seq-find #'null '(1 2 3))) (should (seq-find #'null '(1 2 3) 'sentinel))) +;; Hack to work around the ERT limitation that we can't reliably use +;; `with-suppressed-warnings' inside an `ert-deftest'. (Bug#36568) +(defun seq--contains (&rest args) + (with-suppressed-warnings ((obsolete seq-contains)) + (apply #'seq-contains args))) + (ert-deftest test-seq-contains () (with-test-sequences (seq '(3 4 5 6)) - (should (seq-contains seq 3)) - (should-not (seq-contains seq 7))) + (should (seq--contains seq 3)) + (should-not (seq--contains seq 7))) (with-test-sequences (seq '()) - (should-not (seq-contains seq 3)) - (should-not (seq-contains seq nil)))) + (should-not (seq--contains seq 3)) + (should-not (seq--contains seq nil)))) (ert-deftest test-seq-contains-should-return-the-elt () (with-test-sequences (seq '(3 4 5 6)) - (should (= 5 (seq-contains seq 5))))) + (should (= 5 (seq--contains seq 5))))) (ert-deftest test-seq-contains-p () (with-test-sequences (seq '(3 4 5 6)) @@ -404,7 +410,7 @@ Evaluate BODY for each created sequence. (let ((seq '(1 (2 (3 (4)))))) (seq-let (_ (_ (_ (a)))) seq (should (= a 4)))) - (let (seq) + (let ((seq nil)) (seq-let (a b c) seq (should (null a)) (should (null b)) @@ -428,7 +434,7 @@ Evaluate BODY for each created sequence. (seq '(1 (2 (3 (4)))))) (seq-setq (_ (_ (_ (a)))) seq) (should (= a 4))) - (let (seq a b c) + (let ((seq nil) a b c) (seq-setq (a b c) seq) (should (null a)) (should (null b)) -- cgit v1.2.3 From 8bdea767208257599f6ab727e51dd94f0c1872e1 Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Sun, 5 Dec 2021 04:20:55 +0100 Subject: Remove hack from seq-tests.el for broken `with-suppressed-warnings' * test/lisp/emacs-lisp/seq-tests.el: `with-suppressed-warnings' now works better in erf-deftests, so remove hack that works around it (bug#36568). --- test/lisp/emacs-lisp/seq-tests.el | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) (limited to 'test/lisp/emacs-lisp/seq-tests.el') diff --git a/test/lisp/emacs-lisp/seq-tests.el b/test/lisp/emacs-lisp/seq-tests.el index 8cfa3bdb862..4b940af81f1 100644 --- a/test/lisp/emacs-lisp/seq-tests.el +++ b/test/lisp/emacs-lisp/seq-tests.el @@ -172,23 +172,19 @@ Evaluate BODY for each created sequence. (should-not (seq-find #'null '(1 2 3))) (should (seq-find #'null '(1 2 3) 'sentinel))) -;; Hack to work around the ERT limitation that we can't reliably use -;; `with-suppressed-warnings' inside an `ert-deftest'. (Bug#36568) -(defun seq--contains (&rest args) - (with-suppressed-warnings ((obsolete seq-contains)) - (apply #'seq-contains args))) - (ert-deftest test-seq-contains () - (with-test-sequences (seq '(3 4 5 6)) - (should (seq--contains seq 3)) - (should-not (seq--contains seq 7))) - (with-test-sequences (seq '()) - (should-not (seq--contains seq 3)) - (should-not (seq--contains seq nil)))) + (with-suppressed-warnings ((obsolete seq-contains)) + (with-test-sequences (seq '(3 4 5 6)) + (should (seq-contains seq 3)) + (should-not (seq-contains seq 7))) + (with-test-sequences (seq '()) + (should-not (seq-contains seq 3)) + (should-not (seq-contains seq nil))))) (ert-deftest test-seq-contains-should-return-the-elt () - (with-test-sequences (seq '(3 4 5 6)) - (should (= 5 (seq--contains seq 5))))) + (with-suppressed-warnings ((obsolete seq-contains)) + (with-test-sequences (seq '(3 4 5 6)) + (should (= 5 (seq-contains seq 5)))))) (ert-deftest test-seq-contains-p () (with-test-sequences (seq '(3 4 5 6)) -- cgit v1.2.3