On Fri, Jun 25, 2004 at 04:41:15PM +0100, Tony Bowden wrote:
> On Fri, Jun 25, 2004 at 11:10:19AM -0400, Andrew Pimlott wrote:
> > I was responding to your suggestion to put all the tests in one method
> > if they are just parametrized by data.  How do you suggest writing the
> > equivalent of
> >     foreach (@test_data) {
> >         is(my_func($_->{input}), $_->{output}, $_->{test_name});
> >     }
> > in xUnit style, such that the first failure does not cause the rest not
> > to run?
> 
> erm,
> 
> sub test_my_func : Test(no_plan) {
>   my $self = shift;
>   my @test_data = get_test_data_from_somewhere();
>   $self->num_tests(scalar @test_data);
>   foreach (@test_data) {
>     is(my_func($_->{input}), $_->{output}, $_->{test_name});
>   }
> }

Now I'm confused too.  None of the Test::Unit examples I've seen use
"is", they use some form of assert.  Is this the Test::More "is", or
something else?  Doesn't an xUnit-style test need to throw an exception
to signal failure?  Does your "is" do that?  If so, no test data after
the first failure will be tried.  If not, how does this work?

If this style is described somewhere and I just missed it, point me the
way.  My Test::Unit doesn't use the ": Test" attribute, so maybe I have
old or wrong code.

Andrew

Reply via email to