]> git.vpit.fr Git - perl/modules/Variable-Magic.git/blobdiff - t/12-sig.t
Compatibility fix for 5.11.1
[perl/modules/Variable-Magic.git] / t / 12-sig.t
index 662546d18e886e37d8191dfd8247d0bfb4f4ccce..057558436b6ee2a41e573d8f52a73d8ca52c312f 100644 (file)
@@ -3,14 +3,16 @@
 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;
 
 my ($a, $b, $c, $d) = 1 .. 4;
 
+my $inv_num_sig = qr/Invalid\s+numeric\s+signature\s+at\s+\Q$0\E/;
+
 {
  my $wiz = eval { wizard sig => $sig };
  is($@, '',             'wizard creation doesn\'t croak');
@@ -25,8 +27,16 @@ my ($a, $b, $c, $d) = 1 .. 4;
  is($sig, getsig $wiz2,  'retrieved wizard signature is correct');
 
  my $wiz3 = eval { wizard sig => [ ] };
- 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');
+ like($@,  $inv_num_sig, 'non numeric signature croaks');
+ is($wiz3, undef,        'non numeric signature doesn\'t return anything');
+
+ $wiz3 = eval { wizard sig => SIG_MIN - 1 };
+ like($@, $inv_num_sig, 'numeric signature too small croaks');
+ is($wiz3, undef,       'numeric signature too small doesn\'t return anything');
+
+ $wiz3 = eval { wizard sig => SIG_MAX + 1 };
+ like($@, $inv_num_sig, '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 };