use strict;
use warnings;
-use Test::More tests => 8;
+use Test::More tests => 10;
use Test::Exception;
{
has leg_count => (
is => 'rw',
isa => 'NaturalLessThanTen',
+ lazy => 1,
+ default => 0,
+
);
+
}
lives_ok { my $goat = Animal->new(leg_count => 4) } '... no errors thrown, value is good';
qr/This number \(16\) is not less than ten!/,
"gave custom subtype error message on set_value";
+# try the lazy legs
+my $gimp;
+lives_ok { my $gimp = Animal->new() } '... no errors thrown, value is good';
+throws_ok { $gimp->leg_count }
+ qr/This number \(0\) is not less than ten!/,
+ "gave custom supertype error message on set_value";
+