#!perl -T
use strict;
use Test::More tests => 2;
{
package Foo;
use Moo;
use aliased 'DateTime' => 'DT';
has foo => (
is => 'rw',
isa => DateTime,
default => sub { DT->today }
);
}
lives_ok
{ Foo->new(foo => DateTime->now) }
'accepted DateTime->now';
throws_ok
{ Foo->new(foo => 'bar') }
qr/a DateTime object/,
'does not accept strings';