unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#16854: 24.3.50; ert-run-tests-interactively t selector not working
@ 2014-02-23 14:57 Helmut Eller
  2014-02-23 17:21 ` Dmitry Gutov
  0 siblings, 1 reply; 9+ messages in thread
From: Helmut Eller @ 2014-02-23 14:57 UTC (permalink / raw)
  To: 16854

When I run this 

(require 'ert)
(ert-deftest infloop0 () (while t))

with: emacs -Q -nw -l infloops.el -f ert

Emacs starts up and asks: "Run tests (default t): "
If I enter: "t RET"
then ERT does not run anything and simply writes:
"Ran 0 tests, 0 results were as expected"

The expected result is that all tests should be executed.





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#16854: 24.3.50; ert-run-tests-interactively t selector not working
  2014-02-23 14:57 bug#16854: 24.3.50; ert-run-tests-interactively t selector not working Helmut Eller
@ 2014-02-23 17:21 ` Dmitry Gutov
  2014-02-23 18:16   ` Helmut Eller
  0 siblings, 1 reply; 9+ messages in thread
From: Dmitry Gutov @ 2014-02-23 17:21 UTC (permalink / raw)
  To: Helmut Eller; +Cc: 16854

Helmut Eller <eller.helmut@gmail.com> writes:

> When I run this
>
> (require 'ert)
> (ert-deftest infloop0 () (while t))
>
> with: emacs -Q -nw -l infloops.el -f ert
>
> Emacs starts up and asks: "Run tests (default t): "
> If I enter: "t RET"
> then ERT does not run anything and simply writes:
> "Ran 0 tests, 0 results were as expected"
>
> The expected result is that all tests should be executed.

Same here. Apparently, this is fallout from 114803 (bug#9756).

The code before it used `read-from-minibuffer' with t READ argument, so
"t" was converted to `t'. But now `ert-select-tests' receives SELECTOR
as "t".

The patch below fixes it for me.


=== modified file 'lisp/emacs-lisp/ert.el'
--- lisp/emacs-lisp/ert.el	2014-02-04 17:37:08 +0000
+++ lisp/emacs-lisp/ert.el	2014-02-23 17:16:26 +0000
@@ -1882,11 +1882,12 @@
                             ;; defined without cl.
                             (car ert--selector-history)
                           "t")))
