line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test::Sweet::Keyword::Test; |
2
|
2
|
|
|
2
|
|
10
|
use strict; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
66
|
|
3
|
2
|
|
|
2
|
|
23
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
58
|
|
4
|
|
|
|
|
|
|
|
5
|
2
|
|
|
2
|
|
518
|
use Devel::BeginLift; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
use Devel::Declare (); |
7
|
|
|
|
|
|
|
use Sub::Name; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
use base 'Devel::Declare::Context::Simple'; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub install_methodhandler { |
12
|
|
|
|
|
|
|
my $class = shift; |
13
|
|
|
|
|
|
|
my %args = @_; |
14
|
|
|
|
|
|
|
{ |
15
|
|
|
|
|
|
|
no strict 'refs'; |
16
|
|
|
|
|
|
|
*{$args{into}.'::test'} = sub (&) {}; |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
my $ctx = $class->new(%args); |
20
|
|
|
|
|
|
|
Devel::Declare->setup_for( |
21
|
|
|
|
|
|
|
$args{into}, { |
22
|
|
|
|
|
|
|
test => { const => sub { $ctx->parser(@_) } }, |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
); |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub parser { |
28
|
|
|
|
|
|
|
my $self = shift; |
29
|
|
|
|
|
|
|
$self->init(@_); |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
$self->skip_declarator; |
32
|
|
|
|
|
|
|
my $name = $self->strip_name; |
33
|
|
|
|
|
|
|
$self->strip_proto; |
34
|
|
|
|
|
|
|
$self->strip_attrs; |
35
|
|
|
|
|
|
|
#$self->parse_proto($proto); |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
my $inject = $self->scope_injector_call(); |
38
|
|
|
|
|
|
|
$self->inject_if_block($inject. " my \$self = shift; "); |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
my $pack = Devel::Declare::get_curstash_name; |
41
|
|
|
|
|
|
|
Devel::Declare::shadow_sub("${pack}::test", sub (&) { |
42
|
|
|
|
|
|
|
my $test_method = shift; |
43
|
|
|
|
|
|
|
$pack->meta->add_test( $name, $test_method ); |
44
|
|
|
|
|
|
|
}); |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
return; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
1; |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
__END__ |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=head1 NAME |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
Test::Sweet::Keyword::Test - provides the C<test> keyword |
56
|
|
|
|
|
|
|
|