Commit | Line | Data |
49c38585 |
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 |
8 | } |
9 | |
10 | plan tests => 2; |
11 | |
15a42928 |
12 | if ($] >= 5.011) { # doesn't leak on 5.10.x |
13 | $TODO = "leaking since 32751"; |
14 | } |
49c38585 |
15 | |
16 | my $destroyed; |
17 | { |
49c38585 |
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 | |