X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=p5sagit%2FEval-WithLexicals.git;a=blobdiff_plain;f=t%2Fhints.t;h=15db971b7a250c15cb5afa0f29de4e528abfbe3f;hp=88bbec36f6719486a119091c4b334a525f7b695b;hb=a214c345e2de0ddd1e2ab205d942e2b1d7bb47b1;hpb=c97f63974c1d1d0b422306ab24391fd256cbeceb diff --git a/t/hints.t b/t/hints.t index 88bbec3..15db971 100644 --- a/t/hints.t +++ b/t/hints.t @@ -24,8 +24,9 @@ $eval->eval('use strictures 1'); { 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( @@ -53,4 +54,10 @@ $eval->eval(q{ use hint_hash_pragma 'param' }), is $eval->hints->{q{%^H}}->{hint_hash_pragma}, 'param', "Lexical pragma captured"; +$eval->eval('my $x = 1'); +is_deeply( + $eval->lexicals->{'$x'}, \1, + 'Lexical captured when preserving hints', +); + done_testing;