-           (completing-read (if (null default)
-				"Run tests: "
-			      (format "Run tests (default %s): " default))
-			    obarray #'ert-test-boundp nil nil
-			    'ert--selector-history default nil))
+           (intern
+            (completing-read (if (null default)
+                                 "Run tests: "
+                               (format "Run tests (default %s): " default))
+                             obarray #'ert-test-boundp nil nil
+                             'ert--selector-history default nil)))
          nil))
   (unless message-fn (setq message-fn 'message))
   (let ((output-buffer-name output-buffer-name)





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#16854: 24.3.50; ert-run-tests-interactively t selector not working
  2014-02-23 17:21 ` Dmitry Gutov
@ 2014-02-23 18:16   ` Helmut Eller
  2014-02-23 21:16     ` Dmitry Gutov
  0 siblings, 1 reply; 9+ messages in thread
From: Helmut Eller @ 2014-02-23 18:16 UTC (permalink / raw)
  To: 16854

On Sun, Feb 23 2014, Dmitry Gutov wrote:

> Helmut Eller <eller.helmut@gmail.com> writes:
>
>> When I run this
>>
>> (require 'ert)
>> (ert-deftest infloop0 () (while t))
>>
>> with: emacs -Q -nw -l infloops.el -f ert
>>
>> Emacs starts up and asks: "Run tests (default t): "
>> If I enter: "t RET"
>> then ERT does not run anything and simply writes:
>> "Ran 0 tests, 0 results were as expected"
>>
>> The expected result is that all tests should be executed.
>
> Same here. Apparently, this is fallout from 114803 (bug#9756).
>
> The code before it used `read-from-minibuffer' with t READ argument, so
> "t" was converted to `t'. But now `ert-select-tests' receives SELECTOR
> as "t".
>
> The patch below fixes it for me.

Yes, with the patch t works.  But it's no longer possible to enter
regexps.  Not sure if that matters.  Maybe the default should be the
regexp ".*" instead of t.  Hmm, that would look odd.

Helmut






^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#16854: 24.3.50; ert-run-tests-interactively t selector not working
  2014-02-23 18:16   ` Helmut Eller
@ 2014-02-23 21:16     ` Dmitry Gutov
  2014-02-24  6:35       ` Helmut Eller
  0 siblings, 1 reply; 9+ messages in thread
From: Dmitry Gutov @ 2014-02-23 21:16 UTC (permalink / raw)
  To: Helmut Eller; +Cc: 16854

Helmut Eller <eller.helmut@gmail.com> writes:

> Yes, with the patch t works.  But it's no longer possible to enter
> regexps.  Not sure if that matters.

It probably does: `ert-select-tests' describes regexps among possible
selector values. Maybe we should only convert "t" to t, and keep other
values intact.

> Maybe the default should be the
> regexp ".*" instead of t.  Hmm, that would look odd.

I dunno, looks okay to me. I was thinking of using an empty string as
the default, but it probably wouldn't look good in the "Run tests:"
prompt.





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#16854: 24.3.50; ert-run-tests-interactively t selector not working
  2014-02-23 21:16     ` Dmitry Gutov
@ 2014-02-24  6:35       ` Helmut Eller
  2014-02-24  6:58         ` Nicolas Richard
  2014-02-24 17:51         ` Dmitry Gutov
  0 siblings, 2 replies; 9+ messages in thread
From: Helmut Eller @ 2014-02-24  6:35 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: 16854

On Sun, Feb 23 2014, Dmitry Gutov wrote:

> Helmut Eller <eller.helmut@gmail.com> writes:
>
>> Yes, with the patch t works.  But it's no longer possible to enter
>> regexps.  Not sure if that matters.
>
> It probably does: `ert-select-tests' describes regexps among possible
> selector values. Maybe we should only convert "t" to t, and keep other
> values intact.

I think now that using read instead of intern should work fine: normal
test names can be entered with tab completion support and regexps by
inserting quotes as needed.  The only remaining annoyance is that spaces
must be inserted with C-q SPC.

Helmut





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#16854: 24.3.50; ert-run-tests-interactively t selector not working
  2014-02-24  6:35       ` Helmut Eller
@ 2014-02-24  6:58         ` Nicolas Richard
  2014-02-24 14:00           ` Helmut Eller
  2014-02-24 17:51         ` Dmitry Gutov
  1 sibling, 1 reply; 9+ messages in thread
From: Nicolas Richard @ 2014-02-24  6:58 UTC (permalink / raw)
  To: Helmut Eller; +Cc: 16854, Dmitry Gutov

Helmut Eller <eller.helmut@gmail.com> writes:
> I think now that using read instead of intern should work fine: normal
> test names can be entered with tab completion support and regexps by
> inserting quotes as needed.  The only remaining annoyance is that spaces
> must be inserted with C-q SPC.

Quoting regexps in a minibuffer prompt is somewhat unusual, in
particular wrt backslashes.

-- 
Nico.





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#16854: 24.3.50; ert-run-tests-interactively t selector not working
  2014-02-24  6:58         ` Nicolas Richard
@ 2014-02-24 14:00           ` Helmut Eller
  2014-02-26  2:05             ` Dmitry Gutov
  0 siblings, 1 reply; 9+ messages in thread
From: Helmut Eller @ 2014-02-24 14:00 UTC (permalink / raw)
  To: Nicolas Richard; +Cc: 16854, Dmitry Gutov

On Mon, Feb 24 2014, Nicolas Richard wrote:

> Helmut Eller <eller.helmut@gmail.com> writes:
>> I think now that using read instead of intern should work fine: normal
>> test names can be entered with tab completion support and regexps by
>> inserting quotes as needed.  The only remaining annoyance is that spaces
>> must be inserted with C-q SPC.
>
> Quoting regexps in a minibuffer prompt is somewhat unusual, in
> particular wrt backslashes.

The M-x ert command wants an s-expression as argument and that's not
unusual, e.g. M-: also takes sexps.  The syntax is just the same as for
regular Lisp code.  What is unusual about M-x ert is that candidates for
symbol completion aren't names of functions but names of tests.

Helmut





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#16854: 24.3.50; ert-run-tests-interactively t selector not working
  2014-02-24  6:35       ` Helmut Eller
  2014-02-24  6:58         ` Nicolas Richard
@ 2014-02-24 17:51         ` Dmitry Gutov
  1 sibling, 0 replies; 9+ messages in thread
From: Dmitry Gutov @ 2014-02-24 17:51 UTC (permalink / raw)
  To: Helmut Eller; +Cc: 16854

On 24.02.2014 08:35, Helmut Eller wrote:
> I think now that using read instead of intern should work fine: normal
> test names can be entered with tab completion support and regexps by
> inserting quotes as needed.

I think so too. At least, that's how it worked before.

`read-from-minibuffer' docstring describes the READ argument to work as 
(car (read-from-string INPUT-STRING)), but I don't see how it's better 
than plain `read'.

> The only remaining annoyance is that spaces
> must be inserted with C-q SPC.

Yeah, that's a separate problem. Personally, I don't use SPC for 
completion anywhere, so that binding is harmful for me in any kind of 
completing-read, not just here.





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#16854: 24.3.50; ert-run-tests-interactively t selector not working
  2014-02-24 14:00           ` Helmut Eller
@ 2014-02-26  2:05             ` Dmitry Gutov
  0 siblings, 0 replies; 9+ messages in thread
From: Dmitry Gutov @ 2014-02-26  2:05 UTC (permalink / raw)
  To: Helmut Eller, Nicolas Richard; +Cc: 16854-done

Version: 24.4

On 24.02.2014 16:00, Helmut Eller wrote:
>>> I think now that using read instead of intern should work fine

Installed in revno 116563.





^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2014-02-26  2:05 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-23 14:57 bug#16854: 24.3.50; ert-run-tests-interactively t selector not working Helmut Eller
2014-02-23 17:21 ` Dmitry Gutov
2014-02-23 18:16   ` Helmut Eller
2014-02-23 21:16     ` Dmitry Gutov
2014-02-24  6:35       ` Helmut Eller
2014-02-24  6:58         ` Nicolas Richard
2014-02-24 14:00           ` Helmut Eller
2014-02-26  2:05             ` Dmitry Gutov
2014-02-24 17:51         ` Dmitry Gutov

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).