]> git.eshelyaron.com Git - emacs.git/commitdiff
Make minibuf-tests independent of obarray hash order
authorMattias EngdegÄrd <mattiase@acm.org>
Thu, 8 Feb 2024 18:04:23 +0000 (19:04 +0100)
committerEshel Yaron <me@eshelyaron.com>
Tue, 13 Feb 2024 13:10:25 +0000 (14:10 +0100)
* test/src/minibuf-tests.el (minibuf-tests--set-equal): New.
(minibuf-tests--all-completions)
(minibuf-tests--all-completions-pred)
(minibuf-tests--all-completions-regexp): Use it.

(cherry picked from commit bb77944306d3fbbbdf61ba4f3c9ef1bcb9b4b989)

test/src/minibuf-tests.el

index 14d160df25cea3610f6841f0334e3a704ee48cd3..cb305ca0e55196adbd2c39a4044bac1af36e1aa6 100644 (file)
@@ -61,6 +61,9 @@
 \f
 ;;; Testing functions that are agnostic to type of COLLECTION.
 
+(defun minibuf-tests--set-equal (a b)
+  (null (cl-set-exclusive-or a b :test #'equal)))
+
 (defun minibuf-tests--try-completion (xform-collection)
   (let* ((abcdef (funcall xform-collection '("abc" "def")))
          (+abba  (funcall xform-collection '("abc" "abba" "def"))))
   (let* ((abcdef (funcall xform-collection '("abc" "def")))
          (+abba  (funcall xform-collection '("abc" "abba" "def"))))
     (should (equal (all-completions "a" abcdef) '("abc")))
-    (should (equal (all-completions "a" +abba) '("abc" "abba")))
+    (should (minibuf-tests--set-equal (all-completions "a" +abba)
+                                      '("abc" "abba")))
     (should (equal (all-completions "abc" +abba) '("abc")))
     (should (equal (all-completions "abcd" +abba) nil))))
 
          (+abba  (funcall xform-collection '("abc" "abba" "def")))
          (+abba-member (funcall collection-member +abba)))
     (should (equal (all-completions "a" abcdef abcdef-member) '("abc")))
-    (should (equal (all-completions "a" +abba +abba-member) '("abc" "abba")))
+    (should (minibuf-tests--set-equal (all-completions "a" +abba +abba-member)
+                                      '("abc" "abba")))
     (should (equal (all-completions "abc" +abba +abba-member) '("abc")))
     (should (equal (all-completions "abcd" +abba +abba-member) nil))
     (should-not (all-completions "a" abcdef #'ignore))
         (+abba  (funcall xform-collection '("abc" "abba" "def"))))
     (let ((completion-regexp-list '(".")))
       (should (equal (all-completions "a" abcdef) '("abc")))
-      (should (equal (all-completions "a" +abba) '("abc" "abba")))
+      (should (minibuf-tests--set-equal (all-completions "a" +abba)
+                                        '("abc" "abba")))
       (should (equal (all-completions "abc" +abba) '("abc")))
       (should (equal (all-completions "abcd" +abba) nil)))
     (let ((completion-regexp-list '("X")))