Blame t/memory-cycle.t

Packit 9002b2
use strict;
Packit 9002b2
use warnings;
Packit 9002b2
Packit 9002b2
use lib 't/lib';
Packit 9002b2
Packit 9002b2
use DateTime::Format::Builder;
Packit 9002b2
use Test::More;
Packit 9002b2
Packit 9002b2
unless (
Packit 9002b2
    eval
Packit 9002b2
    "use Test::Memory::Cycle; Devel::Cycle->can('_find_cycle_SCALAR'); " ) {
Packit 9002b2
    plan skip_all =>
Packit 9002b2
        'These tests require Test::Memory::Cycle and a working Devel::Cycle (> 1.07).';
Packit 9002b2
    exit;
Packit 9002b2
}
Packit 9002b2
Packit 9002b2
Packit 9002b2
{
Packit 9002b2
    my $builder = DateTime::Format::Builder->new();
Packit 9002b2
    my $parser = $builder->parser( { strptime => '%Y-%m-%d' } );
Packit 9002b2
Packit 9002b2
    memory_cycle_ok(
Packit 9002b2
        $parser,
Packit 9002b2
        'Make sure parser object does not have circular refs'
Packit 9002b2
    );
Packit 9002b2
Packit 9002b2
    memory_cycle_ok(
Packit 9002b2
        $builder,
Packit 9002b2
        'Make sure builder object does not have circular refs after making a single parser'
Packit 9002b2
    );
Packit 9002b2
}
Packit 9002b2
Packit 9002b2
{
Packit 9002b2
    my $builder = DateTime::Format::Builder->new();
Packit 9002b2
    my $parser  = $builder->parser(
Packit 9002b2
        {
Packit 9002b2
            strptime => '%Y-%m-%d',
Packit 9002b2
            strptime => '%d-%m-%Y',
Packit 9002b2
        }
Packit 9002b2
    );
Packit 9002b2
Packit 9002b2
    memory_cycle_ok(
Packit 9002b2
        $parser,
Packit 9002b2
        'Make sure parser object does not have circular refs'
Packit 9002b2
    );
Packit 9002b2
Packit 9002b2
    memory_cycle_ok(
Packit 9002b2
        $builder,
Packit 9002b2
        'Make sure builder object does not have circular refs after making a multi parser'
Packit 9002b2
    );
Packit 9002b2
}
Packit 9002b2
Packit 9002b2
done_testing();