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 | ||
49c38585 YK |
12 | my $destroyed; |
13 | { | |
49c38585 YK |
14 | sub Regexp::DESTROY { $destroyed++ } |
15 | } | |
16 | ||
17 | { | |
18 | my $rx = qr//; | |
19 | } | |
20 | ||
21 | is( $destroyed, 1, "destroyed regexp" ); | |
22 | ||
23 | undef $destroyed; | |
24 | ||
25 | { | |
26 | my $var = bless {}, "Foo"; | |
27 | my $rx = qr/(?{ $var })/; | |
28 | } | |
29 | ||
30 | is( $destroyed, 1, "destroyed regexp with closure capture" ); | |
31 |