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