diff options
author | Andrea Corallo <akrl@sdf.org> | 2019-10-11 12:18:21 -0400 |
---|---|---|
committer | Stefan Monnier <monnier@iro.umontreal.ca> | 2019-10-11 12:18:21 -0400 |
commit | 421db07d061cdc493300b30646c2acd13f26d8f3 (patch) | |
tree | ce05322b0458a08547371254aaad0623235fbe77 /test/lisp/emacs-lisp | |
parent | 65cda95be4f69c32b16364c95cb7c08971bc9397 (diff) | |
download | emacs-421db07d061cdc493300b30646c2acd13f26d8f3.tar.gz emacs-421db07d061cdc493300b30646c2acd13f26d8f3.tar.bz2 emacs-421db07d061cdc493300b30646c2acd13f26d8f3.zip |
* lisp/emacs-lisp/map.el (map-into) <hash-table>: Allow keyword args
(map--into-hash): New function, extracted from `map-into <hash-table>`.
Speed it up a bit by using gethash instead of map-elt when we know
we're accessing a hash table.
* test/lisp/emacs-lisp/map-tests.el (test-map-into): Add corresponding test.
Diffstat (limited to 'test/lisp/emacs-lisp')
-rw-r--r-- | test/lisp/emacs-lisp/map-tests.el | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/test/lisp/emacs-lisp/map-tests.el b/test/lisp/emacs-lisp/map-tests.el index a54af8059b3..5e8c9cb9f07 100644 --- a/test/lisp/emacs-lisp/map-tests.el +++ b/test/lisp/emacs-lisp/map-tests.el @@ -340,7 +340,8 @@ Evaluate BODY for each created map. (ert-deftest test-map-into () (let* ((alist '((a . 1) (b . 2))) - (ht (map-into alist 'hash-table))) + (ht (map-into alist 'hash-table)) + (ht2 (map-into alist '(hash-table :test equal)))) (should (hash-table-p ht)) (should (equal (map-into (map-into alist 'hash-table) 'list) alist)) @@ -349,6 +350,8 @@ Evaluate BODY for each created map. (map-keys ht))) (should (equal (map-values (map-into (map-into ht 'list) 'hash-table)) (map-values ht))) + (should (equal (map-into ht 'alist) (map-into ht2 'alist))) + (should (eq (hash-table-test ht2) 'equal)) (should (null (map-into nil 'list))) (should (map-empty-p (map-into nil 'hash-table))) (should-error (map-into [1 2 3] 'string)))) |