use strictures ();
-my $strictures_hints;
-BEGIN {
- local $ENV{PERL_STRICTURES_EXTRA} = 0;
- strictures->VERSION(1); strictures->import();
- # Find the hint value that 'use strictures 1' sets on this perl.
- $strictures_hints = $^H;
-}
-use strictures 1;
-
use Test::More;
use Eval::WithLexicals;
use lib 't/lib';
+use strictures 1;
+use get_strictures_hints qw($strictures_hints $strictures_warn);
+
my $eval = Eval::WithLexicals->with_plugins("HintPersistence")->new(prelude => '');
is_deeply(
{
local $SIG{__WARN__} = sub { };
- ok !eval { $eval->eval('$x') }, 'Unable to use undeclared variable';
- like $@, qr/requires explicit package/, 'Correct message in $@';
+ ok !eval { $eval->eval('${"x"}') }, 'Unable to use undeclared variable';
+ like $@, qr/Can't use string .* as a SCALAR ref/,
+ 'Correct message in $@';
}
-is_deeply(
- $eval->hints->{q{$^H}}, \$strictures_hints,
+is(
+ ${$eval->hints->{q{$^H}}}, $strictures_hints,
'Hints are set per strictures'
);
+is(
+ (unpack "H*", ${$eval->hints->{q{${^WARNING_BITS}}}}),
+ (unpack "H*", $strictures_warn),
+ 'Warning bits are set per strictures'
+);
+
is_deeply(
$eval->lexicals, { },
'Lexical not stored'