patch@2009-05-25.21:50:08 magic.t leaves $ENV{foo} on VMS.
[p5sagit/p5-mst-13.2.git] / t / op / qr_gc.t
1 #!./perl -w
2
3 BEGIN {
4     chdir 't' if -d 't';
5     @INC = '../lib';
6     require './test.pl';
7     undef &Regexp::DESTROY;
8 }
9
10 plan tests => 2;
11
12 if ($] >= 5.011) { # doesn't leak on 5.10.x
13     $TODO = "leaking since 32751";
14 }
15
16 my $destroyed;
17 {
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