1 BEGIN { $ENV{PERL_STRICTURES_EXTRA} = 0 }
3 sub _eval { eval $_[0] }
16 BEGIN { @h = ( $^H, ${^WARNING_BITS} ) }
19 my ($hints, $warning_bits) = _eval $code or die $@;
20 # ignore lexicalized hints
22 $warning_bits = unpack "H*", $warning_bits
23 if defined $warning_bits;
24 return ($hints, $warning_bits);
28 my ($code_want, $code_got, $name) = @_;
29 my ($want_hints, $want_warnings) = capture_hints $code_want;
30 my ($hints, $warnings) = capture_hints $code_got;
31 is($hints, $want_hints, "Hints correct for $name");
32 is($warnings, $want_warnings, "Warnings correct for $name");
37 use warnings FATAL => 'all';
47 use warnings FATAL => @strictures::WARNING_CATEGORIES;
48 no warnings FATAL => @strictures::V2_NONFATAL;
49 use warnings @strictures::V2_NONFATAL;
50 no warnings @strictures::V2_DISABLE;
58 eval { $v = strictures->VERSION; 1 } or diag $@;
59 is $v, $strictures::VERSION, '->VERSION returns version correctly';
61 my $next = int $strictures::VERSION + 1;
62 eval qq{ use strictures $next; };
64 like $@, qr/strictures version $next required/,
65 "Can't use strictures $next (this is version $v)";
67 eval qq{ use strictures {version => $next}; };
69 like $@, qr/Major version specified as $next - not supported/,
70 "Can't use strictures version option $next (this is version $v)";
72 eval qq{ use strictures {version => undef}; };
74 like $@, qr/Major version specified as undef - not supported/,
75 "Can't use strictures version option undef";
77 eval qq{ use strictures $strictures::VERSION; };
80 "Can use current strictures version";