develooper Front page | perl.perl5.porters | Postings from October 2010

Re: Test counts

Thread Previous | Thread Next
Father Chrysostomos
October 12, 2010 09:49
Re: Test counts
Message ID:

On Oct 3, 2010, at 11:09 PM, Florian Ragwitz wrote:

> Jesse Vincent <> writes:
>> On Sun  5.Sep'10 at 14:27:17 -0700, Father Chrysostomos wrote:
>>> Currently, if a patch adjusts a test count, it’s very likely going to
>>> conflict with any other patch modifying the same test file.
>>> There’s a test-counting technique I came up with, which I think I
>>> first used in CSS::DOM. It is to put an entry in %INC and create a
>>> tests::VERSION sub so that one can write
>>>  use tests 2;
>>> before a block containing 2 tests. Then a CHECK routine calls plan()
>>> with the number of tests that has accumulated.
>>> Would it be good to add something like this to, or are we
>>> trying to avoid using too many Perl features in that script?
>> I believe that done_testing, backported from Test::More accomplishes
>> this goal with less magic. Is that right?
> It achieves not having to maintain a global test count per file. It
> doesn't allow declaring plans for just chunks of your test and having
> them magically added up.
> subtests with explicit tests would be more like what was being
> suggested, and I'd like to see that being ported to
> Until that happens, I believe done_testing is a very good alternative.

It is far, far too easy to write tests that simply do not run when they fail. I fixed one of those recently in lib/utf8.t. So adding done_testing to existing test files would not be a good idea, unless someone is willing to go searching carefully through all the tests (with a good dose of paranoia).

My original concerns about conflicting patches I aim to prevent, simply by reviewing patches as soon as possible.

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About