-#!/usr/bin/perl\r
-\r
-use strict;\r
-use warnings;\r
-\r
-use Test::More tests => 19;\r
-use Test::Exception;\r
-\r
-BEGIN {\r
- use_ok("Mouse::Util::TypeConstraints");\r
-}\r
-\r
-lives_ok {\r
- subtype 'MyCollections' => as 'ArrayRef | HashRef';\r
-} '... created the subtype special okay';\r
-\r
-{\r
- my $t = find_type_constraint('MyCollections');\r
- isa_ok($t, 'Mouse::Meta::TypeConstraint');\r
-\r
- is($t->name, 'MyCollections', '... name is correct');\r
-\r
- my $p = $t->parent;\r
-# isa_ok($p, 'Mouse::Meta::TypeConstraint::Union');\r
- isa_ok($p, 'Mouse::Meta::TypeConstraint');\r
-\r
- is($p->name, 'ArrayRef|HashRef', '... parent name is correct');\r
-\r
- ok($t->check([]), '... validated it correctly');\r
- ok($t->check({}), '... validated it correctly');\r
- ok(!$t->check(1), '... validated it correctly');\r
-}\r
-\r
-lives_ok {\r
- subtype 'MyCollectionsExtended'\r
- => as 'ArrayRef|HashRef'\r
- => where {\r
- if (ref($_) eq 'ARRAY') {\r
- return if scalar(@$_) < 2;\r
- }\r
- elsif (ref($_) eq 'HASH') {\r
- return if scalar(keys(%$_)) < 2;\r
- }\r
- 1;\r
- };\r
-} '... created the subtype special okay';\r
-\r
-{\r
- my $t = find_type_constraint('MyCollectionsExtended');\r
- isa_ok($t, 'Mouse::Meta::TypeConstraint');\r
-\r
- is($t->name, 'MyCollectionsExtended', '... name is correct');\r
-\r
- my $p = $t->parent;\r
-# isa_ok($p, 'Mouse::Meta::TypeConstraint::Union');\r
- isa_ok($p, 'Mouse::Meta::TypeConstraint');\r
-\r
- is($p->name, 'ArrayRef|HashRef', '... parent name is correct');\r
-\r
- ok(!$t->check([]), '... validated it correctly');\r
- ok($t->check([1, 2]), '... validated it correctly');\r
-\r
- ok(!$t->check({}), '... validated it correctly');\r
- ok($t->check({ one => 1, two => 2 }), '... validated it correctly');\r
-\r
- ok(!$t->check(1), '... validated it correctly');\r
-}\r
-\r
-\r
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+use Test::More tests => 19;
+use Test::Exception;
+
+BEGIN {
+ use_ok("Mouse::Util::TypeConstraints");
+}
+
+lives_ok {
+ subtype 'MyCollections' => as 'ArrayRef | HashRef';
+} '... created the subtype special okay';
+
+{
+ my $t = find_type_constraint('MyCollections');
+ isa_ok($t, 'Mouse::Meta::TypeConstraint');
+
+ is($t->name, 'MyCollections', '... name is correct');
+
+ my $p = $t->parent;
+# isa_ok($p, 'Mouse::Meta::TypeConstraint::Union');
+ isa_ok($p, 'Mouse::Meta::TypeConstraint');
+
+ is($p->name, 'ArrayRef|HashRef', '... parent name is correct');
+
+ ok($t->check([]), '... validated it correctly');
+ ok($t->check({}), '... validated it correctly');
+ ok(!$t->check(1), '... validated it correctly');
+}
+
+lives_ok {
+ subtype 'MyCollectionsExtended'
+ => as 'ArrayRef|HashRef'
+ => where {
+ if (ref($_) eq 'ARRAY') {
+ return if scalar(@$_) < 2;
+ }
+ elsif (ref($_) eq 'HASH') {
+ return if scalar(keys(%$_)) < 2;
+ }
+ 1;
+ };
+} '... created the subtype special okay';
+
+{
+ my $t = find_type_constraint('MyCollectionsExtended');
+ isa_ok($t, 'Mouse::Meta::TypeConstraint');
+
+ is($t->name, 'MyCollectionsExtended', '... name is correct');
+
+ my $p = $t->parent;
+# isa_ok($p, 'Mouse::Meta::TypeConstraint::Union');
+ isa_ok($p, 'Mouse::Meta::TypeConstraint');
+
+ is($p->name, 'ArrayRef|HashRef', '... parent name is correct');
+
+ ok(!$t->check([]), '... validated it correctly');
+ ok($t->check([1, 2]), '... validated it correctly');
+
+ ok(!$t->check({}), '... validated it correctly');
+ ok($t->check({ one => 1, two => 2 }), '... validated it correctly');
+
+ ok(!$t->check(1), '... validated it correctly');
+}
+
+