diff options
| author | Stefan Monnier | 2023-02-25 17:45:40 -0500 |
|---|---|---|
| committer | Stefan Monnier | 2023-02-25 17:45:40 -0500 |
| commit | e91d29f0048d49c4f186e76b8d55cf39e7e77d63 (patch) | |
| tree | b0918241494479e298f9d270bbc7784d484a678c /test | |
| parent | 309e6aaa6867cd9a33e185d929afe18a660a8151 (diff) | |
| download | emacs-e91d29f0048d49c4f186e76b8d55cf39e7e77d63.tar.gz emacs-e91d29f0048d49c4f186e76b8d55cf39e7e77d63.zip | |
bytecomp--with-warning-test: Make it a function
* lisp/emacs-lisp/bytecomp.el (bytecomp--with-warning-test):
Make it a function.
Diffstat (limited to 'test')
| -rw-r--r-- | test/lisp/emacs-lisp/bytecomp-tests.el | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/test/lisp/emacs-lisp/bytecomp-tests.el b/test/lisp/emacs-lisp/bytecomp-tests.el index 4b0a714e52d..00abe730948 100644 --- a/test/lisp/emacs-lisp/bytecomp-tests.el +++ b/test/lisp/emacs-lisp/bytecomp-tests.el | |||
| @@ -886,19 +886,20 @@ byte-compiled. Run with dynamic binding." | |||
| 886 | ;; Should not warn that mt--test2 is not known to be defined. | 886 | ;; Should not warn that mt--test2 is not known to be defined. |
| 887 | (should-not (re-search-forward "my--test2" nil t)))) | 887 | (should-not (re-search-forward "my--test2" nil t)))) |
| 888 | 888 | ||
| 889 | (defmacro bytecomp--with-warning-test (re-warning form) | 889 | (defun bytecomp--with-warning-test (re-warning form) |
| 890 | (declare (indent 1)) | 890 | (declare (indent 1)) |
| 891 | `(with-current-buffer (get-buffer-create "*Compile-Log*") | 891 | `(bytecomp--with-warning-test-1 ,re-warning ,form)) |
| 892 | (defun bytecomp--with-warning-test-1 (re-warning form) | ||
| 893 | (with-current-buffer (get-buffer-create "*Compile-Log*") | ||
| 892 | (let ((inhibit-read-only t)) (erase-buffer)) | 894 | (let ((inhibit-read-only t)) (erase-buffer)) |
| 893 | (let ((text-quoting-style 'grave) | 895 | (let ((text-quoting-style 'grave) |
| 894 | (macroexp--warned | 896 | (macroexp--warned ; oh dear |
| 895 | (make-hash-table :test #'equal :weakness 'key)) ; oh dear | 897 | (make-hash-table :test #'equal :weakness 'key))) |
| 896 | (form ,form)) | ||
| 897 | (ert-info ((prin1-to-string form) :prefix "form: ") | 898 | (ert-info ((prin1-to-string form) :prefix "form: ") |
| 898 | (byte-compile form) | 899 | (byte-compile form) |
| 899 | (ert-info ((prin1-to-string (buffer-string)) :prefix "buffer: ") | 900 | (ert-info ((prin1-to-string (buffer-string)) :prefix "buffer: ") |
| 900 | (should (re-search-forward | 901 | (should (re-search-forward |
| 901 | (string-replace " " "[ \n]+" ,re-warning)))))))) | 902 | (string-replace " " "[ \n]+" re-warning)))))))) |
| 902 | 903 | ||
| 903 | (ert-deftest bytecomp-warn-wrong-args () | 904 | (ert-deftest bytecomp-warn-wrong-args () |
| 904 | (bytecomp--with-warning-test "remq.*3.*2" | 905 | (bytecomp--with-warning-test "remq.*3.*2" |