use Test::More; use Test::Exception; use MooseX::Method::Signature; use strict; use warnings; BEGIN { $MooseX::Method::Signature::Auto::HAS_COMPILED_SIGNATURES = 0 } plan tests => 9; { package TestX::DefaultAttr::Success; use MooseX::Method; use Test::Exception; default_attr (); # lives_ok { method foo => sub {} }; } { package TestX::Exports; use MooseX::Method; use Test::More; use Test::Exception; is_deeply (attr (foo => 1),{ foo => 1 }); isa_ok (positional,'MooseX::Meta::Signature::Positional'); isa_ok (named,'MooseX::Meta::Signature::Named'); isa_ok (combined,'MooseX::Meta::Signature::Combined'); isa_ok (semi,'MooseX::Meta::Signature::Combined'); } { package Foo::Method; use Moose; extends qw/MooseX::Meta::Method::Signature/; } { package Foo; use Moose; use Moose::Util::TypeConstraints; use MooseX::Method; use Test::More; use Test::Exception; # declaration with signature method test2 => positional () => sub { 42 }; can_ok ('Foo','test2'); is (Foo->test2,42); # exceptions method test_exception_mxmethod => positional ( { required => 1 }, ) => sub {}; throws_ok { Foo->test_exception_mxmethod } qr/400_method/; method test_exception_user_plain => positional ( { isa => subtype ('Int',where { die 'Foo' }) }, ) => sub {}; throws_ok { Foo->test_exception_user_plain (42) } qr/Foo/; no MooseX::Method; }