File: 48_memleak_rt_83744.t

package info (click to toggle)
libxml-libxml-perl 2.0116%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie-kfreebsd
  • size: 2,420 kB
  • sloc: perl: 6,139; ansic: 3,752; xml: 182; sh: 64; makefile: 8
file content (27 lines) | stat: -rw-r--r-- 694 bytes parent folder | download | duplicates (7)
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

use strict;
use warnings;

=head1 DESCRIPTION

XPathContext memory leak on registerFunction.

See L<https://rt.cpan.org/Ticket/Display.html?id=83744>.

=cut

use constant HAS_LEAKTRACE => eval{ require Test::LeakTrace };
use Test::More HAS_LEAKTRACE ? (tests => 2) : (skip_all => 'Test::LeakTrace is required for memory leak tests.');
use Test::LeakTrace;

# TEST
no_leaks_ok {
    use XML::LibXML::XPathContext;
} 'load XPathContext without leaks';

# TEST
no_leaks_ok {
    my $context = XML::LibXML::XPathContext->new();
    $context->registerFunction('match-font', sub {1;});
    $context->unregisterFunction('match-font');
} 'register an XPath function and unregister it, without leaks';