use strict;
use warnings;
-use Test::More tests => 18;
+use Test::More tests => 21;
use Test::Exception;
BEGIN {
isa_ok($p, 'Moose::Meta::TypeConstraint::Union');
isa_ok($p, 'Moose::Meta::TypeConstraint');
- is($p->name, 'ArrayRef | HashRef', '... parent name is correct');
+ is($p->name, 'ArrayRef|HashRef', '... parent name is correct');
ok($t->check([]), '... validated it correctly');
- 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'
+ subtype 'MyCollectionsExtended'
+ => as 'ArrayRef|HashRef'
=> where {
if (ref($_) eq 'ARRAY') {
return if scalar(@$_) < 2;
}
elsif (ref($_) eq 'HASH') {
- return if scalar(keys(%$_)) < 2;
+ return if scalar(keys(%$_)) < 2;
}
1;
};
isa_ok($p, 'Moose::Meta::TypeConstraint::Union');
isa_ok($p, 'Moose::Meta::TypeConstraint');
- is($p->name, 'ArrayRef | HashRef', '... parent name is correct');
+ 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, 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');
}