aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorRyan C. Thompson2017-07-26 11:09:42 -0700
committerNoam Postavsky2017-11-07 21:25:55 -0500
commit255ba01148f69f452937e67feb7af5d4c1466fed (patch)
treec89e0c1430d085a30222dcc758165c4ce6e66225 /test
parent949b70a7d80c79b2593a7d88f6543e29dc63ed18 (diff)
downloademacs-255ba01148f69f452937e67feb7af5d4c1466fed.tar.gz
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')
-rw-r--r--test/lisp/minibuffer-tests.el32
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 @@
42 (should (equal (buffer-string) 42 (should (equal (buffer-string)
43 "test: ")))))) 43 "test: "))))))
44 44
45(ert-deftest completion-table-with-predicate-test ()
46 (let ((full-collection
47 '("apple" ; Has A.
48 "beet" ; Has B.
49 "banana" ; Has A & B.
50 "cherry" ; Has neither.
51 ))
52 (no-A (lambda (x) (not (string-match-p "a" x))))
53 (no-B (lambda (x) (not (string-match-p "b" x)))))
54 (should
55 (member "cherry"
56 (completion-table-with-predicate
57 full-collection no-A t "" no-B t)))
58 (should-not
59 (member "banana"
60 (completion-table-with-predicate
61 full-collection no-A t "" no-B t)))
62 ;; "apple" should still match when strict is nil.
63 (should (eq t (try-completion
64 "apple"
65 (apply-partially
66 'completion-table-with-predicate
67 full-collection no-A nil)
68 no-B)))
69 ;; "apple" should still match when strict is nil and pred2 is nil
70 ;; (Bug#27841).
71 (should (eq t (try-completion
72 "apple"
73 (apply-partially
74 'completion-table-with-predicate
75 full-collection no-A nil))))))
76
45(provide 'completion-tests) 77(provide 'completion-tests)
46;;; completion-tests.el ends here 78;;; completion-tests.el ends here