|
NAMETest2::Compare::Base - Base class for comparison classes. DESCRIPTIONAll comparison classes for Test2::Compare should inherit from this base class. SYNOPSIS package Test2::Compare::MyCheck;
use strict;
use warnings;
use base 'Test2::Compare::Base';
use Test2::Util::HashBase qw/stuff/;
sub name { 'STUFF' }
sub operator {
my $self = shift;
my ($got) = @_;
return 'eq';
}
sub verify {
my $self = shift;
my $params = @_;
# Always check if $got exists! This method must return false if no
# value at all was received.
return 0 unless $params{exists};
my $got = $params{got};
# Returns true if both values match. This includes undef, 0, and other
# false-y values!
return $got eq $self->stuff;
}
METHODSSome of these must be overridden, others can be.
SOURCEThe source code repository for Test2-Suite can be found at https://github.com/Test-More/Test2-Suite/. MAINTAINERSAUTHORSCOPYRIGHTCopyright 2018 Chad Granum <exodist@cpan.org>. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See http://dev.perl.org/licenses/
|