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 41 42 43 44 45 46 47 48 49 50 51 52 53 54
|
use strict;
use warnings;
use Config;
use Test::More;
BEGIN {
for (qw(Test::LeakTrace Moose)) {
eval "use $_";
if ($@) {
plan 'skip_all' => "$_ missing";
exit(0);
}
}
}
use Set::Object;
{
package Foo;
use Moose;
1;
}
{
no strict;
note join ' ', map {$Config{$_}} qw(osname archname);
note 'perl version ', $];
note $_,'-',${"${_}::VERSION"} for qw{Moose Set::Object Test::LeakTrace};
}
my $set;
{
$set = Set::Object->new;
no_leaks_ok {
{
my $obj = Foo->new;
$set->insert($obj);
$set->remove($obj);
}
} 'Testing Set::Object for leaking';
}
{
$set = Set::Object::Weak->new;
no_leaks_ok {
{
my $obj = Foo->new;
$set->insert($obj);
$set->remove($obj);
}
} 'Testing Set::Object::Weak for leaking';
}
done_testing;
|