]> git.vpit.fr Git - perl/modules/Lexical-Types.git/blobdiff - t/12-padsv.t
Test "my Str ($x, $y)"
[perl/modules/Lexical-Types.git] / t / 12-padsv.t
index 3c06df3f9e40513468785a35a639ee97c84cb28a..8061e90456cf475a2273c51f5485c06bf7e5a503 100644 (file)
@@ -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';
+}