Commit | Line | Data |
---|---|---|
49c38585 YK |
1 | #!./perl -w |
2 | ||
3 | BEGIN { | |
4 | chdir 't' if -d 't'; | |
5 | @INC = '../lib'; | |
6 | require './test.pl'; | |
b75281af | 7 | undef &Regexp::DESTROY; |
49c38585 YK |
8 | } |
9 | ||
10 | plan tests => 2; | |
11 | ||
15a42928 DM |
12 | if ($] >= 5.011) { # doesn't leak on 5.10.x |
13 | $TODO = "leaking since 32751"; | |
14 | } | |
49c38585 YK |
15 | |
16 | my $destroyed; | |
17 | { | |
49c38585 YK |
18 | sub Regexp::DESTROY { $destroyed++ } |
19 | } | |
20 | ||
21 | { | |
22 | my $rx = qr//; | |
23 | } | |
24 | ||
25 | is( $destroyed, 1, "destroyed regexp" ); | |
26 | ||
27 | undef $destroyed; | |
28 | ||
29 | { | |
30 | my $var = bless {}, "Foo"; | |
31 | my $rx = qr/(?{ $var })/; | |
32 | } | |
33 | ||
34 | is( $destroyed, 1, "destroyed regexp with closure capture" ); | |
35 |