X-Git-Url: http://git.vpit.fr/?p=perl%2Fmodules%2FLexical-Types.git;a=blobdiff_plain;f=t%2F16-scope.t;h=6d78ec1a3615529457de06dc92f0a6664d0e7d34;hp=712bec2c81da136294d55297ea353c77bf301bd4;hb=158a53a77c240a1fed59318ecacb5bb20eb11f1d;hpb=9b691511575ef55976d9640d65c007f1c6febe86 diff --git a/t/16-scope.t b/t/16-scope.t index 712bec2..6d78ec1 100644 --- a/t/16-scope.t +++ b/t/16-scope.t @@ -3,7 +3,7 @@ use strict; use warnings; -use Test::More tests => (1 + 2) + (1 + 4); +use Test::More tests => (1 + 2) + (1 + 4) + (3 + 3); sub Int::TYPEDSCALAR { join ':', (caller 0)[1, 2] } @@ -20,3 +20,28 @@ use lib 't/lib'; eval 'use Lexical::Types; use Lexical::Types::TestRequired2'; is $@, '', 'second require test didn\'t croak prematurely'; } + +{ + my (@decls, @w); + sub cb3 { push @decls, $_[0]; @_ } + { + no strict 'refs'; + *{"Int3$_\::TYPEDSCALAR"} = \&Int::TYPEDSCALAR for qw/X Y Z/; + } + local $SIG{__WARN__} = sub { push @w, join '', 'warn:', @_ }; + eval <<' TESTREQUIRED3'; + { + package Lexical::Types::TestRequired3Z; + use Lexical::Types as => \&main::cb3; + use Lexical::Types::TestRequired3X; + use Lexical::Types::TestRequired3Y; + my Int3Z $z; + ::is($z, __FILE__.':6', 'pragma in use at the end'); + } + TESTREQUIRED3 + @w = grep !/^warn:Attempt\s+to\s+free\s+unreferenced/, @w if $] <= 5.008003; + is $@, '', 'third require test didn\'t croak prematurely'; + is_deeply \@w, [ ], 'third require test didn\'t warn'; + is_deeply \@decls, [ map "Int3$_", qw/X Z/ ], + 'third require test propagated in the right scopes'; +}