(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)
'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 ()