diff options
Diffstat (limited to 'tests/test-pearl-adhoc.el')
| -rw-r--r-- | tests/test-pearl-adhoc.el | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/test-pearl-adhoc.el b/tests/test-pearl-adhoc.el index d8c7231..2bcc575 100644 --- a/tests/test-pearl-adhoc.el +++ b/tests/test-pearl-adhoc.el @@ -57,6 +57,22 @@ completing-read candidate list." (let ((wrapped (pearl--with-none '()))) (should (equal (list pearl--filter-none) wrapped)))) +(ert-deftest test-pearl-completion-table-keep-order-metadata-pins-identity () + "Action `metadata' returns an alist with `display-sort-function' bound to +`identity', the standard Emacs hook saying \"these are pre-sorted; don't re-sort.\"" + (let* ((tbl (pearl--completion-table-keep-order '("a" "b" "c"))) + (meta (funcall tbl "" nil 'metadata))) + (should (eq 'metadata (car meta))) + (should (eq #'identity (alist-get 'display-sort-function (cdr meta)))) + (should (eq #'identity (alist-get 'cycle-sort-function (cdr meta)))))) + +(ert-deftest test-pearl-completion-table-keep-order-delegates-all-completions () + "Non-metadata actions delegate to `complete-with-action' over the original +candidate list, so completion still works the way the framework expects." + (let ((tbl (pearl--completion-table-keep-order '("alpha" "beta" "gamma")))) + (should (equal '("alpha") (all-completions "a" tbl))) + (should (equal '("beta") (all-completions "b" tbl))))) + ;;; --assemble-filter (ert-deftest test-pearl-assemble-filter-only-set-keys () |
