From: Graham Knop Date: Fri, 13 Jun 2014 11:21:06 +0000 (-0400) Subject: use our own pragma for hints hash test X-Git-Tag: v1.003000~9 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=9661a07cde22f93b638636322a668c07b597c665;p=p5sagit%2FEval-WithLexicals.git use our own pragma for hints hash test --- diff --git a/t/hints.t b/t/hints.t index f5681b3..1e101b5 100644 --- a/t/hints.t +++ b/t/hints.t @@ -10,6 +10,7 @@ use strictures 1; use Test::More; use Eval::WithLexicals; +use lib 't/lib'; my $eval = Eval::WithLexicals->with_plugins("HintPersistence")->new(prelude => ''); @@ -44,13 +45,12 @@ is_deeply( ); # Assumption about perl internals: sort pragma will set a key in %^H. - -$eval->eval(q{ { use sort 'stable' } }), -ok !exists $eval->hints->{q{%^H}}->{sort}, +$eval->eval(q{ { use hint_hash_pragma 'param' } }), +ok !exists $eval->hints->{q{%^H}}->{hint_hash_pragma}, "Lexical pragma used below main scope not captured"; -$eval->eval(q{ use sort 'stable' }), -ok exists $eval->hints->{q{%^H}}->{sort}, +$eval->eval(q{ use hint_hash_pragma 'param' }), +is $eval->hints->{q{%^H}}->{hint_hash_pragma}, 'param', "Lexical pragma captured"; done_testing; diff --git a/t/lib/hint_hash_pragma.pm b/t/lib/hint_hash_pragma.pm new file mode 100644 index 0000000..98dcf6c --- /dev/null +++ b/t/lib/hint_hash_pragma.pm @@ -0,0 +1,10 @@ +package hint_hash_pragma; +use strictures 1; + +sub import { + my ($class, $val) = @_; + $^H |= 0x20000; + $^H{hint_hash_pragma} = $val; +} + +1;