From: Vincent Pit Date: Sat, 28 Feb 2009 15:11:18 +0000 (+0100) Subject: Test numeric signatures too big/small X-Git-Tag: v0.32~7 X-Git-Url: http://git.vpit.fr/?p=perl%2Fmodules%2FVariable-Magic.git;a=commitdiff_plain;h=e76be39da55047ed28b34f6f747fa95e2e3220d2 Test numeric signatures too big/small --- diff --git a/t/12-sig.t b/t/12-sig.t index 662546d..7f8ff2c 100644 --- a/t/12-sig.t +++ b/t/12-sig.t @@ -3,9 +3,9 @@ use strict; use warnings; -use Test::More tests => 26; +use Test::More tests => 30; -use Variable::Magic qw/wizard getsig cast dispell SIG_MIN/; +use Variable::Magic qw/wizard getsig cast dispell SIG_MIN SIG_MAX/; my $sig = 300; @@ -28,6 +28,14 @@ my ($a, $b, $c, $d) = 1 .. 4; like($@, qr/Invalid\s+numeric\s+signature\s+at\s+\Q$0\E/, 'non numeric signature croaks'); is($wiz3, undef, 'non numeric signature doesn\'t return anything'); + $wiz3 = eval { wizard sig => SIG_MIN - 1 }; + like($@, qr/Invalid\s+numeric\s+signature\s+at\s+\Q$0\E/, 'numeric signature too small croaks'); + is($wiz3, undef, 'numeric signature too small doesn\'t return anything'); + + $wiz3 = eval { wizard sig => SIG_MAX + 1 }; + like($@, qr/Invalid\s+numeric\s+signature\s+at\s+\Q$0\E/, 'numeric signature too big croaks'); + is($wiz3, undef, 'numeric signature too big doesn\'t return anything'); + my $a = 1; my $res = eval { cast $a, $wiz }; is($@, '', 'cast from wizard doesn\'t croak');