Add a couple of minibuffer completion tests
authorEshel Yaron <me@eshelyaron.com>
Wed, 29 May 2024 09:49:15 +0000 (11:49 +0200)
committerEshel Yaron <me@eshelyaron.com>
Wed, 29 May 2024 09:54:54 +0000 (11:54 +0200)
Add tests for regressions that followed commit ff3f17ca3cd.

See discussion here:
https://lists.gnu.org/archive/html/emacs-devel/2024-05/msg00701.html

* test/lisp/minibuffer-tests.el (completion-cycle)
(minibuffer-next-completion): New tests.

test/lisp/minibuffer-tests.el

index c4a7de9e51f7bb337b0b5c50c5d5f3887eb2aac0..df36bce4634de73120b09c88f97501be44d81e9d 100644 (file)
       (previous-line-completion 7)
       (should (equal "aa1" (get-text-property (point) 'completion--string))))))
 
+(ert-deftest completion-cycle ()
+  (completing-read-with-minibuffer-setup '("aaa" "bbb" "ccc")
+    (let ((completion-cycle-threshold t))
+      (execute-kbd-macro (kbd "TAB TAB TAB"))
+      (should (equal (minibuffer-contents) "ccc")))))
+
+(ert-deftest minibuffer-next-completion ()
+  (let ((default-directory (ert-resource-directory)))
+    (completing-read-with-minibuffer-setup #'read-file-name-internal
+      (insert "d/")
+      (execute-kbd-macro (kbd "M-<down> M-<down> M-<down>"))
+      (should (equal "data/minibuffer-test-cttq$$tion" (minibuffer-contents))))))
+
 (provide 'minibuffer-tests)
 ;;; minibuffer-tests.el ends here