use strict;
use warnings;
-use Test::More tests => 22;
+use Test::More tests => 26;
use Variable::Magic qw<wizard cast>;
is($x, $n, 'short string callback returns the right thing');
}
+{
+ my $wiz = eval { wizard get => \undef };
+ is($@, '', 'wizard with a ref-to-undef callback doesn\'t croak');
+ my $b = $n;
+ my $res = eval { cast $b, $wiz };
+ is($@, '', 'cast a wizard with a ref-to-undef callback doesn\'t croak');
+ my $x;
+ eval {
+ local $SIG{__WARN__} = sub { die };
+ $x = $b;
+ };
+ is($@, '', 'ref-to-undef callback doesn\'t warn/croak');
+ is($x, $n, 'ref-to-undef callback returns the right thing');
+}
+
my @callers;
$wiz = wizard get => sub {
my @c;