| 1 |
|
| 2 |
use strict; |
| 3 |
use warnings; |
| 4 |
|
| 5 |
=head1 DESCRIPTION |
| 6 |
|
| 7 |
XPathContext memory leak on registerFunction. |
| 8 |
|
| 9 |
See L<https://rt.cpan.org/Ticket/Display.html?id=83744>. |
| 10 |
|
| 11 |
=cut |
| 12 |
|
| 13 |
use constant HAS_LEAKTRACE => eval{ require Test::LeakTrace }; |
| 14 |
use Test::More HAS_LEAKTRACE ? (tests => 2) : (skip_all => 'Test::LeakTrace is required for memory leak tests.'); |
| 15 |
use Test::LeakTrace; |
| 16 |
|
| 17 |
# TEST |
| 18 |
no_leaks_ok { |
| 19 |
use XML::LibXML::XPathContext; |
| 20 |
} 'load XPathContext without leaks'; |
| 21 |
|
| 22 |
# TEST |
| 23 |
no_leaks_ok { |
| 24 |
my $context = XML::LibXML::XPathContext->new(); |
| 25 |
$context->registerFunction('match-font', sub {1;}); |
| 26 |
$context->unregisterFunction('match-font'); |
| 27 |
} 'register an XPath function and unregister it, without leaks'; |