* lisp/emacs-lisp/map.el (map-into): Throw an error if type is not valid.
* test/automated/map-test.el: Add a regression test.
TYPE can be one of the following symbols: list or hash-table."
(pcase type
(`list (map-pairs map))
- (`hash-table (map--into-hash-table map))))
+ (`hash-table (map--into-hash-table map))
+ (t (error "Not a map type name: %s" type))))
(defmacro map--dispatch (spec &rest args)
"Evaluate one of the provided forms depending on the type of MAP.
(assert (equal (map-values (map-into (map-into ht 'list) 'hash-table))
(map-values ht)))
(assert (null (map-into nil 'list)))
- (assert (map-empty-p (map-into nil 'hash-table)))))
+ (assert (map-empty-p (map-into nil 'hash-table)))
+ (should-error (map-into [1 2 3] 'string))))
(provide 'map-tests)
;;; map-tests.el ends here