]> git.vpit.fr Git - perl/modules/Lexical-Types.git/blobdiff - t/13-padsv.t
Push the t/1* tests to make room for t/10-base.t
[perl/modules/Lexical-Types.git] / t / 13-padsv.t
diff --git a/t/13-padsv.t b/t/13-padsv.t
new file mode 100644 (file)
index 0000000..8061e90
--- /dev/null
@@ -0,0 +1,44 @@
+#!perl -T
+
+use strict;
+use warnings;
+
+use Test::More tests => 7;
+
+sub Str::TYPEDSCALAR {
+ my $buf = (caller(0))[2];
+ open $_[1], '<', \$buf;
+ ()
+}
+
+{
+ use Lexical::Types;
+
+ 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 $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';
+}