branch: elpa/extmap
commit 83010736da3df54c554acd99f8db69a7ae5ccef0
Author: Paul Pogonyshev <pogonys...@gmail.com>
Commit: Paul Pogonyshev <pogonys...@gmail.com>

    Fix a bug in `extmap--equal-including-properties': comparing certain 
unequal hash-tables would see no difference between them.
---
 extmap.el           | 2 +-
 test/extmap-test.el | 8 ++++++++
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/extmap.el b/extmap.el
index e2ec6c25de..7c88057ea1 100644
--- a/extmap.el
+++ b/extmap.el
@@ -537,7 +537,7 @@ Only available on Emacs 25, as this requires `generator' 
package."
               (= (hash-table-count a) (hash-table-count b))
               (catch 'equal
                 (maphash (lambda (key value)
-                           (unless (extmap--equal-including-properties value 
(gethash key b (not a)))
+                           (unless (extmap--equal-including-properties value 
(gethash key b (not value)))
                              (throw 'equal nil)))
                          a)
                 t)))
diff --git a/test/extmap-test.el b/test/extmap-test.el
index 872cc1b507..6547eb44a4 100644
--- a/test/extmap-test.el
+++ b/test/extmap-test.el
@@ -183,6 +183,14 @@
   (should (extmap--equal-including-properties "foo" "foo"))
   (should (extmap--equal-including-properties (propertize "foo" 'face (list 
'bold 'italic)) (propertize "foo" 'face (list 'bold 'italic)))))
 
+(ert-deftest extmap-internal-equal-regression-1 ()
+  ;; Real bug spotted theoretically.
+  (let ((a (make-hash-table))
+        (b (make-hash-table)))
+    (puthash 'x nil a)
+    (puthash 'y 1   b)
+    (should-not (extmap--equal-including-properties a b))))
+
 (ert-deftest extmap-internal-compress-value ()
   (extmap--test-compress-value '(nothing to compress here))
   (let ((compressed (extmap--test-compress-value '((1 2 3) (4 5 6) (1 2 3)))))

Reply via email to