]> git.vpit.fr Git - perl/modules/Variable-Magic.git/commitdiff
Test the "die in free callback in BEGIN" issue in a new t/17-ctl.t
authorVincent Pit <vince@profvince.com>
Mon, 19 Jan 2009 00:23:43 +0000 (01:23 +0100)
committerVincent Pit <vince@profvince.com>
Mon, 19 Jan 2009 00:23:43 +0000 (01:23 +0100)
MANIFEST
t/17-ctl.t [new file with mode: 0644]

index 0aafe9a00cc4ce7f2758ef346149ff641cbab3fd..fc83fa88b8c30e2ecb14ec0cb64c7ba3df807eac 100644 (file)
--- 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 (file)
index 0000000..e694a16
--- /dev/null
@@ -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';