summaryrefslogtreecommitdiff
path: root/test/lisp/emacs-lisp/map-tests.el
diff options
context:
space:
mode:
authorNoam Postavsky <npostavs@gmail.com>2017-08-04 17:55:50 -0400
committerNoam Postavsky <npostavs@gmail.com>2017-08-04 18:22:06 -0400
commit3a0f2dfa79611d5f3789a1127603d3798e83b9f8 (patch)
tree47ef1b913b0c6cd23572d48bc0acb233430c8eab /test/lisp/emacs-lisp/map-tests.el
parent4b7f822cd53a50e83008ab4f561563d8977a74ec (diff)
downloademacs-3a0f2dfa79611d5f3789a1127603d3798e83b9f8.tar.gz
; Fix map-tests when compiled
* test/lisp/emacs-lisp/map-tests.el (test-map-elt-testfn) (test-map-put-testfn-alist): Make sure the lookup key is really non-eq to the map's key, even if the code is compiled.
Diffstat (limited to 'test/lisp/emacs-lisp/map-tests.el')
-rw-r--r--test/lisp/emacs-lisp/map-tests.el16
1 files changed, 10 insertions, 6 deletions
diff --git a/test/lisp/emacs-lisp/map-tests.el b/test/lisp/emacs-lisp/map-tests.el
index 15b0655040c..fc0a6a57c71 100644
--- a/test/lisp/emacs-lisp/map-tests.el
+++ b/test/lisp/emacs-lisp/map-tests.el
@@ -64,9 +64,11 @@ Evaluate BODY for each created map.
(should (= 5 (map-elt map 7 5)))))
(ert-deftest test-map-elt-testfn ()
- (let ((map (list (cons "a" 1) (cons "b" 2))))
- (should-not (map-elt map "a"))
- (should (map-elt map "a" nil 'equal))))
+ (let ((map (list (cons "a" 1) (cons "b" 2)))
+ ;; Make sure to use a non-eq "a", even when compiled.
+ (noneq-key (string ?a)))
+ (should-not (map-elt map noneq-key))
+ (should (map-elt map noneq-key nil 'equal))))
(ert-deftest test-map-elt-with-nil-value ()
(should (null (map-elt '((a . 1)
@@ -100,10 +102,12 @@ Evaluate BODY for each created map.
'b))))
(ert-deftest test-map-put-testfn-alist ()
- (let ((alist (list (cons "a" 1) (cons "b" 2))))
- (map-put alist "a" 3 'equal)
+ (let ((alist (list (cons "a" 1) (cons "b" 2)))
+ ;; Make sure to use a non-eq "a", even when compiled.
+ (noneq-key (string ?a)))
+ (map-put alist noneq-key 3 'equal)
(should-not (cddr alist))
- (map-put alist "a" 9)
+ (map-put alist noneq-key 9)
(should (cddr alist))))
(ert-deftest test-map-put-return-value ()