From: Vincent Pit Date: Thu, 26 Feb 2009 16:32:01 +0000 (+0100) Subject: Test "my Str ($x, $y)" X-Git-Tag: v0.03~12 X-Git-Url: http://git.vpit.fr/?p=perl%2Fmodules%2FLexical-Types.git;a=commitdiff_plain;h=5d3e8553645b9d731fd7b0aaf0151ae588adca87 Test "my Str ($x, $y)" --- diff --git a/t/12-padsv.t b/t/12-padsv.t index 3c06df3..8061e90 100644 --- a/t/12-padsv.t +++ b/t/12-padsv.t @@ -3,7 +3,7 @@ use strict; use warnings; -use Test::More tests => 3; +use Test::More tests => 7; sub Str::TYPEDSCALAR { my $buf = (caller(0))[2]; @@ -11,15 +11,34 @@ sub Str::TYPEDSCALAR { () } -use Lexical::Types; +{ + use Lexical::Types; -my Str $x; -our $r = <$x>; -is $r, __LINE__-2, 'trick for our - readline'; + my Str $x; + our $r = <$x>; + is $r, __LINE__-2, 'trick for our - readline'; -my Str $y; -my $s = <$y>; -is $s, __LINE__-2, 'trick for my - readline'; + my Str $y; + my $s = <$y>; + is $s, __LINE__-2, 'trick for my - readline'; -my $z = 7; -is $z, 7, 'trick for others'; + my $z = 7; + is $z, 7, 'trick for others'; +} + +my $count; +sub Int::TYPEDSCALAR { return ++$count } + +{ package INT; } + +{ + use Lexical::Types as => sub { $_[0] eq 'Int' ? @_ : () }; + + my Int ($x, $y); + is $x, 1, 'successive padany 1'; + is $y, 2, 'successive padany 2'; + + my INT ($z, $t); + is $z, undef, 'successive padany 3'; + is $t, undef, 'successive padany 4'; +}