Subject: Re: bug#51037: [PATCH] Make `print-level` & `print-length` customizable in ERT batch tests

From: Filipp Gunbin <[email-masked]>
Date: Thu, 18 Nov 2021 16:51:35 +0300

On 18/11/2021 10:27 +0100, Lars Ingebrigtsen wrote:

> Filipp Gunbin <[email-masked]> writes:
>
>> The docstring for backtrace-line-length says: "If set to nil or zero,
>> backtrace mode will not abbreviate the forms it prints."  So the above
>> sentence, which I removed, was indeed not true?  (a quick look over
>> its usages confirmed that to me, but I'd like someone else to check)
>
> I think the intention is that a nil value of backtrace-line-length
> shouldn't limit the lengths -- but I haven't tested it.  Doesn't it
> work?

ert-batch-print-length/level are 10 by default, and print-length/level
are let-bound to them during ert batch runs.  With these values, the
backtraces should be limited, if backtrace-line-length says so.

Then we go:

emacs --batch -l ert \
  --eval "
(setq ert-batch-backtrace-right-margin nil
      backtrace-line-length 50
      ert-batch-backtrace-line-length t)
" \
  --eval '(ert-deftest my-test () (error "test error"))' \
  -f ert-run-tests-batch-and-exit

The output is limited.

Try the same with ert-batch-backtrace-line-length nil in --eval, and the
output is not limited at all.  So none of (ert-batch-)print-level/length
get into play.

So I think I'll install my patch now..

Filipp