This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Replaced 'unlink' with 'unlink_all' in t/op/magic.t
[perl5.git] / t / re / qr_gc.t
CommitLineData
49c38585
YK
1#!./perl -w
2
3BEGIN {
4 chdir 't' if -d 't';
5 @INC = '../lib';
6 require './test.pl';
b75281af 7 undef &Regexp::DESTROY;
49c38585
YK
8}
9
10plan tests => 2;
11
49c38585
YK
12my $destroyed;
13{
49c38585
YK
14 sub Regexp::DESTROY { $destroyed++ }
15}
16
17{
18 my $rx = qr//;
19}
20
21is( $destroyed, 1, "destroyed regexp" );
22
23undef $destroyed;
24
25{
26 my $var = bless {}, "Foo";
27 my $rx = qr/(?{ $var })/;
28}
29
30is( $destroyed, 1, "destroyed regexp with closure capture" );
31