File Coverage

blib/lib/TAP/Parser/Result/Plan.pm
Criterion Covered Total %
statement 14 14 100.0
branch n/a
condition n/a
subroutine 8 8 100.0
pod 5 5 100.0
total 27 27 100.0


line stmt bran cond sub pod time code
1             package TAP::Parser::Result::Plan;
2              
3 32     32   124 use strict;
  32         39  
  32         752  
4 32     32   808 use warnings;
  32         35  
  32         769  
5              
6 32     32   102 use base 'TAP::Parser::Result';
  32         32  
  32         5331  
7              
8             =head1 NAME
9              
10             TAP::Parser::Result::Plan - Plan result token.
11              
12             =head1 VERSION
13              
14             Version 3.38
15              
16             =cut
17              
18             our $VERSION = '3.38';
19              
20             =head1 DESCRIPTION
21              
22             This is a subclass of L. A token of this class will be
23             returned if a plan line is encountered.
24              
25             1..1
26             ok 1 - woo hooo!
27              
28             C<1..1> is the plan. Gotta have a plan.
29              
30             =head1 OVERRIDDEN METHODS
31              
32             Mainly listed here to shut up the pitiful screams of the pod coverage tests.
33             They keep me awake at night.
34              
35             =over 4
36              
37             =item * C
38              
39             =item * C
40              
41             =back
42              
43             =cut
44              
45             ##############################################################################
46              
47             =head2 Instance Methods
48              
49             =head3 C
50              
51             if ( $result->is_plan ) {
52             print $result->plan;
53             }
54              
55             This is merely a synonym for C.
56              
57             =cut
58              
59 258     258 1 1184 sub plan { '1..' . shift->{tests_planned} }
60              
61             ##############################################################################
62              
63             =head3 C
64              
65             my $planned = $result->tests_planned;
66              
67             Returns the number of tests planned. For example, a plan of C<1..17> will
68             cause this method to return '17'.
69              
70             =cut
71              
72 331     331 1 42802 sub tests_planned { shift->{tests_planned} }
73              
74             ##############################################################################
75              
76             =head3 C
77              
78             my $directive = $plan->directive;
79              
80             If a SKIP directive is included with the plan, this method will return it.
81              
82             1..0 # SKIP: why bother?
83              
84             =cut
85              
86 59     59 1 3687 sub directive { shift->{directive} }
87              
88             ##############################################################################
89              
90             =head3 C
91              
92             if ( $result->has_skip ) { ... }
93              
94             Returns a boolean value indicating whether or not this test has a SKIP
95             directive.
96              
97             =head3 C
98              
99             my $explanation = $plan->explanation;
100              
101             If a SKIP directive was included with the plan, this method will return the
102             explanation, if any.
103              
104             =cut
105              
106 15     15 1 12821 sub explanation { shift->{explanation} }
107              
108             =head3 C
109              
110             my $todo = $result->todo_list;
111             for ( @$todo ) {
112             ...
113             }
114              
115             =cut
116              
117 256     256 1 1424 sub todo_list { shift->{todo_list} }
118              
119             1;