bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: npostavs
Subject: bug#27841: 25.2; Patch for completion-table-with-predicate
Date: Mon, 07 Aug 2017 21:27:31 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2.50 (gnu/linux)

Ryan Thompson <rct@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?





reply via email to

[Prev in Thread] Current Thread [Next in Thread]