X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=urisagit%2FPerl-Docs.git;a=blobdiff_plain;f=t%2Fcommon.pm;fp=t%2Fcommon.pm;h=0000000000000000000000000000000000000000;hp=a6fb40061589b88145a84d1fa14ffc3e27a80b95;hb=cfa512db1acfce24f3bc1f0dba49f3fffd1722da;hpb=05faa35f252ef7f60a0bc072cf1d123fcb8e255c diff --git a/t/common.pm b/t/common.pm deleted file mode 100644 index a6fb400..0000000 --- a/t/common.pm +++ /dev/null @@ -1,64 +0,0 @@ -# common.pm - common test driver code - -use Test::More ; - -sub tester { - - my( $tests ) = @_ ; - -use Data::Dumper ; - -# plan for one expected ok() call per test - - plan( tests => scalar @{$tests} ) ; - -# loop over all the tests - - foreach my $test ( @{$tests} ) { - -#print Dumper $test ; - - - if ( $test->{skip} ) { - ok( 1, "SKIPPING $test->{name}" ) ; - next ; - } - -# run any setup sub before this test. this can is used to modify the -# object for this test (e.g. delete templates from the cache). - - if( my $pretest = $test->{pretest} ) { - - $pretest->($test) ; - } - - my $sub = $test->{sub} ; - my $args = $test->{args} ; - - my $result = eval { - $sub->( @{$args} ) ; - } ; - -# if we had an error and expected it, we pass this test - - if ( $@ ) { - - if ( $test->{error} && $@ =~ /$test->{error}/ ) { - - ok( 1, $test->{name} ) ; - } - else { - - print "unexpected error: $@\n" ; - ok( 0, $test->{name} ) ; - } - } - - if( my $posttest = $test->{posttest} ) { - - $posttest->($test) ; - } - } -} - -1 ;