This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Fix ill-named Test::Harness test and bump version.
[perl5.git] / cpan / Test-Harness / lib / TAP / Parser / Result / Plan.pm
CommitLineData
b965d173
NC
1package TAP::Parser::Result::Plan;
2
3use strict;
4
5use vars qw($VERSION @ISA);
6use TAP::Parser::Result;
7@ISA = 'TAP::Parser::Result';
8
9=head1 NAME
10
11TAP::Parser::Result::Plan - Plan result token.
12
13=head1 VERSION
14
5a27f6f2 15Version 3.25_01
b965d173
NC
16
17=cut
18
5a27f6f2 19$VERSION = '3.25_01';
b965d173
NC
20
21=head1 DESCRIPTION
22
23This is a subclass of L<TAP::Parser::Result>. A token of this class will be
24returned if a plan line is encountered.
25
26 1..1
27 ok 1 - woo hooo!
28
29C<1..1> is the plan. Gotta have a plan.
30
31=head1 OVERRIDDEN METHODS
32
33Mainly listed here to shut up the pitiful screams of the pod coverage tests.
34They 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
56This is merely a synonym for C<as_string>.
57
58=cut
59
60sub plan { '1..' . shift->{tests_planned} }
61
62##############################################################################
63
64=head3 C<tests_planned>
65
66 my $planned = $result->tests_planned;
67
68Returns the number of tests planned. For example, a plan of C<1..17> will
69cause this method to return '17'.
70
71=cut
72
73sub tests_planned { shift->{tests_planned} }
74
75##############################################################################
76
77=head3 C<directive>
78
79 my $directive = $plan->directive;
80
81If a SKIP directive is included with the plan, this method will return it.
82
83 1..0 # SKIP: why bother?
84
85=cut
86
87sub directive { shift->{directive} }
88
89##############################################################################
90
91=head3 C<has_skip>
92
93 if ( $result->has_skip ) { ... }
94
95Returns a boolean value indicating whether or not this test has a SKIP
96directive.
97
98=head3 C<explanation>
99
100 my $explanation = $plan->explanation;
101
102If a SKIP directive was included with the plan, this method will return the
103explanation, if any.
104
105=cut
106
107sub 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
118sub todo_list { shift->{todo_list} }
119
1201;