File Coverage

blib/lib/Acme/Testing.pm
Criterion Covered Total %
statement 22 35 62.8
branch 1 4 25.0
condition 0 9 0.0
subroutine 7 9 77.7
pod 0 1 0.0
total 30 58 51.7


line stmt bran cond sub pod time code
1             package Acme::Testing;
2              
3 1     1   39800 use strict;
  1         2  
  1         35  
4 1     1   5 use warnings;
  1         2  
  1         24  
5 1     1   6 use Test::More;
  1         5  
  1         5  
6 1     1   1107 use Class::Monkey;
  1         21413  
  1         11  
7              
8             our $VERSION = '0.002';
9              
10             $Acme::Testing::excuses = [
11             'Finalizing test...',
12             'Rejigging the thrompletotes in the cardequanter...',
13             'Test halted temporarily due to BBIAB...',
14             'Test gone AFK momentarily...',
15             'Running CHKDSK... Please wait.'
16             ];
17              
18             sub import {
19 1     1   11 my $class = shift;
20 1         4 my $caller = caller;
21 1         13 canpatch 'Test::More';
22 1 50       44 distribute($caller)
23             unless $caller->can('ok');
24             }
25              
26             sub distribute {
27 0     0 0   my $caller = shift;
28 0           my $base = $Test::Reuse::base;
29 0           my $excuses = $Acme::Testing::excuses;
30 1         27 localscope: {
31 1     1   265 no strict 'refs';
  1         3  
  0            
32 1     1   6 no warnings;
  1         11  
  1         229  
33 0           for my $method (keys %{"Test::More::"}) {
  0            
34 0 0 0       unless( substr($method, 0, 1) eq '_' or $method eq uc $method or substr($method, 0, 1) eq uc(substr($method, 0, 1)) or $method eq 'builder') {
      0        
      0        
35             after $method => sub {
36 0     0     print $excuses->[rand(@$excuses)] . "\n";
37 0           sleep 15;
38             },
39 0           qw;
40 0           *{"${caller}::${method}"} = *{"Test::More::${method}"};
  0            
  0            
41             }
42             }
43             }
44             }
45              
46             =head1 NAME
47              
48             Acme::Testing - Leave me alone, it's testing!
49              
50             =head1 DESCRIPTION
51              
52             A silly module that extends each test by 15 seconds, so you've got more time to do the things YOU want to do. By just running 2 tests you've already regained 30 seconds of your life. Fantastic!
53             It works the same as Test::More, except you only need to C. The module will export all the Test::More test functions to your script for you.
54              
55             =head1 SYNOPSIS
56              
57             use Acme::Testing;
58              
59             ok 1, 'This could take a while..';
60             is 2+2, 4, 'Just going for a bite to eat.. back soon';
61              
62             done_testing();
63              
64             =head1 AUTHOR
65              
66             Brad Haywood
67              
68             =head1 LICENSE
69              
70             You may distribute this code under the same terms as Perl itself.
71              
72             =cut
73              
74             1;