diff options
| author | Mattias EngdegÄrd | 2024-02-08 19:04:23 +0100 |
|---|---|---|
| committer | Mattias EngdegÄrd | 2024-02-12 18:23:33 +0100 |
| commit | bb77944306d3fbbbdf61ba4f3c9ef1bcb9b4b989 (patch) | |
| tree | dac9b761bfbeaa9cd6b884081e398f1f3d326bdb /test | |
| parent | 79cfc1eaa0b93f49559d74b6f7a76bf97e70ad2a (diff) | |
| download | emacs-bb77944306d3fbbbdf61ba4f3c9ef1bcb9b4b989.tar.gz emacs-bb77944306d3fbbbdf61ba4f3c9ef1bcb9b4b989.zip | |
Make minibuf-tests independent of obarray hash order
* 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.
Diffstat (limited to 'test')
| -rw-r--r-- | test/src/minibuf-tests.el | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/test/src/minibuf-tests.el b/test/src/minibuf-tests.el index 14d160df25c..cb305ca0e55 100644 --- a/test/src/minibuf-tests.el +++ b/test/src/minibuf-tests.el | |||
| @@ -61,6 +61,9 @@ | |||
| 61 | 61 | ||
| 62 | ;;; Testing functions that are agnostic to type of COLLECTION. | 62 | ;;; Testing functions that are agnostic to type of COLLECTION. |
| 63 | 63 | ||
| 64 | (defun minibuf-tests--set-equal (a b) | ||
| 65 | (null (cl-set-exclusive-or a b :test #'equal))) | ||
| 66 | |||
| 64 | (defun minibuf-tests--try-completion (xform-collection) | 67 | (defun minibuf-tests--try-completion (xform-collection) |
| 65 | (let* ((abcdef (funcall xform-collection '("abc" "def"))) | 68 | (let* ((abcdef (funcall xform-collection '("abc" "def"))) |
| 66 | (+abba (funcall xform-collection '("abc" "abba" "def")))) | 69 | (+abba (funcall xform-collection '("abc" "abba" "def")))) |
| @@ -101,7 +104,8 @@ | |||
| 101 | (let* ((abcdef (funcall xform-collection '("abc" "def"))) | 104 | (let* ((abcdef (funcall xform-collection '("abc" "def"))) |
| 102 | (+abba (funcall xform-collection '("abc" "abba" "def")))) | 105 | (+abba (funcall xform-collection '("abc" "abba" "def")))) |
| 103 | (should (equal (all-completions "a" abcdef) '("abc"))) | 106 | (should (equal (all-completions "a" abcdef) '("abc"))) |
| 104 | (should (equal (all-completions "a" +abba) '("abc" "abba"))) | 107 | (should (minibuf-tests--set-equal (all-completions "a" +abba) |
| 108 | '("abc" "abba"))) | ||
| 105 | (should (equal (all-completions "abc" +abba) '("abc"))) | 109 | (should (equal (all-completions "abc" +abba) '("abc"))) |
| 106 | (should (equal (all-completions "abcd" +abba) nil)))) | 110 | (should (equal (all-completions "abcd" +abba) nil)))) |
| 107 | 111 | ||
| @@ -111,7 +115,8 @@ | |||
| 111 | (+abba (funcall xform-collection '("abc" "abba" "def"))) | 115 | (+abba (funcall xform-collection '("abc" "abba" "def"))) |
| 112 | (+abba-member (funcall collection-member +abba))) | 116 | (+abba-member (funcall collection-member +abba))) |
| 113 | (should (equal (all-completions "a" abcdef abcdef-member) '("abc"))) | 117 | (should (equal (all-completions "a" abcdef abcdef-member) '("abc"))) |
| 114 | (should (equal (all-completions "a" +abba +abba-member) '("abc" "abba"))) | 118 | (should (minibuf-tests--set-equal (all-completions "a" +abba +abba-member) |
| 119 | '("abc" "abba"))) | ||
| 115 | (should (equal (all-completions "abc" +abba +abba-member) '("abc"))) | 120 | (should (equal (all-completions "abc" +abba +abba-member) '("abc"))) |
| 116 | (should (equal (all-completions "abcd" +abba +abba-member) nil)) | 121 | (should (equal (all-completions "abcd" +abba +abba-member) nil)) |
| 117 | (should-not (all-completions "a" abcdef #'ignore)) | 122 | (should-not (all-completions "a" abcdef #'ignore)) |
| @@ -124,7 +129,8 @@ | |||
| 124 | (+abba (funcall xform-collection '("abc" "abba" "def")))) | 129 | (+abba (funcall xform-collection '("abc" "abba" "def")))) |
| 125 | (let ((completion-regexp-list '("."))) | 130 | (let ((completion-regexp-list '("."))) |
| 126 | (should (equal (all-completions "a" abcdef) '("abc"))) | 131 | (should (equal (all-completions "a" abcdef) '("abc"))) |
| 127 | (should (equal (all-completions "a" +abba) '("abc" "abba"))) | 132 | (should (minibuf-tests--set-equal (all-completions "a" +abba) |
| 133 | '("abc" "abba"))) | ||
| 128 | (should (equal (all-completions "abc" +abba) '("abc"))) | 134 | (should (equal (all-completions "abc" +abba) '("abc"))) |
| 129 | (should (equal (all-completions "abcd" +abba) nil))) | 135 | (should (equal (all-completions "abcd" +abba) nil))) |
| 130 | (let ((completion-regexp-list '("X"))) | 136 | (let ((completion-regexp-list '("X"))) |