unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Michael <sp1ff@runbox.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: gazally@runbox.com, larsi@gnus.org, 51037@debbugs.gnu.org
Subject: bug#51037: [PATCH] Make `print-level` & `print-length` customizable in ERT batch tests
Date: Mon, 15 Nov 2021 15:11:54 -0800	[thread overview]
Message-ID: <864k8dm2th.fsf@runbox.com> (raw)
In-Reply-To: <83lf1qtxzw.fsf@gnu.org>


Eli Zaretskii <eliz@gnu.org> writes:

>> From: Michael <sp1ff@runbox.com>
>> Cc: larsi@gnus.org, gazally@runbox.com, 51037@debbugs.gnu.org
>> Date: Sun, 14 Nov 2021 07:42:27 -0800
>> 
>> This commit introduces three new ert variables:
>> ert-batch-print-length, ert-batch-print-level &
>> ert-batch-backtrace-length. The first two control print-length
>                             ^^
> Please leave 2 spaces between sentences, per our coding 
> conventions
> (here and elsewhere in your patch).

Fixed.

>> +line lengths (i.e. to get full backtraces), or a positive 
>> integer to
>
> Either "i.e.," (with a comma), or "i.e.@:".  Otherwise TeX will
> typeset "i.e." as if it ends a sentence.

Fixed.

>> +** New ERT batch variables
>> +
>> +Add three variables 'ert-batch-print-length', 
>> 'ert-batch-print-level'
>
> In NEWS we use a different style, like this:
>
>   Three new variables 'ert-batch-print-length', ...
>
> IOW, "Add" is not appropriate here.

Kindly fixed already by Lars.

>>  Backtrace mode will attempt to abbreviate printing of 
>>  backtrace
>> -frames to make them shorter than this, but success is not
>> -guaranteed.  If set to nil or zero, Backtrace mode will not
>> -abbreviate the forms it prints."
>> +frames by setting `print-level' & `print-length' to make them
>
> Please don't use "&" in doc strings; use "and" instead (here and
> elsewhere in the patch).

Fixed.

>> +shorter than this, but success is not guaranteed.  If set to 
>> nil
>> +or zero, Backtrace mode will not abbreviate the forms it 
>> prints."
>             ^^^^^^^^^
> "backtrace", not capitalized/

Oh! Good catch -- fixed.

>> -(defun ert--setup-results-buffer (stats listener buffer-name)
>> +(defvar ert--output-buffer-name "*ert*")
>> +
>> +(defun ert--setup-results-buffer (stats listener)
>>    "Set up a test results buffer.
>>  
>> -STATS is the stats object; LISTENER is the results listener;
>> -BUFFER-NAME, if non-nil, is the buffer name to use."
>> -  (unless buffer-name (setq buffer-name "*ert*"))
>> -  (let ((buffer (get-buffer-create buffer-name)))
>> +STATS is the stats object; LISTENER is the results listener."
>> +  (let ((buffer (get-buffer-create ert--output-buffer-name)))
>
> Why this change in the signature of the function?

A consequence of a decision discussed elsewhere in this thread:
the only reason that parameter existed was to enable unit
testing, which I re-wrote to use `cl-letf`.

Background: prior to this patch, `ert-run-tests-interactively`
accepted two optional parameters: output-buffer-name and
message-fn. The were soley used for the purpose of unit testing,
and were even documented in commentary as such:

;; Should OUTPUT-BUFFER-NAME and MESSAGE-FN really be arguments 
   here?
;; They are needed only for our automated self-tests at the 
   moment.
;; Or should there be some other mechanism?

I carried over the idiom to ert-run-tests-batch when adding my
own unit tests. Lars pointed out that I could use `cl-letf` to
override the function definition of `message`, rather than using
a "test-only" parameter. I did that, then removed the test-only
parameters from `ert-run-tests-interactively` an re-wrote those
unit tests to also use `cl-letf`. At that point, there was no one
using the the `buffer-name` parameter to
`ert--setup-results-buffer`. Since it's an internal function, I
felt comfortable just removing the parameter.

-- 
Michael <sp1ff@runbox.com>





  reply	other threads:[~2021-11-15 23:11 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-05 14:28 bug#51037: [PATCH] Make `print-level` & `print-length` customizable in ERT batch tests Michael
2021-10-06  9:30 ` Lars Ingebrigtsen
2021-10-06 12:52   ` Eli Zaretskii
2021-10-07  7:59     ` Lars Ingebrigtsen
2021-10-07  8:25       ` Eli Zaretskii
2021-10-07 19:03         ` Lars Ingebrigtsen
2021-10-12 13:52           ` Michael
2021-10-13 11:07             ` Lars Ingebrigtsen
2021-10-13 13:41               ` Michael
2021-10-13 14:06                 ` Lars Ingebrigtsen
2021-10-24 19:50                   ` Michael
2021-10-25 13:03                     ` Gemini Lasswell
2021-10-26 21:02                       ` Michael
2021-10-27 13:13                         ` Lars Ingebrigtsen
2021-10-25 13:05                     ` Lars Ingebrigtsen
2021-10-26 21:10                       ` Michael
2021-10-27 13:15                         ` Lars Ingebrigtsen
2021-11-14  2:55                           ` Michael
2021-11-14  7:05                             ` Eli Zaretskii
2021-11-14 15:42                               ` Michael
2021-11-14 18:04                                 ` Eli Zaretskii
2021-11-15 23:11                                   ` Michael [this message]
2021-11-14 14:39                             ` Lars Ingebrigtsen
2021-11-14 14:42                               ` Lars Ingebrigtsen
2021-11-14 17:45                                 ` Michael
2021-11-14 17:50                                   ` Lars Ingebrigtsen
2021-11-15 23:32                                 ` Michael
2021-11-16  7:48                                   ` Lars Ingebrigtsen
2021-11-17 16:22                                     ` Filipp Gunbin
2021-11-18  9:27                                       ` Lars Ingebrigtsen
2021-11-18 13:51                                         ` Filipp Gunbin
2021-11-19 15:24                                         ` Michael
2021-11-19 18:46                                           ` Filipp Gunbin
2021-11-20 16:49                                             ` Michael
2021-11-20 22:19                                               ` Filipp Gunbin
2021-11-22 14:07                                                 ` Michael
2021-11-22 17:29                                                   ` Filipp Gunbin
2021-11-24 16:29                                                     ` Michael
2021-11-24 19:53                                                       ` Filipp Gunbin
2021-11-29 16:16                                                         ` Michael
2021-10-07 21:04       ` Andy Moreton
2021-10-07 22:04         ` Lars Ingebrigtsen
2021-10-08 13:49           ` Andy Moreton
2021-10-08 15:24   ` Michael
2021-10-09 11:19     ` Lars Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=864k8dm2th.fsf@runbox.com \
    --to=sp1ff@runbox.com \
    --cc=51037@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=gazally@runbox.com \
    --cc=larsi@gnus.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).