6 use Test::More tests => 7;
8 use Variable::Magic qw/wizard cast/;
10 my $wiz = eval { wizard get => sub { undef } };
11 ok(!$@, "wizard creation doesn't croak ($@)");
12 ok(defined $wiz, 'wizard is defined');
13 is(ref $wiz, 'SCALAR', 'wizard is a scalar ref');
15 my $n = int rand 1000;
18 my $res = eval { cast $a, $wiz };
19 ok(!$@, "cast doesn't croak ($@)");
20 ok($res, 'cast is valid');
24 local $SIG{__WARN__} = sub { die };
27 ok(!$@, 'callback returning undef doesn\'t warn/croak');
28 is($x, $n, 'callback returning undef fails');