GNU bug report logs - #27841
25.2; Patch for completion-table-with-predicate

Previous Next

Package: emacs;

Reported by: Ryan <rct <at> thompsonclan.org>

Date: Wed, 26 Jul 2017 18:38:02 UTC

Severity: normal

Tags: fixed, patch

Found in version 25.2

Fixed in version 26.1

Done: Noam Postavsky <npostavs <at> users.sourceforge.net>

Bug is archived. No further changes may be made.

Full log


Message #25 received at 27841 <at> debbugs.gnu.org (full text, mbox):

From: npostavs <at> users.sourceforge.net
To: Ryan Thompson <rct <at> thompsonclan.org>
Cc: 27841 <at> debbugs.gnu.org, Dmitry Gutov <dgutov <at> yandex.ru>
Subject: Re: bug#27841: 25.2; Patch for completion-table-with-predicate
Date: Mon, 07 Aug 2017 21:27:31 -0400
Ryan Thompson <rct <at> thompsonclan.org> writes:

> 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".

Sounds like that a useful addition to me.

> 	* ../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.

I wonder how you ended up with the ../ prefix on the filenames?

> +(ert-deftest completion-table-with-predicate-test ()
> +  (cl-letf* ((full-collection
> +              '("apple"                  ; Has A
> +                "beet"                   ; Has B
> +                "banana"                 ; Has A & B
> +                "cherry"                 ; Has neither
> +                ))
> +             ((symbol-function 'no-A)
> +              (lambda (x) (not (string-match-p "a" x))))
> +             ((symbol-function 'no-B)
> +              (lambda (x) (not (string-match-p "b" x)))))

It looks to me like things would be simpler with a let instead of
cl-letf, no?




This bug report was last modified 7 years and 201 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.