diff options
| author | Noam Postavsky | 2019-05-27 20:36:41 -0400 |
|---|---|---|
| committer | Noam Postavsky | 2019-05-30 18:46:07 -0400 |
| commit | 134edc10367a8434167656e631865c85b5f10c42 (patch) | |
| tree | 5840d5b40a565a560cd63038c35706e6b8f5f3b4 /test | |
| parent | 5f01af6c8e0f7355f7a99a80ff32369071f65eda (diff) | |
| download | emacs-134edc10367a8434167656e631865c85b5f10c42.tar.gz emacs-134edc10367a8434167656e631865c85b5f10c42.zip | |
Warn about wrong number of args for subrs (Bug#35767)
* lisp/emacs-lisp/bytecomp.el (byte-compile-callargs-warn): Don't
assume byte-compile-fdefinition will return non-nil.
* test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp-warn-wrong-args)
(bytecomp-warn-wrong-args-subr): New tests.
Diffstat (limited to 'test')
| -rw-r--r-- | test/lisp/emacs-lisp/bytecomp-tests.el | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/test/lisp/emacs-lisp/bytecomp-tests.el b/test/lisp/emacs-lisp/bytecomp-tests.el index bc28c5a6a00..c399f65b402 100644 --- a/test/lisp/emacs-lisp/bytecomp-tests.el +++ b/test/lisp/emacs-lisp/bytecomp-tests.el | |||
| @@ -438,6 +438,20 @@ Subtests signal errors if something goes wrong." | |||
| 438 | ;; Should not warn that mt--test2 is not known to be defined. | 438 | ;; Should not warn that mt--test2 is not known to be defined. |
| 439 | (should-not (re-search-forward "my--test2" nil t)))) | 439 | (should-not (re-search-forward "my--test2" nil t)))) |
| 440 | 440 | ||
| 441 | (ert-deftest bytecomp-warn-wrong-args () | ||
| 442 | (with-current-buffer (get-buffer-create "*Compile-Log*") | ||
| 443 | (let ((inhibit-read-only t)) (erase-buffer)) | ||
| 444 | (byte-compile '(remq 1 2 3)) | ||
| 445 | (ert-info ((buffer-string) :prefix "buffer: ") | ||
| 446 | (should (re-search-forward "remq.*3.*2"))))) | ||
| 447 | |||
| 448 | (ert-deftest bytecomp-warn-wrong-args-subr () | ||
| 449 | (with-current-buffer (get-buffer-create "*Compile-Log*") | ||
| 450 | (let ((inhibit-read-only t)) (erase-buffer)) | ||
| 451 | (byte-compile '(safe-length 1 2 3)) | ||
| 452 | (ert-info ((buffer-string) :prefix "buffer: ") | ||
| 453 | (should (re-search-forward "safe-length.*3.*1"))))) | ||
| 454 | |||
| 441 | (ert-deftest test-eager-load-macro-expansion () | 455 | (ert-deftest test-eager-load-macro-expansion () |
| 442 | (test-byte-comp-compile-and-load nil | 456 | (test-byte-comp-compile-and-load nil |
| 443 | '(progn (defmacro abc (arg) 1) (defun def () (abc 2)))) | 457 | '(progn (defmacro abc (arg) 1) (defun def () (abc 2)))) |