Subject: | [PATCH] has_plan('any') to report a skip_all plan |
Date: | Tue, 24 Apr 2007 16:59:49 -0300 |
To: | bug-Test-Simple [...] rt.cpan.org, "Michael G Schwern" <schwern [...] pobox.com>, chromatic <chromatic [...] wgz.org> |
From: | "Adriano Ferreira" <a.r.ferreira [...] gmail.com> |
The attached patch is meant to solve the problem of determining if
any of these statements were executed under the current Test::Builder
instance
$builder->plan( tests => $n );
$builder->plan( 'no_plan' );
$builder->plan( skip_all => $reason );
The first two may be determined looking at the return of
$builder->has_plan;
But that is not the case for the skip_all plan. Actually you'll have to
look at the internal attribute $builder->{Skip_All} to determine this.
I started a thread at perl-qa@perl.org about this and got responses from Ovid
and Adrian Howard that made me see that although skip_all looks
like a plan, it is special anyway.
http://www.nntp.perl.org/group/perl.qa/2007/04/msg8583.html
So my proposal is to leave " $builder->has_plan " as it is, but augment
its behavior if an explicit argument 'any' was given.
$builder->has_plan('any') => the expected number of tests, or
=> 'no_plan' or
=> 'skip_all'
I've touched the documentation as well. If this patch is not accepted,
at the least the phrase "Skip_all plans are handled as if no plan was set."
may be added to the has_plan description.
I've also inserted another test into t/skipall.t to check " has_plan('any') "
works.
Best regards,
Adriano Ferreira.