line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
2
|
|
|
2
|
|
20
|
use MooseX::Declare; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
15
|
|
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
16557
|
role Test::Sweet::Meta::Method { |
|
2
|
|
|
2
|
|
4
|
|
|
2
|
|
|
2
|
|
55
|
|
|
2
|
|
|
2
|
|
14540
|
|
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
17
|
|
|
2
|
|
|
|
|
6321
|
|
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
18
|
|
|
2
|
|
|
|
|
163
|
|
4
|
2
|
|
|
2
|
|
101
|
use Sub::Name; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
111
|
|
5
|
2
|
|
|
2
|
|
1396
|
use Test::Builder; |
|
2
|
|
|
|
|
85233
|
|
|
2
|
|
|
|
|
69
|
|
6
|
2
|
|
|
2
|
|
13
|
use Context::Preserve qw(preserve_context); |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
158
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
has 'original_body' => ( |
9
|
|
|
|
|
|
|
is => 'ro', |
10
|
|
|
|
|
|
|
isa => 'CodeRef', |
11
|
|
|
|
|
|
|
required => 1, |
12
|
|
|
|
|
|
|
); |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
requires 'wrap'; |
15
|
|
|
|
|
|
|
requires 'body'; |
16
|
|
|
|
|
|
|
|
17
|
2
|
|
|
2
|
|
480182
|
around wrap($class: $code, %params) { |
18
|
|
|
|
|
|
|
my $self = $class->$orig($params{original_body}, %params); |
19
|
|
|
|
|
|
|
return $self; |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
2
|
|
|
2
|
|
104126
|
around body { |
23
|
|
|
|
|
|
|
return (subname "<Test::Sweet test wrapper>", sub { |
24
|
|
|
|
|
|
|
my @args = @_; |
25
|
|
|
|
|
|
|
my $context = wantarray; |
26
|
|
|
|
|
|
|
my ($result, @result); |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
my $b = Test::Builder->new; # TODO: let this be passed in |
29
|
|
|
|
|
|
|
$b->subtest( |
30
|
|
|
|
|
|
|
$self->name => |
31
|
|
|
|
|
|
|
subname "<Test::Sweet subtest>", sub { |
32
|
|
|
|
|
|
|
if($context){ |
33
|
|
|
|
|
|
|
@result = $self->$orig->(@args); |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
elsif(defined $context){ |
36
|
|
|
|
|
|
|
$result = $self->$orig->(@args); |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
else { |
39
|
|
|
|
|
|
|
$self->$orig->(@args); |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
$b->done_testing; |
42
|
|
|
|
|
|
|
}, |
43
|
|
|
|
|
|
|
); |
44
|
|
|
|
|
|
|
return @result if $context; |
45
|
|
|
|
|
|
|
return $result if defined $context; |
46
|
|
|
|
|
|
|
return; |
47
|
|
|
|
|
|
|
}); |
48
|
|
|
|
|
|
|
} |
49
|
2
|
|
|
2
|
|
2941
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
__END__ |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=head1 NAME |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
Test::Sweet::Meta::Method - metamethod trait for running method as tests |