| 1 | package Test2::Compare::Regex; | ||||||||||
| 2 | 176 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | 176 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | |||||||||||
| 5 | 176 | ▶ | use base 'Test2::Compare::Base'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | |||||||||||
| 7 | 176 | our $VERSION = '1.302226'; | |||||||||
| 8 | |||||||||||
| 9 | 176 | ▶ | use Test2::Util::HashBase qw/input/; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 10 | |||||||||||
| 11 | 176 | ▶ | use Test2::Util::Ref qw/render_ref rtype/; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 12 | 176 | ▶ | use Carp qw/croak/; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 13 | |||||||||||
| 14 | 7 | ▶ | sub init { | ||||||||
|
Subroutine
init: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||
| 15 | 7 | my $self = shift; | |||||||||
| 16 | |||||||||||
| 17 | croak "'input' is a required attribute" | ||||||||||
| 18 | 7 | ▶ | unless $self->{+INPUT}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 19 | |||||||||||
| 20 | croak "'input' must be a regex , got '" . $self->{+INPUT} . "'" | ||||||||||
| 21 | 6 | ▶ | unless rtype($self->{+INPUT}) eq 'REGEXP'; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 22 | |||||||||||
| 23 | 5 | $self->SUPER::init(); | |||||||||
| 24 | } | ||||||||||
| 25 | |||||||||||
| 26 | 2 | ▶ | sub stringify_got { 1 } | ||||||||
|
Subroutine
stringify_got: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 27 | |||||||||||
| 28 | 3 | ▶ | sub operator { 'eq' } | ||||||||
|
Subroutine
operator: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 29 | |||||||||||
| 30 | 3 | ▶ | sub name { "" . $_[0]->{+INPUT} } | ||||||||
|
Subroutine
name: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 31 | |||||||||||
| 32 | 11 | ▶ | sub verify { | ||||||||
|
Subroutine
verify: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||
| 33 | 11 | my $self = shift; | |||||||||
| 34 | 11 | my %params = @_; | |||||||||
| 35 | 11 | my ($got, $exists) = @params{qw/got exists/}; | |||||||||
| 36 | |||||||||||
| 37 | 11 | ▶ | return 0 unless $exists; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 38 | |||||||||||
| 39 | 10 | my $in = $self->{+INPUT}; | |||||||||
| 40 | 10 | ▶ | my $got_type = rtype($got) or return 0; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 41 | |||||||||||
| 42 | 8 | ▶ | return 0 unless $got_type eq 'REGEXP'; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 43 | |||||||||||
| 44 | 7 | return "$in" eq "$got"; | |||||||||
| 45 | } | ||||||||||
| 46 | |||||||||||
| 47 | 176 | 1; | |||||||||
| 48 | |||||||||||
| 49 | __END__ | ||||||||||