]> git.vpit.fr Git - perl/modules/Lexical-Types.git/blob - t/22-scalar-constants.t
Remove a now useless SKIP directive
[perl/modules/Lexical-Types.git] / t / 22-scalar-constants.t
1 #!perl -T
2
3 use strict;
4 use warnings;
5
6 use Test::More tests => 6;
7
8 use constant Str => 'MyTypes::Str';
9 use constant Int => 'MyTypes::Int';
10 use constant Num => 'MyTypes::Num';
11
12 sub MyTypes::Str::new { "str:$_[0]" }
13
14 sub MyTypes::Int::new { "int:$_[0]" }
15
16 { package MyTypes::Num }
17
18 {
19  use Lexical::Types as => sub { $_[0] =~ /(?:Str|Int)/ ? ($_[0], 'new') : () };
20
21  my Str $x;
22  is $x, "str:MyTypes::Str", 'my constant_type $x';
23
24  my Int ($y, $z);
25  is $y, "int:MyTypes::Int", 'my constant_type ($y,';
26  is $z, "int:MyTypes::Int", 'my constant_type  $z)';
27
28  my Num $t;
29  is $t, undef, 'my constant_type_skipped $t';
30
31  my MyTypes::Str $u;
32  is $u, "str:MyTypes::Str", 'my MyTypes::Str $u';
33
34  my MyTypes::Num $v;
35  is $v, undef, 'my MyTypes::Num $v';
36 }