emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 3a0f2df: ; Fix map-tests when compiled


From: Noam Postavsky
Subject: [Emacs-diffs] master 3a0f2df: ; Fix map-tests when compiled
Date: Fri, 4 Aug 2017 18:24:42 -0400 (EDT)

branch: master
commit 3a0f2dfa79611d5f3789a1127603d3798e83b9f8
Author: Noam Postavsky <address@hidden>
Commit: Noam Postavsky <address@hidden>

    ; 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 15b0655..fc0a6a5 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 ()



reply via email to

[Prev in Thread] Current Thread [Next in Thread]