| Server IP : 127.0.0.1 / Your IP : 216.73.216.48 Web Server : Apache/2.4.58 (Win64) OpenSSL/3.1.3 PHP/8.2.12 System : Windows NT DESKTOP-3H4FHQJ 10.0 build 19045 (Windows 10) AMD64 User : win 10 ( 0) PHP Version : 8.2.12 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : D:/xampp/perl/lib/Test/Deep/ |
Upload File : |
use strict;
use warnings;
package Test::Deep::Cache;
use Test::Deep::Cache::Simple;
sub new
{
my $pkg = shift;
my $self = bless {}, $pkg;
$self->{expects} = [Test::Deep::Cache::Simple->new];
$self->{normal} = [Test::Deep::Cache::Simple->new];
$self->local;
return $self;
}
sub add
{
my $self = shift;
my $type = $self->type;
$self->{$type}->[-1]->add(@_);
}
sub cmp
{
# go through all the caches to see if we know this one
my $self = shift;
my $type = $self->type;
foreach my $cache (@{$self->{$type}})
{
return 1 if $cache->cmp(@_);
}
return 0
}
sub local
{
my $self = shift;
foreach my $type (qw( expects normal ))
{
push(@{$self->{$type}}, Test::Deep::Cache::Simple->new);
}
}
sub finish
{
my $self = shift;
my $keep = shift;
foreach my $type (qw( expects normal ))
{
my $caches = $self->{$type};
my $last = pop @$caches;
$caches->[-1]->absorb($last) if $keep;
}
}
sub type
{
return $Test::Deep::Expects ? "expects" : "normal";
}
1;