develooper Front page | perl.perl5.porters | Postings from September 2005

Re: [TODO] rewrite Math::Complex' Complex.t to use Test::More

Thread Previous | Thread Next
Fergal Daly
September 26, 2005 06:59
Re: [TODO] rewrite Math::Complex' Complex.t to use Test::More
Message ID:
On 9/26/05, Jarkko Hietaniemi <> wrote:
> Michael G Schwern wrote:
> > On Sun, Sep 25, 2005 at 11:43:30AM +0300, Jarkko Hietaniemi wrote:
> >
> >>Someone else than me :-) should rewrite the test to use more
> >>modern testing frameworks.  Note: large parts of the current
> >>test are "data-driven", I have no experience on how well e.g.
> >>Test::More suits that, if it doesn't (I am thinking of useful
> >>reporting of failures: where to say that the failure happened
> >>if all you've got is a loop reading the __DATA__?) this might
> >>open up a place to enhance Test::More, too.
> >
> >
> > You can use diag() and the test name to give the extra information, or you
> > can just continue to print it out with a leading #.  In most cases the extra
> > diagnostics will not be necessary because Test::More's failure diagnostics
> > already give you that information.  For example...
> What I would want to see in case of failures would be e.g.
> not ok 123
> #   Failed test in Complex.t at line 56, <DATA> line 1234.
> #          got: '1+2i'
> #     expected: '1+i'
> because the relevant input data would be at 1234, not at 56.

When I write data driven tests, I either embed unique names for the
tests in the data or I generate the names based on the data. In this
case you could have test names that include the DATA line number and
maybe the operation that was being tested,


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