summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorNoam Postavsky <npostavs@gmail.com>2019-05-27 20:36:41 -0400
committerNoam Postavsky <npostavs@gmail.com>2019-05-30 18:46:07 -0400
commit134edc10367a8434167656e631865c85b5f10c42 (patch)
tree5840d5b40a565a560cd63038c35706e6b8f5f3b4 /test
parent5f01af6c8e0f7355f7a99a80ff32369071f65eda (diff)
downloademacs-134edc10367a8434167656e631865c85b5f10c42.tar.gz
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.el14
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."
;; Should not warn that mt--test2 is not known to be defined.
(should-not (re-search-forward "my--test2" nil t))))
+(ert-deftest bytecomp-warn-wrong-args ()
+ (with-current-buffer (get-buffer-create "*Compile-Log*")
+ (let ((inhibit-read-only t)) (erase-buffer))
+ (byte-compile '(remq 1 2 3))
+ (ert-info ((buffer-string) :prefix "buffer: ")
+ (should (re-search-forward "remq.*3.*2")))))
+
+(ert-deftest bytecomp-warn-wrong-args-subr ()
+ (with-current-buffer (get-buffer-create "*Compile-Log*")
+ (let ((inhibit-read-only t)) (erase-buffer))
+ (byte-compile '(safe-length 1 2 3))
+ (ert-info ((buffer-string) :prefix "buffer: ")
+ (should (re-search-forward "safe-length.*3.*1")))))
+
(ert-deftest test-eager-load-macro-expansion ()
(test-byte-comp-compile-and-load nil
'(progn (defmacro abc (arg) 1) (defun def () (abc 2))))