aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorNoam Postavsky2017-08-04 17:55:50 -0400
committerNoam Postavsky2017-08-04 18:22:06 -0400
commit3a0f2dfa79611d5f3789a1127603d3798e83b9f8 (patch)
tree47ef1b913b0c6cd23572d48bc0acb233430c8eab /test
parent4b7f822cd53a50e83008ab4f561563d8977a74ec (diff)
downloademacs-3a0f2dfa79611d5f3789a1127603d3798e83b9f8.tar.gz
emacs-3a0f2dfa79611d5f3789a1127603d3798e83b9f8.zip
; 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')
-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.
64 (should (= 5 (map-elt map 7 5))))) 64 (should (= 5 (map-elt map 7 5)))))
65 65
66(ert-deftest test-map-elt-testfn () 66(ert-deftest test-map-elt-testfn ()
67 (let ((map (list (cons "a" 1) (cons "b" 2)))) 67 (let ((map (list (cons "a" 1) (cons "b" 2)))
68 (should-not (map-elt map "a")) 68 ;; Make sure to use a non-eq "a", even when compiled.
69 (should (map-elt map "a" nil 'equal)))) 69 (noneq-key (string ?a)))
70 (should-not (map-elt map noneq-key))
71 (should (map-elt map noneq-key nil 'equal))))
70 72
71(ert-deftest test-map-elt-with-nil-value () 73(ert-deftest test-map-elt-with-nil-value ()
72 (should (null (map-elt '((a . 1) 74 (should (null (map-elt '((a . 1)
@@ -100,10 +102,12 @@ Evaluate BODY for each created map.
100 'b)))) 102 'b))))
101 103
102(ert-deftest test-map-put-testfn-alist () 104(ert-deftest test-map-put-testfn-alist ()
103 (let ((alist (list (cons "a" 1) (cons "b" 2)))) 105 (let ((alist (list (cons "a" 1) (cons "b" 2)))
104 (map-put alist "a" 3 'equal) 106 ;; Make sure to use a non-eq "a", even when compiled.
107 (noneq-key (string ?a)))
108 (map-put alist noneq-key 3 'equal)
105 (should-not (cddr alist)) 109 (should-not (cddr alist))
106 (map-put alist "a" 9) 110 (map-put alist noneq-key 9)
107 (should (cddr alist)))) 111 (should (cddr alist))))
108 112
109(ert-deftest test-map-put-return-value () 113(ert-deftest test-map-put-return-value ()