File Coverage

Test/Simply.pm
Criterion Covered Total %
statement 19 25 76.0
branch 2 6 33.3
condition n/a
subroutine 7 8 87.5
pod 0 1 0.0
total 28 40 70.0


line stmt bran cond sub pod time code
1             package Test::Simply;
2              
3 1     1   418 use 5.00503;
  1         2  
  1         28  
4 1     1   4 use strict;
  1         1  
  1         24  
5 1     1   3 use vars qw($VERSION $tests $testno $ok);
  1         3  
  1         108  
6             $VERSION = 0.03;
7             $tests = 0;
8             $testno = 1;
9             $ok = 0;
10              
11             BEGIN {
12 1     1   181 $| = 1;
13             }
14              
15             INIT {
16             $SIG{__DIE__} = sub { exit(255) };
17             }
18              
19             END {
20 1 50   1   0 exit((($tests-$ok)<=254) ? ($tests-$ok) : 254);
21             }
22              
23             sub import {
24 1 50   1   8 if ($_[1] eq 'tests') {
25 1         1 $tests = $_[2];
26 1         44 print "1..$tests\n";
27             }
28             else {
29 0         0 die "Test::Simply requires 'tests', like 'use Test::Simply tests => 3;'\n";
30             }
31 1     1   7 no strict 'refs';
  1         2  
  1         150  
32 1         2 *{caller() . '::ok'} = \&ok;
  1         27  
33             }
34              
35             sub ok {
36 0 0   0 0   if ($_[0]) {
37 0           print join(' - ',grep(/./,"ok $testno",$_[1])), "\n";
38 0           $ok++;
39             }
40             else {
41 0           print join(' - ',grep(/./,"not ok $testno",$_[1])), "\n";
42             }
43 0           $testno++;
44             }
45              
46             1;
47              
48             __END__