X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=t%2F13-padsv.t;h=0509260d821f246df2c8770abec9b0b86e37851d;hb=bf1b09f4ab8df1710df549764d511b110c6cb396;hp=8061e90456cf475a2273c51f5485c06bf7e5a503;hpb=b99618b6940bc947b829ddfdb23b5bb69a2e8e98;p=perl%2Fmodules%2FLexical-Types.git diff --git a/t/13-padsv.t b/t/13-padsv.t index 8061e90..0509260 100644 --- a/t/13-padsv.t +++ b/t/13-padsv.t @@ -3,7 +3,9 @@ use strict; use warnings; -use Test::More tests => 7; +use Config qw<%Config>; + +use Test::More tests => 4; sub Str::TYPEDSCALAR { my $buf = (caller(0))[2]; @@ -26,19 +28,22 @@ sub Str::TYPEDSCALAR { is $z, 7, 'trick for others'; } -my $count; -sub Int::TYPEDSCALAR { return ++$count } +my @lines; -{ package INT; } +sub Int::TYPEDSCALAR { push @lines, (caller(0))[2]; () } -{ - use Lexical::Types as => sub { $_[0] eq 'Int' ? @_ : () }; +SKIP: { + skip 'Broken with threaded perls before 5.8.4' => 1 + if $Config{useithreads} and $] < 5.008004; - my Int ($x, $y); - is $x, 1, 'successive padany 1'; - is $y, 2, 'successive padany 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 ($z, $t); - is $z, undef, 'successive padany 3'; - is $t, undef, 'successive padany 4'; + my Int $x; + is_deeply \@lines, [ 1, __LINE__-1 ], 'hooking inside the \'as\' callback'; }