summaryrefslogtreecommitdiff
path: root/cpan/Test-Simple/lib/Test/Builder/Result/Child.pm
blob: c5fd881aecb90364f40c5bdf67e62837badb5092 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
package Test::Builder::Result::Child;
use strict;
use warnings;

use base 'Test::Builder::Result';

use Carp qw/confess/;

use Test::Builder::Util qw/accessors/;
accessors qw/name is_subtest/;

sub action {
    my $self = shift;
    if (@_) {
        my ($action) = @_;
        confess "action must be one of 'push' or 'pop'"
            unless $action =~ m/^(push|pop)$/;

        $self->{action} = $action;
    }

    confess "action was never set!"
        unless $self->{action};

    return $self->{action};
}

sub to_tap { }

1;

__END__

=head1 NAME

Test::Builder::Result::Child - Child result type

=head1 DESCRIPTION

Sent when a child Builder is spawned, such as a subtest.

=head1 METHODS

See L<Test::Builder::Result> which is the base class for this module.

=head2 CONSTRUCTORS

=over 4

=item $r = $class->new(...)

Create a new instance

=back

=head2 ATTRIBUTES

=over 4

=item $r->action

Either 'push' or 'pop'. When a child is created a push is sent, when a child
exits a pop is sent.

=back

=head2 SIMPLE READ/WRITE ACCESSORS

=over 4

=item $r->name

Name of the child

=item $r->is_subtest

True if the child was spawned for a subtest.

=item $r->trace

Get the test trace info, including where to report errors.

=item $r->pid

PID in which the result was created.

=item $r->depth

Builder depth of the result (0 for normal, 1 for subtest, 2 for nested, etc).

=item $r->in_todo

True if the result was generated inside a todo.

=item $r->source

Builder that created the result, usually $0, but the name of a subtest when
inside a subtest.

=item $r->constructed

Package, File, and Line in which the result was built.

=back

=head2 INFORMATION

=over 4

=item $r->to_tap

no-op, return nothing.

=item $r->type

Type of result. Usually this is the lowercased name from the end of the
package. L<Test::Builder::Result::Ok> = 'ok'.

=item $r->indent

Returns the indentation that should be used to display the result ('    ' x
depth).

=back

=head1 AUTHORS

=over 4

=item Chad Granum E<lt>exodist@cpan.orgE<gt>

=back

=head1 SOURCE

The source code repository for Test::More can be found at
F<http://github.com/Test-More/test-more/>.

=head1 COPYRIGHT

Copyright 2014 Chad Granum E<lt>exodist7@gmail.comE<gt>.

This program is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.

See F<http://www.perl.com/perl/misc/Artistic.html>