| 1 | # Defines the behavior of the +test+ keyword. | ||||||||||||||||||||
| 2 | # @api private | ||||||||||||||||||||
| 3 | package Test::Mini::Unit::Sugar::Test; | ||||||||||||||||||||
| 4 | 13 | ▶ | use base 'Devel::Declare::Context::Simple'; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 5 | 13 | ▶ | use strict; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 6 | 13 | ▶ | use warnings; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 7 | |||||||||||||||||||||
| 8 | 13 | ▶ | use Devel::Declare (); | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 9 | 13 | ▶ | use Sub::Name; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 10 | |||||||||||||||||||||
| 11 | 34 | ▶ | sub import { | ||||||||||||||||||
|
Subroutine
import: called CC=2 SCAR=6.9
| |||||||||||||||||||||
| 12 | 34 | my ($class, %args) = @_; | |||||||||||||||||||
| 13 | 34 | ▶ | my $caller = $args{into} || caller; | ||||||||||||||||||
|
Condition66%2/3
$args{'into'} || caller
MC/DC0%0/2
$args{'into'} || caller
$args{'into'}
caller
Truth table66%2/3
A || B
A= $args{'into'}B= caller
| |||||||||||||||||||||
| 14 | |||||||||||||||||||||
| 15 | { | ||||||||||||||||||||
| 16 | 13 | ▶ | no strict 'refs'; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 17 | 34 | ▶ | *{"$caller\::test"} = sub (&) {}; | ||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 18 | } | ||||||||||||||||||||
| 19 | |||||||||||||||||||||
| 20 | Devel::Declare->setup_for( | ||||||||||||||||||||
| 21 | 38 | ▶ | $caller => { test => { const => sub { $class->new()->parser(@_) } } } | ||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 22 | 34 | ); | |||||||||||||||||||
| 23 | } | ||||||||||||||||||||
| 24 | |||||||||||||||||||||
| 25 | 38 | ▶ | sub parser { | ||||||||||||||||||
|
Subroutine
parser: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||
| 26 | 38 | my $self = shift; | |||||||||||||||||||
| 27 | 38 | $self->init(@_); | |||||||||||||||||||
| 28 | |||||||||||||||||||||
| 29 | 38 | $self->skip_declarator; | |||||||||||||||||||
| 30 | 38 | my $name = $self->strip_name; | |||||||||||||||||||
| 31 | |||||||||||||||||||||
| 32 | 38 | $self->inject_if_block($_) for reverse ( | |||||||||||||||||||
| 33 | $self->scope_injector_call(), | ||||||||||||||||||||
| 34 | 'my $self = shift;', | ||||||||||||||||||||
| 35 | ); | ||||||||||||||||||||
| 36 | |||||||||||||||||||||
| 37 | 38 | $self->shadow($self->code("test_$name")); | |||||||||||||||||||
| 38 | } | ||||||||||||||||||||
| 39 | |||||||||||||||||||||
| 40 | 38 | ▶ | sub code { | ||||||||||||||||||
|
Subroutine
code: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||
| 41 | 38 | my ($self, $name) = @_; | |||||||||||||||||||
| 42 | |||||||||||||||||||||
| 43 | 38 | my $pkg = $self->get_curstash_name; | |||||||||||||||||||
| 44 | 38 | ▶ | $name = join('::', $pkg, $name) unless ($name =~ /::/); | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 45 | |||||||||||||||||||||
| 46 | 38 | ▶ | return sub (&) { | ||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 47 | 13 | ▶ | no strict 'refs'; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 48 | 38 | *{$name} = subname $name => shift; | |||||||||||||||||||
| 49 | 38 | }; | |||||||||||||||||||
| 50 | } | ||||||||||||||||||||
| 51 | |||||||||||||||||||||
| 52 | 13 | 1; | |||||||||||||||||||