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