X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=t%2F13-padsv.t;h=5e5cc3d32d49f8e00c6732ed6fa18630131c91e6;hb=734804692468efc6c22d7faacb206d986f0a355d;hp=e5409bc5ca446f73c728ceae03fb8315c85977de;hpb=ef454c52e92ecd149b3bf0f6e221162cad3955ac;p=perl%2Fmodules%2FLexical-Types.git diff --git a/t/13-padsv.t b/t/13-padsv.t index e5409bc..5e5cc3d 100644 --- a/t/13-padsv.t +++ b/t/13-padsv.t @@ -3,7 +3,7 @@ use strict; use warnings; -use Test::More tests => 3; +use Test::More tests => 4; sub Str::TYPEDSCALAR { my $buf = (caller(0))[2]; @@ -25,3 +25,20 @@ sub Str::TYPEDSCALAR { my $z = 7; is $z, 7, 'trick for others'; } + +my @lines; + +sub Int::TYPEDSCALAR { push @lines, (caller(0))[2]; () } + +{ + use Lexical::Types as => sub { + # In 5.10, this closure is compiled before hints are enabled, so no hintseval + # op is added at compile time to propagate the hints inside the eval. + # That's why we need to re-use Lexical::Types explicitely. + eval 'use Lexical::Types; my Int $x'; + @_; + }; + + my Int $x; + is_deeply \@lines, [ 1, __LINE__-1 ], 'hooking inside the \'as\' callback'; +}