From 3a0f2dfa79611d5f3789a1127603d3798e83b9f8 Mon Sep 17 00:00:00 2001 From: Noam Postavsky Date: Fri, 4 Aug 2017 17:55:50 -0400 Subject: [PATCH] ; 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. --- test/lisp/emacs-lisp/map-tests.el | 16 ++++++++++------ 1 file 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 () -- 2.39.2