diff options
author | Ryan C. Thompson <rct@thompsonclan.org> | 2017-07-26 11:09:42 -0700 |
---|---|---|
committer | Noam Postavsky <npostavs@gmail.com> | 2017-11-07 21:25:55 -0500 |
commit | 255ba01148f69f452937e67feb7af5d4c1466fed (patch) | |
tree | c89e0c1430d085a30222dcc758165c4ce6e66225 /test/lisp/minibuffer-tests.el | |
parent | 949b70a7d80c79b2593a7d88f6543e29dc63ed18 (diff) | |
download | emacs-255ba01148f69f452937e67feb7af5d4c1466fed.tar.gz emacs-255ba01148f69f452937e67feb7af5d4c1466fed.tar.bz2 emacs-255ba01148f69f452937e67feb7af5d4c1466fed.zip |
Fix handling of nil PRED2 arg for completion-table-with-predicate
* lisp/minibuffer.el (completion-table-with-predicate): Don't act as
if strict is non-nil when pred2 is nil (Bug#27841).
* test/lisp/minibuffer-tests.el
(completion-table-with-predicate-test): Add a test for Bug#27841.
Diffstat (limited to 'test/lisp/minibuffer-tests.el')
-rw-r--r-- | test/lisp/minibuffer-tests.el | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/test/lisp/minibuffer-tests.el b/test/lisp/minibuffer-tests.el index c27b338f7f3..2d2ac85e3ff 100644 --- a/test/lisp/minibuffer-tests.el +++ b/test/lisp/minibuffer-tests.el @@ -42,5 +42,37 @@ (should (equal (buffer-string) "test: ")))))) +(ert-deftest completion-table-with-predicate-test () + (let ((full-collection + '("apple" ; Has A. + "beet" ; Has B. + "banana" ; Has A & B. + "cherry" ; Has neither. + )) + (no-A (lambda (x) (not (string-match-p "a" x)))) + (no-B (lambda (x) (not (string-match-p "b" x))))) + (should + (member "cherry" + (completion-table-with-predicate + full-collection no-A t "" no-B t))) + (should-not + (member "banana" + (completion-table-with-predicate + full-collection no-A t "" no-B t))) + ;; "apple" should still match when strict is nil. + (should (eq t (try-completion + "apple" + (apply-partially + 'completion-table-with-predicate + full-collection no-A nil) + no-B))) + ;; "apple" should still match when strict is nil and pred2 is nil + ;; (Bug#27841). + (should (eq t (try-completion + "apple" + (apply-partially + 'completion-table-with-predicate + full-collection no-A nil)))))) + (provide 'completion-tests) ;;; completion-tests.el ends here |