diff options
| author | Stefan Monnier | 2023-02-25 22:34:02 -0500 |
|---|---|---|
| committer | Stefan Monnier | 2023-02-25 22:34:02 -0500 |
| commit | 2baf08683fcf4b6b1ad65a6dc239b889d78a74b2 (patch) | |
| tree | 54ac13ec1f203aa95743bd4dfa7f3bcdf941f93a /test/lisp | |
| parent | b26d0dd58371f19fec44e9c5d8a64697ee06d8b5 (diff) | |
| download | emacs-2baf08683fcf4b6b1ad65a6dc239b889d78a74b2.tar.gz emacs-2baf08683fcf4b6b1ad65a6dc239b889d78a74b2.zip | |
(bytecomp-warn--ignore): New test
Add tests for the interaction of `ignore` with warnings.
* test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp-warn--ignore): New test.
(bytecomp--with-warning-test): Really make it a function.
Diffstat (limited to 'test/lisp')
| -rw-r--r-- | test/lisp/emacs-lisp/bytecomp-tests.el | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/test/lisp/emacs-lisp/bytecomp-tests.el b/test/lisp/emacs-lisp/bytecomp-tests.el index 00abe730948..185abaf5c22 100644 --- a/test/lisp/emacs-lisp/bytecomp-tests.el +++ b/test/lisp/emacs-lisp/bytecomp-tests.el | |||
| @@ -888,8 +888,6 @@ byte-compiled. Run with dynamic binding." | |||
| 888 | 888 | ||
| 889 | (defun 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 | `(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*") | 891 | (with-current-buffer (get-buffer-create "*Compile-Log*") |
| 894 | (let ((inhibit-read-only t)) (erase-buffer)) | 892 | (let ((inhibit-read-only t)) (erase-buffer)) |
| 895 | (let ((text-quoting-style 'grave) | 893 | (let ((text-quoting-style 'grave) |
| @@ -901,6 +899,16 @@ byte-compiled. Run with dynamic binding." | |||
| 901 | (should (re-search-forward | 899 | (should (re-search-forward |
| 902 | (string-replace " " "[ \n]+" re-warning)))))))) | 900 | (string-replace " " "[ \n]+" re-warning)))))))) |
| 903 | 901 | ||
| 902 | (ert-deftest bytecomp-warn--ignore () | ||
| 903 | (bytecomp--with-warning-test "unused" | ||
| 904 | '(lambda (y) 6)) | ||
| 905 | (bytecomp--with-warning-test "\\`\\'" ;No warning! | ||
| 906 | '(lambda (y) (ignore y) 6)) | ||
| 907 | (bytecomp--with-warning-test "assq" | ||
| 908 | '(lambda (x y) (progn (assq x y) 5))) | ||
| 909 | (bytecomp--with-warning-test "\\`\\'" ;No warning! | ||
| 910 | '(lambda (x y) (progn (ignore (assq x y)) 5)))) | ||
| 911 | |||
| 904 | (ert-deftest bytecomp-warn-wrong-args () | 912 | (ert-deftest bytecomp-warn-wrong-args () |
| 905 | (bytecomp--with-warning-test "remq.*3.*2" | 913 | (bytecomp--with-warning-test "remq.*3.*2" |
| 906 | '(remq 1 2 3))) | 914 | '(remq 1 2 3))) |