1 BEGIN { $ENV{PERL_STRICTURES_EXTRA} = 0 }
3 sub _eval { eval $_[0] }
7 use Test::More qw(no_plan);
14 BEGIN { @h = ( $^H, ${^WARNING_BITS} ) }
17 my ($hints, $warning_bits) = _eval $code or die $@;
18 # ignore lexicalized hints
20 $warning_bits = unpack "H*", $warning_bits
21 if defined $warning_bits;
22 return ($hints, $warning_bits);
26 my ($code_want, $code_got, $name) = @_;
27 my ($want_hints, $want_warnings) = capture_hints $code_want;
28 my ($hints, $warnings) = capture_hints $code_got;
29 is($hints, $want_hints, "Hints correct for $name");
30 is($warnings, $want_warnings, "Warnings correct for $name");
35 use warnings FATAL => 'all';
45 use warnings FATAL => @strictures::WARNING_CATEGORIES;
46 no warnings FATAL => @strictures::V2_NONFATAL;
47 use warnings @strictures::V2_NONFATAL;
48 no warnings @strictures::V2_DISABLE;
56 eval { $v = strictures->VERSION; 1 } or diag $@;
57 is $v, $strictures::VERSION, '->VERSION returns version correctly';
59 my $next = int $strictures::VERSION + 1;
60 eval qq{ use strictures $next; };
62 like $@, qr/strictures version $next required/,
63 "Can't use strictures $next (this is version $v)";
65 eval qq{ use strictures $strictures::VERSION; };
68 "Can use current strictures version";