Created
June 16, 2010 13:31
-
-
Save j1n3l0/440683 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use Modern::Perl; | |
use Test::Most; | |
{ | |
package Foo; | |
use Moose; | |
has bar => ( is => 'rw', isa => 'Object' ); | |
} | |
lives_ok { Foo->new( bar => Foo->new() ) } 'accepts objects'; | |
for my $thing ( ['arrayref'], { hash => 'ref' }, \'string_ref', 'string', 1 ) | |
{ | |
dies_ok { Foo->new( bar => $thing ) } | |
'does not accept ' . ( ref $thing || 'scalars' ); | |
} | |
done_testing(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment