4 use warnings FATAL => 'all';
6 use lib __DIR__ . '/lib';
14 eval { require Moose } or skip "Moose required for testing Moose types", 1;
16 require MooseLoadTest;
18 my $foobar = Foo::Bar->new;
20 # can't check for type module not being loaded here, because Moose will drag it in
23 $foobar->check_int(42);
25 # now we should have loaded Moose to do our type checking
27 like $INC{'Moose/Util/TypeConstraints.pm'}, qr{Moose/Util/TypeConstraints\.pm$}, 'loaded Moose';
30 # tests for ScalarRef[X] have to live here, because they only work with Moose
32 my $method = 'check_paramized_sref';
33 my $bad_ref = \'thing';
34 is exception { $foobar->$method(\42) }, undef, 'call with good value for paramized_sref passes';
35 like exception { $foobar->$method($bad_ref) },
36 qr/\bcheck_paramized_sref\b.+\$bar\b.+ScalarRef\[Num\]/,
37 'call with bad value for paramized_sref dies';