]> git.vpit.fr Git - perl/modules/Variable-Magic.git/blob - t/17-ctl.t
Test the "die in free callback in BEGIN" issue in a new t/17-ctl.t
[perl/modules/Variable-Magic.git] / t / 17-ctl.t
1 #!perl -T
2
3 use strict;
4 use warnings;
5
6 use Test::More tests => 1;
7
8 use Variable::Magic qw/wizard cast getdata/;
9
10 # Inspired by B::Hooks::EndOfScope
11 # This test is better be left at the beginning of the file, since problems
12 # happen at UNITCHECK time
13
14 my $wiz;
15
16 BEGIN {
17  $wiz = wizard data => sub { $_[1] }, free => sub { $_[1]->(); () };
18  $^H |= 0x020000;
19  cast %^H, $wiz, sub { die "harmless" };
20 }
21
22 pass 'die in free callback in BEGIN didn\'t segfault';