GNU bug report logs - #51037
[PATCH] Make `print-level` & `print-length` customizable in ERT batch tests

Previous Next

Package: emacs;

Reported by: Michael <sp1ff <at> runbox.com>

Date: Tue, 5 Oct 2021 14:51:02 UTC

Severity: wishlist

Tags: patch

Fixed in version 29.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Michael <sp1ff <at> runbox.com>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 51037 <at> debbugs.gnu.org
Subject: bug#51037: [PATCH] Make `print-level` & `print-length` customizable in ERT batch tests
Date: Fri, 08 Oct 2021 08:24:42 -0700
Lars Ingebrigtsen <larsi <at> gnus.org> writes:

> Michael <sp1ff <at> runbox.com> writes:
>
>> When running ERT tests in batch mode, the conservative values
>> chosen for `print-level` and `print-length` sometimes make it
>> difficult to see what exactly is wrong.  This patch introduces
>> two new variables (`ert-batch-print-level` &
>> `ert-batch-print-length`) that one can use to customize them;
>> e.g.
>>
>>    emacs -batch -l ert -l my-tests.el \
>>          --eval "(let ((ert-batch-print-level 10) \
>>                        (ert-batch-print-length 120)) \
>>                    (ert-run-tests-batch-and-exit))"
>
> Sounds like a good idea.
>
>> +MESSAGE-FN should normally be nil; it is used for automated
>> +self-tests and specify how to display messages."
>
> I don't understand this bit, though.  If you want to test how 
> this
> function outputs messages, you can just `cl-letf' like this:
>
> (cl-letf (((symbol-function 'message) ...

Good point. I simply carried the strategy over from that used to
unit test `ert-run-tests-interactively`. TBH I was unaware of
`cl-letf`, and there *is* this comment above
`ert-run-tests-interactively`:

   ;; 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?

Perhaps I should change *both* to just use `cl-letf`?

-- 
Michael <sp1ff <at> runbox.com>




This bug report was last modified 3 years and 171 days ago.

Previous Next


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