line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package TAP::Spec::TestResult; |
2
|
|
|
|
|
|
|
BEGIN { |
3
|
2
|
|
|
2
|
|
82
|
$TAP::Spec::TestResult::AUTHORITY = 'cpan:ARODLAND'; |
4
|
|
|
|
|
|
|
} |
5
|
|
|
|
|
|
|
{ |
6
|
|
|
|
|
|
|
$TAP::Spec::TestResult::VERSION = '0.10'; |
7
|
|
|
|
|
|
|
} |
8
|
|
|
|
|
|
|
# ABSTRACT: The results of a single test |
9
|
2
|
|
|
2
|
|
12
|
use Mouse; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
15
|
|
10
|
2
|
|
|
2
|
|
711
|
use Mouse::Util::TypeConstraints; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
16
|
|
11
|
2
|
|
|
2
|
|
162
|
use namespace::autoclean; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
15
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
enum 'TAP::Spec::TestStatus' => ('ok', 'not ok'); |
14
|
|
|
|
|
|
|
enum 'TAP::Spec::Directive' => qw(SKIP TODO); |
15
|
|
|
|
|
|
|
subtype 'TAP::Spec::TestNumber' => as 'Int', where { $_ > 0 }; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
has 'status' => ( |
19
|
|
|
|
|
|
|
is => 'rw', |
20
|
|
|
|
|
|
|
isa => 'TAP::Spec::TestStatus', |
21
|
|
|
|
|
|
|
required => 1, |
22
|
|
|
|
|
|
|
); |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
has 'number' => ( |
26
|
|
|
|
|
|
|
is => 'rw', |
27
|
|
|
|
|
|
|
isa => 'TAP::Spec::TestNumber', |
28
|
|
|
|
|
|
|
predicate => 'has_number', |
29
|
|
|
|
|
|
|
); |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
has 'description' => ( |
33
|
|
|
|
|
|
|
is => 'rw', |
34
|
|
|
|
|
|
|
isa => 'Str', |
35
|
|
|
|
|
|
|
predicate => 'has_description', |
36
|
|
|
|
|
|
|
); |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
has 'directive' => ( |
40
|
|
|
|
|
|
|
is => 'rw', |
41
|
|
|
|
|
|
|
isa => 'TAP::Spec::Directive', |
42
|
|
|
|
|
|
|
predicate => 'has_directive', |
43
|
|
|
|
|
|
|
); |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
has 'reason' => ( |
47
|
|
|
|
|
|
|
is => 'rw', |
48
|
|
|
|
|
|
|
isa => 'Str', |
49
|
|
|
|
|
|
|
predicate => 'has_reason', |
50
|
|
|
|
|
|
|
); |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub passed { |
54
|
9
|
|
|
9
|
1
|
131
|
my $self = shift; |
55
|
|
|
|
|
|
|
|
56
|
9
|
100
|
|
|
|
52
|
return 1 if $self->status eq 'ok'; |
57
|
2
|
50
|
33
|
|
|
12
|
return 1 if $self->has_directive and $self->directive eq 'TODO'; |
58
|
2
|
|
|
|
|
11
|
return ''; |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
sub as_tap { |
63
|
0
|
|
|
0
|
1
|
|
my ($self) = @_; |
64
|
|
|
|
|
|
|
|
65
|
0
|
|
|
|
|
|
my $tap = $self->status; |
66
|
0
|
0
|
|
|
|
|
$tap .= " " . $self->number if $self->has_number; |
67
|
0
|
0
|
|
|
|
|
$tap .= " " . $self->description if $self->has_description; |
68
|
0
|
0
|
|
|
|
|
if ($self->has_directive) { |
69
|
0
|
|
|
|
|
|
$tap .= " # " . $self->directive; |
70
|
0
|
0
|
|
|
|
|
$tap .= " " . $self->reason if $self->has_reason; |
71
|
|
|
|
|
|
|
} |
72
|
0
|
|
|
|
|
|
$tap .= "\n"; |
73
|
0
|
|
|
|
|
|
return $tap; |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
__END__ |