X-Git-Url: https://perl5.git.perl.org/perl5.git/blobdiff_plain/a21a75c8b50f9fa1a0642bac43a6e51ed8083f0f..7fddb138e6bbaa0efbb2096d3d3cc5a0ee34d546:/ext/File-DosGlob/t/DosGlob.t?ds=sidebyside diff --git a/ext/File-DosGlob/t/DosGlob.t b/ext/File-DosGlob/t/DosGlob.t index 1e4f7f3..b3302b8 100644 --- a/ext/File-DosGlob/t/DosGlob.t +++ b/ext/File-DosGlob/t/DosGlob.t @@ -14,7 +14,7 @@ BEGIN { @INC = '../lib'; } -use Test::More tests => 20; +use Test::More tests => 21; # override it in main:: use File::DosGlob 'glob'; @@ -135,3 +135,21 @@ if ($cwd =~ /^([a-zA-Z]:)/) { } else { pass(); } + +# Test that our internal data are freed when the caller’s op tree is freed, +# even if iteration has not finished. +# Using XS::APItest is the only simple way to test this. Since this is a +# core-only module, this should be OK. +SKIP: { + require Config; + skip "no XS::APItest" + unless eval { require XS::APItest; import XS::APItest "sv_count"; 1 }; + # Use a random number of ops, so that the glob op does not reuse the + # same address each time, giving us false passes. + my($count,$count2); + eval '$x+'x(rand() * 100) . '<*>'; + $count = sv_count(); + eval '$x+'x(rand() * 100) . '<*>'; + $count2 = sv_count(); + is $count2, $count, 'no leak when partly iterated caller is freed'; +}