use strict;
use warnings;
-use Test::More no_plan => 1;
+use Test::More tests => 11;
BEGIN {
use_ok('MooseX::Storage');
}
+=pod
+
+This extends the 001_basic test to
+show that subtypes will DWIM in most
+cases.
+
+=cut
+
{
package Foo;
use Scalar::Util 'looks_like_number';
- with Storage();
+ with Storage;
subtype 'Natural'
=> as 'Int'
is_deeply(
$foo->pack,
{
- __class__ => 'Foo',
+ __CLASS__ => 'Foo',
number => 10,
string => 'foo',
float => 10.5,
array => [ 1 .. 10 ],
hash => { map { $_ => undef } ( 1 .. 10 ) },
object => {
- __class__ => 'Foo',
+ __CLASS__ => 'Foo',
number => 2
},
},
{
my $foo = Foo->unpack(
{
- __class__ => 'Foo',
+ __CLASS__ => 'Foo',
number => 10,
string => 'foo',
float => 10.5,
array => [ 1 .. 10 ],
hash => { map { $_ => undef } ( 1 .. 10 ) },
object => {
- __class__ => 'Foo',
+ __CLASS__ => 'Foo',
number => 2
},
}