From: Vincent Pit Date: Mon, 19 Jan 2009 00:23:43 +0000 (+0100) Subject: Test the "die in free callback in BEGIN" issue in a new t/17-ctl.t X-Git-Tag: v0.28~22 X-Git-Url: http://git.vpit.fr/?a=commitdiff_plain;h=47e2d1bc5fd0a815679af42924899c1a56d41c23;p=perl%2Fmodules%2FVariable-Magic.git Test the "die in free callback in BEGIN" issue in a new t/17-ctl.t --- diff --git a/MANIFEST b/MANIFEST index 0aafe9a..fc83fa8 100644 --- a/MANIFEST +++ b/MANIFEST @@ -18,6 +18,7 @@ t/13-data.t t/14-callbacks.t t/15-self.t t/16-huf.t +t/17-ctl.t t/20-get.t t/21-set.t t/22-len.t diff --git a/t/17-ctl.t b/t/17-ctl.t new file mode 100644 index 0000000..e694a16 --- /dev/null +++ b/t/17-ctl.t @@ -0,0 +1,22 @@ +#!perl -T + +use strict; +use warnings; + +use Test::More tests => 1; + +use Variable::Magic qw/wizard cast getdata/; + +# Inspired by B::Hooks::EndOfScope +# This test is better be left at the beginning of the file, since problems +# happen at UNITCHECK time + +my $wiz; + +BEGIN { + $wiz = wizard data => sub { $_[1] }, free => sub { $_[1]->(); () }; + $^H |= 0x020000; + cast %^H, $wiz, sub { die "harmless" }; +} + +pass 'die in free callback in BEGIN didn\'t segfault';