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