return $self->SUPER::get_message(@_);
}
+ return $self->SUPER::get_message($value) unless blessed($value);
+
my @methods = grep { !$value->can($_) } @{ $self->methods };
my $class = blessed $value;
return $class
# try with the other constraint form
is( exception { DucktypeTest->new( other_swan => Swan->new ) }, undef, 'but a Swan can honk' );
+my $re = qr/Validation failed for 'DuckType' with value/;
+
+like( exception { DucktypeTest->new( duck => undef ) }, $re, 'Exception for undef' );
+like( exception { DucktypeTest->new( duck => [] ) }, $re, 'Exception for arrayref' );
+like( exception { DucktypeTest->new( duck => {} ) }, $re, 'Exception for hashref' );
+like( exception { DucktypeTest->new( duck => \'foo' ) }, $re, 'Exception for scalar ref' );
+
done_testing;