This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
a test for Paul Evan's qr leak
[perl5.git] / t / op / qr_gc.t
CommitLineData
49c38585
YK
1#!./perl -w
2
3BEGIN {
4 chdir 't' if -d 't';
5 @INC = '../lib';
6 require './test.pl';
7}
8
9plan tests => 2;
10
11$TODO = "leaking since 32751";
12
13my $destroyed;
14{
15 no warnings 'redefine';
16 sub Regexp::DESTROY { $destroyed++ }
17}
18
19{
20 my $rx = qr//;
21}
22
23is( $destroyed, 1, "destroyed regexp" );
24
25undef $destroyed;
26
27{
28 my $var = bless {}, "Foo";
29 my $rx = qr/(?{ $var })/;
30}
31
32is( $destroyed, 1, "destroyed regexp with closure capture" );
33