6 use Test::More no_plan => 1;
9 use_ok('MooseX::Storage');
16 use Moose::Util::TypeConstraints;
19 use Scalar::Util 'looks_like_number';
29 => where { "$_" =~ /\.5$/ };
33 => where { lc($_) eq 'foo' };
37 => where { scalar grep { looks_like_number($_) } @{$_} };
41 => where { scalar grep { !defined($_) } values %{$_} };
43 has 'number' => ( is => 'ro', isa => 'Natural' );
44 has 'string' => ( is => 'ro', isa => 'FooString' );
45 has 'float' => ( is => 'ro', isa => 'HalfNum' );
46 has 'array' => ( is => 'ro', isa => 'IntArray' );
47 has 'hash' => ( is => 'ro', isa => 'UndefHash' );
48 has 'object' => ( is => 'ro', isa => 'Foo' );
57 hash => { map { $_ => undef } ( 1 .. 10 ) },
58 object => Foo->new( number => 2 ),
60 isa_ok( $foo, 'Foo' );
70 hash => { map { $_ => undef } ( 1 .. 10 ) },
76 '... got the right frozen class'
81 my $foo = Foo->unpack(
88 hash => { map { $_ => undef } ( 1 .. 10 ) },
95 isa_ok( $foo, 'Foo' );
97 is( $foo->number, 10, '... got the right number' );
98 is( $foo->string, 'foo', '... got the right string' );
99 is( $foo->float, 10.5, '... got the right float' );
100 is_deeply( $foo->array, [ 1 .. 10 ], '... got the right array' );
103 { map { $_ => undef } ( 1 .. 10 ) },
104 '... got the right hash'
107 isa_ok( $foo->object, 'Foo' );
108 is( $foo->object->number, 2,
109 '... got the right number (in the embedded object)' );