Test-Helper
view release on metacpan or search on metacpan
lib/Test/Helper.pm,174
sub test(&) {test13,321
sub ok($;) {ok22,500
sub comm(@) {comm29,615
sub runs(&) {runs34,690
sub heinous(&) {heinous40,760
sub syntax_check() {syntax_check46,900
lib/Test/Helper.pm view on Meta::CPAN
package Test::Helper;
use Carp;
use IO::File;
use vars qw($VERSION @ISA @EXPORT $count $output);
use Exporter;
@ISA=qw(Exporter);
@EXPORT=qw(ok comm test runs heinous syntax_check);
# $Format: "$VERSION='$TestHelperRelease$';"$
$VERSION='0.002';
sub test(&) {
local($count)=0;
local($output)='';
eval {&{+shift}};
$count++ if $@; # Simulate something wrong.
print "1..$count\n$output";
die $@ if $@;
}
sub ok($;) {
my $isok=shift;
$output .= 'not ' unless $isok;
$count++;
$output .= "ok $count\n";
}
sub comm(@) {
my $comm=join '', @_;
$output .= "# $comm...\n";
}
sub runs(&) {
my $subr=shift;
eval {&$subr()};
not $@;
}
sub heinous(&) {
carp "`heinous {...}' is deprecated--use `ok not runs {...} instead'";
my $subr=shift;
ok not &runs($subr);
}
sub syntax_check() {
my @mani=grep {
not /\.(t|PL)$/ and not m!^t/! and $_ ne 'test.pl'
} map {
chomp;
( run in 0.686 second using v1.01-cache-2.11-cpan-49f99fa48dc )