\(fn (VAR LIST [RESULT]) BODY...)"
(declare (indent 1) (debug ((symbolp form &optional form) body)))
+ (unless (consp spec)
+ (signal 'wrong-type-argument (list 'consp spec)))
+ (unless (<= 2 (length spec) 3)
+ (signal 'wrong-number-of-arguments (list '(2 . 3) (length spec))))
;; It would be cleaner to create an uninterned symbol,
;; but that uses a lot more space when many functions in many files
;; use dolist.
(should (equal (string-match-p "\\`[[:blank:]]\\'" "\u3000") 0))
(should-not (string-match-p "\\`[[:blank:]]\\'" "\N{LINE SEPARATOR}")))
+(ert-deftest subr-tests--dolist--wrong-number-of-args ()
+ "Test that `dolist' doesn't accept wrong types or length of SPEC,
+cf. Bug#25477."
+ (should-error (eval '(dolist (a)))
+ :type 'wrong-number-of-arguments)
+ (should-error (eval '(dolist (a () 'result 'invalid)) t)
+ :type 'wrong-number-of-arguments)
+ (should-error (eval '(dolist "foo") t)
+ :type 'wrong-type-argument))
+
(provide 'subr-tests)
;;; subr-tests.el ends here