summaryrefslogtreecommitdiff
path: root/test/lisp/emacs-lisp
diff options
context:
space:
mode:
authorMattias EngdegÄrd <mattiase@acm.org>2023-09-09 13:03:42 +0200
committerMattias EngdegÄrd <mattiase@acm.org>2023-09-09 13:24:30 +0200
commit176b7dad71ee92aeab7cdc75db8a5d4f9648fb54 (patch)
treecdba74148c104b32946746b185345bd65faae74e /test/lisp/emacs-lisp
parent9d27b95b263473fb41a30e3f6ea5607c99e93a61 (diff)
downloademacs-176b7dad71ee92aeab7cdc75db8a5d4f9648fb54.tar.gz
emacs-176b7dad71ee92aeab7cdc75db8a5d4f9648fb54.tar.bz2
emacs-176b7dad71ee92aeab7cdc75db8a5d4f9648fb54.zip
Don't cache warnings between bytecode compilation tests
* test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp-tests--with-fresh-warnings): New macro. (test-byte-comp-compile-and-load, bytecomp--with-warning-test): Use it.
Diffstat (limited to 'test/lisp/emacs-lisp')
-rw-r--r--test/lisp/emacs-lisp/bytecomp-tests.el17
1 files changed, 11 insertions, 6 deletions
diff --git a/test/lisp/emacs-lisp/bytecomp-tests.el b/test/lisp/emacs-lisp/bytecomp-tests.el
index 26325c1ef11..8bc8a51b04e 100644
--- a/test/lisp/emacs-lisp/bytecomp-tests.el
+++ b/test/lisp/emacs-lisp/bytecomp-tests.el
@@ -838,6 +838,11 @@ byte-compiled. Run with dynamic binding."
(should (equal (bytecomp-tests--eval-interpreted form)
(bytecomp-tests--eval-compiled form)))))))
+(defmacro bytecomp-tests--with-fresh-warnings (&rest body)
+ `(let ((macroexp--warned ; oh dear
+ (make-hash-table :test #'equal :weakness 'key)))
+ ,@body))
+
(defun test-byte-comp-compile-and-load (compile &rest forms)
(declare (indent 1))
(ert-with-temp-file elfile
@@ -852,7 +857,8 @@ byte-compiled. Run with dynamic binding."
(if compile
(let ((byte-compile-dest-file-function
(lambda (e) elcfile)))
- (byte-compile-file elfile)))
+ (bytecomp-tests--with-fresh-warnings
+ (byte-compile-file elfile))))
(load elfile nil 'nomessage))))
(ert-deftest test-byte-comp-macro-expansion ()
@@ -923,14 +929,13 @@ byte-compiled. Run with dynamic binding."
(declare (indent 1))
(with-current-buffer (get-buffer-create "*Compile-Log*")
(let ((inhibit-read-only t)) (erase-buffer))
- (let ((text-quoting-style 'grave)
- (macroexp--warned ; oh dear
- (make-hash-table :test #'equal :weakness 'key)))
(ert-info ((prin1-to-string form) :prefix "form: ")
- (byte-compile form)
+ (let ((text-quoting-style 'grave))
+ (bytecomp-tests--with-fresh-warnings
+ (byte-compile form)))
(ert-info ((prin1-to-string (buffer-string)) :prefix "buffer: ")
(should (re-search-forward
- (string-replace " " "[ \n]+" re-warning))))))))
+ (string-replace " " "[ \n]+" re-warning)))))))
(ert-deftest bytecomp-warn--ignore ()
(bytecomp--with-warning-test "unused"