* lisp/subr.el (list-of-strings-p): Speed up by a factor 4 (approx.)
and don't crash on dotted lists.
* test/lisp/subr-tests.el (test-list-of-strings-p): Extend test.
(defun list-of-strings-p (object)
"Return t if OBJECT is nil or a list of strings."
- (and (listp object)
- (seq-every-p #'stringp object)))
+ (while (and (consp object) (stringp (car object)))
+ (setq object (cdr object)))
+ (null object))
(defun booleanp (object)
"Return t if OBJECT is one of the two canonical boolean values: t or nil.
(should (list-of-strings-p nil))
(should (list-of-strings-p '("a" "b")))
(should-not (list-of-strings-p ["a" "b"]))
- (should-not (list-of-strings-p '("a" nil "b"))))
+ (should-not (list-of-strings-p '("a" nil "b")))
+ (should-not (list-of-strings-p '("a" "b" . "c"))))
(provide 'subr-tests)
;;; subr-tests.el ends here