develooper Front page | perl.qa | Postings from March 2011

Re: Conditional tests - SKIP, die, BAILOUT

Thread Previous | Thread Next
From:
Michael Ludwig
Date:
March 29, 2011 14:23
Subject:
Re: Conditional tests - SKIP, die, BAILOUT
Message ID:
20110329212333.GG2076@wladimir
Greg Sabino Mullane schrieb am 29.03.2011 um 17:17 (-0400):
> On Tue, Mar 29, 2011 at 10:46:20PM +0200, Michael Ludwig wrote:
> ...
> > my $tkn = $hu->token;   # (1) Can't carry on without the token
> > like $tkn, qr/abc/;     # (2) Useless carrying on if this fails.
> 
> One thing I've done is defer the plan until I can ensure the basic 
> prerequesites for the test  is met.

That's very useful, I'll add it to my repertoire. Thanks!

> my $dbh = connect_database();
> 
> if (! $dbh) {
>     plan skip_all => 'Connection to database failed, cannot continue testing';
> }
> …
> plan tests => 67;

-- 
Michael Ludwig

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About