Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

38 lines (23 sloc) 0.709 kb
#!/usr/bin/perl
use strict;
use warnings;
use lib 't/lib';
use GenErrorRegex qw< badval_error >;
use Test::More;
use Test::Exception;
{ package Foo::Bar; sub new { bless {}, __PACKAGE__; } }
SKIP:
{
eval { require Moose } or skip "Moose required for testing Moose roles", 2;
require MooseRoleTest;
use Method::Signatures;
my $moose = WithMooseRole->new;
my $foobar = Foo::Bar->new;
func moosey (MooseRole $foo) {}
# positive test
lives_ok { moosey($moose) } 'Moose role passes okay';
# negative test
throws_ok { moosey($foobar) } badval_error(undef, foo => MooseRole => $foobar, 'moosey'),
'Moose role fails when appropriate';
}
done_testing;
Jump to Line
Something went wrong with that request. Please try again.