This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
qr_gc.t is only TODO on 5.11.x+
[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';
b75281af 7 undef &Regexp::DESTROY;
49c38585
YK
8}
9
10plan tests => 2;
11
15a42928
DM
12if ($] >= 5.011) { # doesn't leak on 5.10.x
13 $TODO = "leaking since 32751";
14}
49c38585
YK
15
16my $destroyed;
17{
49c38585
YK
18 sub Regexp::DESTROY { $destroyed++ }
19}
20
21{
22 my $rx = qr//;
23}
24
25is( $destroyed, 1, "destroyed regexp" );
26
27undef $destroyed;
28
29{
30 my $var = bless {}, "Foo";
31 my $rx = qr/(?{ $var })/;
32}
33
34is( $destroyed, 1, "destroyed regexp with closure capture" );
35