File: memory-leak.t

package info (click to toggle)
libhtml-restrict-perl 3.0.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 364 kB
  • sloc: perl: 842; makefile: 7
file content (24 lines) | stat: -rw-r--r-- 507 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
use strict;
use warnings;

use Test::More;
use HTML::Restrict ();
use Scalar::Util   qw( weaken );

# Ensure that we don't have any circular references between the HTML::Restrict
# object and its parser.
my $hr = HTML::Restrict->new;
my $p  = $hr->parser;

my $weak_hr = $hr;
my $weak_p  = $p;
weaken($weak_hr);
weaken($weak_p);

undef $hr;
undef $p;

ok !defined $weak_hr, 'HTML::Restrict freed; no circular reference.';
ok !defined $weak_p,  'HTML::Parser freed; no circular reference.';

done_testing();