File Coverage

blib/lib/Test/Spec/TodoExample.pm
Criterion Covered Total %
statement 9 26 34.6
branch n/a
condition 0 2 0.0
subroutine 3 9 33.3
pod 0 6 0.0
total 12 43 27.9


line stmt bran cond sub pod time code
1             package Test::Spec::TodoExample;
2              
3             # Purpose: represents a `xit` block (ie. a pending/todo test)
4              
5 14     14   104 use strict;
  14         33  
  14         399  
6 14     14   75 use warnings;
  14         31  
  14         395  
7              
8 14     14   73 use Test::Spec qw(*TODO);
  14         27  
  14         71  
9              
10             sub new {
11 0     0 0   my ($class, $args) = @_;
12              
13 0           my $self = bless {}, $class;
14 0           $self->{name} = $args->{name};
15 0           $self->{description} = $args->{description};
16 0   0       $self->{reason} = $args->{reason} || '(unimplemented)';
17 0           $self->{builder} = $args->{builder};
18              
19 0           return $self;
20             }
21              
22             # Attributes
23 0     0 0   sub name { shift->{name} }
24 0     0 0   sub description { shift->{description} }
25 0     0 0   sub reason { shift->{reason} }
26 0     0 0   sub builder { shift->{builder} }
27              
28             # Methods
29             sub run {
30 0     0 0   my ($self) = @_;
31              
32 0           local $TODO = $self->reason;
33 0           my $builder = $self->builder;
34              
35 0           $builder->todo_start($TODO);
36 0           $builder->ok(1, $self->description); # XXX: could fail the TOOD (or even run it?)
37 0           $builder->todo_end();
38             }
39              
40             1;