Skip to content

Instantly share code, notes, and snippets.

@j1n3l0
Created June 16, 2010 13:31
Show Gist options
  • Save j1n3l0/440683 to your computer and use it in GitHub Desktop.
Save j1n3l0/440683 to your computer and use it in GitHub Desktop.
#!/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