X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Fstrictures.t;h=ad8ec108b5e5a2e73702d571b74a252dc9d63ab5;hb=3d4f7774b1c23f9e06a612d06e2b9683a884cc4c;hp=9cf35bda356988c3ff6bc1427238bbcd8e03c692;hpb=cd7827626c6ee8af1df33c3a2fd92322593e1ff1;p=p5sagit%2Fstrictures.git diff --git a/t/strictures.t b/t/strictures.t index 9cf35bd..ad8ec10 100644 --- a/t/strictures.t +++ b/t/strictures.t @@ -1,25 +1,27 @@ BEGIN { $ENV{PERL_STRICTURES_EXTRA} = 0 } +sub _eval { eval $_[0] } + +use strict; +use warnings; +use Test::More qw(no_plan); + sub capture_hints { my $code = shift; - my ($hints, $warning_bits); $code .= q{ ; - BEGIN { - # ignore lexicalized hints - $hints = $^H & ~ 0x20000; - $warning_bits = defined ${^WARNING_BITS} ? (unpack "H*", ${^WARNING_BITS}) : undef; - }; - 1; + my @h; + BEGIN { @h = ( $^H, ${^WARNING_BITS} ) } + @h; }; - eval $code or die $@; + my ($hints, $warning_bits) = _eval $code or die $@; + # ignore lexicalized hints + $hints &= ~ 0x20000; + $warning_bits = unpack "H*", $warning_bits + if defined $warning_bits; return ($hints, $warning_bits); } -use strict; -use warnings; -use Test::More qw(no_plan); - sub compare_hints { my ($code_want, $code_got, $name) = @_; my ($want_hints, $want_warnings) = capture_hints $code_want; @@ -54,7 +56,7 @@ my $v; eval { $v = strictures->VERSION; 1 } or diag $@; is $v, $strictures::VERSION, '->VERSION returns version correctly'; -my $next = int $v + 1; +my $next = int $strictures::VERSION + 1; eval qq{ use strictures $next; }; like $@, qr/strictures version $next required/,