move regex related tests out of t/op/ into t/re/
[p5sagit/p5-mst-13.2.git] / t / re / qr_gc.t
CommitLineData
49c38585 1#!./perl -w
2
3BEGIN {
4 chdir 't' if -d 't';
5 @INC = '../lib';
6 require './test.pl';
b75281af 7 undef &Regexp::DESTROY;
49c38585 8}
9
10plan tests => 2;
11
15a42928 12if ($] >= 5.011) { # doesn't leak on 5.10.x
13 $TODO = "leaking since 32751";
14}
49c38585 15
16my $destroyed;
17{
49c38585 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