1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
|
use strict;
use warnings;
use Test::More qw(no_plan);
use Test::NoWarnings;
use Test::Deep::Cache;
{
local $Test::Deep::Expects = 0;
my $cache = Test::Deep::Cache->new;
my $a = \"a";
my $b = \"b";
my $c = [];
ok(! $cache->cmp($a, $b), "empty cache");
$cache->add($a, $b);
ok($cache->cmp($a, $b), "added");
ok($cache->cmp($b, $a), "reverse");
$cache->local;
ok($cache->cmp($a, $b), "after local");
$cache->add($b, $c);
ok($cache->cmp($b, $c), "local added");
$cache->finish(0);
ok(! $cache->cmp($b, $c), "gone");
$cache->local;
$cache->add($b, $c);
ok($cache->cmp($b, $c), "local added again");
$cache->finish(1);
ok($cache->cmp($b, $c), "still there");
}
|