| 1 | package Test2::Compare::String; | ||||||||||
| 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 Carp qw/confess/; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | |||||||||||
| 7 | 176 | ▶ | use base 'Test2::Compare::Base'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | |||||||||||
| 9 | 176 | our $VERSION = '1.302226'; | |||||||||
| 10 | |||||||||||
| 11 | 176 | ▶ | use Test2::Util::HashBase qw/input/; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 12 | |||||||||||
| 13 | # Overloads '!' for us. | ||||||||||
| 14 | 176 | ▶ | use Test2::Compare::Negatable; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 15 | |||||||||||
| 16 | 64 | ▶ | sub stringify_got { 1 } | ||||||||
|
Subroutine
stringify_got: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 17 | |||||||||||
| 18 | 7239 | ▶ | sub init { | ||||||||
|
Subroutine
init: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||
| 19 | 7239 | my $self = shift; | |||||||||
| 20 | confess "input must be defined for 'String' check" | ||||||||||
| 21 | 7239 | ▶ | unless defined $self->{+INPUT}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 22 | |||||||||||
| 23 | 7238 | $self->SUPER::init(@_); | |||||||||
| 24 | } | ||||||||||
| 25 | |||||||||||
| 26 | 91 | ▶ | sub name { | ||||||||
|
Subroutine
name: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 27 | 91 | my $self = shift; | |||||||||
| 28 | 91 | my $in = $self->{+INPUT}; | |||||||||
| 29 | 91 | return "$in"; | |||||||||
| 30 | } | ||||||||||
| 31 | |||||||||||
| 32 | 104 | ▶ | sub operator { | ||||||||
|
Subroutine
operator: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||
| 33 | 104 | my $self = shift; | |||||||||
| 34 | |||||||||||
| 35 | 104 | ▶ | return '' unless @_; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 36 | 81 | my ($got) = @_; | |||||||||
| 37 | |||||||||||
| 38 | 81 | ▶ | return '' unless defined($got); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 39 | |||||||||||
| 40 | 74 | ▶ | return 'ne' if $self->{+NEGATE}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 41 | 71 | return 'eq'; | |||||||||
| 42 | } | ||||||||||
| 43 | |||||||||||
| 44 | 9231 | ▶ | sub verify { | ||||||||
|
Subroutine
verify: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||
| 45 | 9231 | my $self = shift; | |||||||||
| 46 | 9231 | my %params = @_; | |||||||||
| 47 | 9231 | my ($got, $exists) = @params{qw/got exists/}; | |||||||||
| 48 | |||||||||||
| 49 | 9231 | ▶ | return 0 unless $exists; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 50 | 9209 | ▶ | return 0 unless defined $got; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 51 | |||||||||||
| 52 | 9198 | my $input = $self->{+INPUT}; | |||||||||
| 53 | 9198 | my $negate = $self->{+NEGATE}; | |||||||||
| 54 | |||||||||||
| 55 | 9198 | ▶ | return "$input" ne "$got" if $negate; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 56 | 9190 | return "$input" eq "$got"; | |||||||||
| 57 | } | ||||||||||
| 58 | |||||||||||
| 59 | 176 | 1; | |||||||||
| 60 | |||||||||||
| 61 | __END__ | ||||||||||