aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattias EngdegÄrd2023-09-09 13:03:42 +0200
committerMattias EngdegÄrd2023-09-09 13:24:30 +0200
commit176b7dad71ee92aeab7cdc75db8a5d4f9648fb54 (patch)
treecdba74148c104b32946746b185345bd65faae74e
parent9d27b95b263473fb41a30e3f6ea5607c99e93a61 (diff)
downloademacs-176b7dad71ee92aeab7cdc75db8a5d4f9648fb54.tar.gz
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.
-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."
838 (should (equal (bytecomp-tests--eval-interpreted form) 838 (should (equal (bytecomp-tests--eval-interpreted form)
839 (bytecomp-tests--eval-compiled form))))))) 839 (bytecomp-tests--eval-compiled form)))))))
840 840
841(defmacro bytecomp-tests--with-fresh-warnings (&rest body)
842 `(let ((macroexp--warned ; oh dear
843 (make-hash-table :test #'equal :weakness 'key)))
844 ,@body))
845
841(defun test-byte-comp-compile-and-load (compile &rest forms) 846(defun test-byte-comp-compile-and-load (compile &rest forms)
842 (declare (indent 1)) 847 (declare (indent 1))
843 (ert-with-temp-file elfile 848 (ert-with-temp-file elfile
@@ -852,7 +857,8 @@ byte-compiled. Run with dynamic binding."
852 (if compile 857 (if compile
853 (let ((byte-compile-dest-file-function 858 (let ((byte-compile-dest-file-function
854 (lambda (e) elcfile))) 859 (lambda (e) elcfile)))
855 (byte-compile-file elfile))) 860 (bytecomp-tests--with-fresh-warnings
861 (byte-compile-file elfile))))
856 (load elfile nil 'nomessage)))) 862 (load elfile nil 'nomessage))))
857 863
858(ert-deftest test-byte-comp-macro-expansion () 864(ert-deftest test-byte-comp-macro-expansion ()
@@ -923,14 +929,13 @@ byte-compiled. Run with dynamic binding."
923 (declare (indent 1)) 929 (declare (indent 1))
924 (with-current-buffer (get-buffer-create "*Compile-Log*") 930 (with-current-buffer (get-buffer-create "*Compile-Log*")
925 (let ((inhibit-read-only t)) (erase-buffer)) 931 (let ((inhibit-read-only t)) (erase-buffer))
926 (let ((text-quoting-style 'grave)
927 (macroexp--warned ; oh dear
928 (make-hash-table :test #'equal :weakness 'key)))
929 (ert-info ((prin1-to-string form) :prefix "form: ") 932 (ert-info ((prin1-to-string form) :prefix "form: ")
930 (byte-compile form) 933 (let ((text-quoting-style 'grave))
934 (bytecomp-tests--with-fresh-warnings
935 (byte-compile form)))
931 (ert-info ((prin1-to-string (buffer-string)) :prefix "buffer: ") 936 (ert-info ((prin1-to-string (buffer-string)) :prefix "buffer: ")
932 (should (re-search-forward 937 (should (re-search-forward
933 (string-replace " " "[ \n]+" re-warning)))))))) 938 (string-replace " " "[ \n]+" re-warning)))))))
934 939
935(ert-deftest bytecomp-warn--ignore () 940(ert-deftest bytecomp-warn--ignore ()
936 (bytecomp--with-warning-test "unused" 941 (bytecomp--with-warning-test "unused"