Subject: bug#27841: 25.2; Patch for completion-table-with-predicate

From: Ryan Thompson <[email-masked]>
Date: Sat, 05 Aug 2017 06:22:39 +0000

Ok, here is the revised patch. I added a test and reformatted the commit
message in (hopefully) ChangeLog format. The test includes a few basic
tests of "completion-table-with-predicate" including one which is fixed by
this patch (noted in the test comments).

I've dropped the second patch entirely, because I realized it was
inappropriately optimizing for a rare case (i.e. PRED1 being nil).

Also, a few other related things: First, I noticed that while the test file
name is minibuffer-tests.el, the lisp header and provide statement both
contain "completion-tests.el" instead. Presumably this file was renamed at
some point without updating its contents.

Second, I notice that there is not much in this file, in particular nothing
testing interactive completion in the minibuffer. I recently wrote a
package for simulating interactive input to a command in order to implement
tests for my ido-comrpleting-read+ package, and it might be useful for
adding more tests here. You can view it here:
https://github.com/DarwinAwardWinner/with-simulated-input and view example
usage in the ido-cr+ test suite here:
https://github.com/DarwinAwardWinner/ido-completing-read-plus/blob/master/tests/test-ido-completing-read%2B.el

Let me know if there is interest in using such an approach to add automated
tests for some of the core interactive Emacs functions like
"completing-read".

On Fri, Aug 4, 2017 at 4:11 PM Dmitry Gutov <[email-masked]> wrote:

> On 8/5/17 2:00 AM, Ryan Thompson wrote:
> > Would you also like me
> > to provide an example where the old code does the wrong thing?
>
> Adding a test case or two to test/lisp/minibuffer-tests.el would be
> ideal (in the same patch that fixes it).
>