mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-06 06:20:55 -08:00
bytecomp--with-warning-test: Make it a function
* lisp/emacs-lisp/bytecomp.el (bytecomp--with-warning-test): Make it a function.
This commit is contained in:
parent
309e6aaa68
commit
e91d29f004
1 changed files with 7 additions and 6 deletions
|
|
@ -886,19 +886,20 @@ byte-compiled. Run with dynamic binding."
|
||||||
;; Should not warn that mt--test2 is not known to be defined.
|
;; Should not warn that mt--test2 is not known to be defined.
|
||||||
(should-not (re-search-forward "my--test2" nil t))))
|
(should-not (re-search-forward "my--test2" nil t))))
|
||||||
|
|
||||||
(defmacro bytecomp--with-warning-test (re-warning form)
|
(defun bytecomp--with-warning-test (re-warning form)
|
||||||
(declare (indent 1))
|
(declare (indent 1))
|
||||||
`(with-current-buffer (get-buffer-create "*Compile-Log*")
|
`(bytecomp--with-warning-test-1 ,re-warning ,form))
|
||||||
|
(defun bytecomp--with-warning-test-1 (re-warning form)
|
||||||
|
(with-current-buffer (get-buffer-create "*Compile-Log*")
|
||||||
(let ((inhibit-read-only t)) (erase-buffer))
|
(let ((inhibit-read-only t)) (erase-buffer))
|
||||||
(let ((text-quoting-style 'grave)
|
(let ((text-quoting-style 'grave)
|
||||||
(macroexp--warned
|
(macroexp--warned ; oh dear
|
||||||
(make-hash-table :test #'equal :weakness 'key)) ; oh dear
|
(make-hash-table :test #'equal :weakness 'key)))
|
||||||
(form ,form))
|
|
||||||
(ert-info ((prin1-to-string form) :prefix "form: ")
|
(ert-info ((prin1-to-string form) :prefix "form: ")
|
||||||
(byte-compile form)
|
(byte-compile form)
|
||||||
(ert-info ((prin1-to-string (buffer-string)) :prefix "buffer: ")
|
(ert-info ((prin1-to-string (buffer-string)) :prefix "buffer: ")
|
||||||
(should (re-search-forward
|
(should (re-search-forward
|
||||||
(string-replace " " "[ \n]+" ,re-warning))))))))
|
(string-replace " " "[ \n]+" re-warning))))))))
|
||||||
|
|
||||||
(ert-deftest bytecomp-warn-wrong-args ()
|
(ert-deftest bytecomp-warn-wrong-args ()
|
||||||
(bytecomp--with-warning-test "remq.*3.*2"
|
(bytecomp--with-warning-test "remq.*3.*2"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue