4 use Test::More tests=>6;
9 package Test::MooseX::Meta::TypeConstraint::Structured::Positional;
12 use Moose::Util::TypeConstraints;
13 use MooseX::Meta::TypeConstraint::Structured;
17 return MooseX::Meta::TypeConstraint::Structured->new(
19 parent => find_type_constraint('ArrayRef'),
20 package_defined_in => __PACKAGE__,
21 signature => [map {find_type_constraint($_)} @$args],
25 has 'tuple' => (is=>'rw', isa=>Tuple['Int', 'Str']);
28 ## Instantiate a new test object
30 ok my $record = Test::MooseX::Meta::TypeConstraint::Structured::Positional->new
31 => 'Instantiated new Record test class.';
33 isa_ok $record => 'Test::MooseX::Meta::TypeConstraint::Structured::Positional'
34 => 'Created correct object type.';
37 $record->tuple([1,'hello']);
38 } => 'Set tuple attribute without error';
40 is $record->tuple->[0], 1
41 => 'correct set the tuple attribute index 0';
43 is $record->tuple->[1], 'hello'
44 => 'correct set the tuple attribute index 1';
47 $record->tuple(['asdasd',2]);
48 }, qr/Validation failed for 'Int'/
49 => 'Got Expected Error for violating constraints';