X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Flib%2FTest%2FMouse.pm;h=e654cdf808c125cf398cb96270a13386e3dd87ec;hb=4060c871da12ba3c5e88986ed121a8254f906bd6;hp=c166c7ba95a636e2fef3f56f72e8cc4f78f1ff8c;hpb=b88483474b62665f14e3a3663be5bba38292a2d6;p=gitmo%2FMouse.git diff --git a/t/lib/Test/Mouse.pm b/t/lib/Test/Mouse.pm index c166c7b..e654cdf 100644 --- a/t/lib/Test/Mouse.pm +++ b/t/lib/Test/Mouse.pm @@ -30,7 +30,7 @@ sub does_ok ($$;$) { } $message ||= "The object does $does"; - if (does_ok($class_or_obj)) { + if (does_role($class_or_obj, $does)) { return __PACKAGE__->builder->ok(1, $message) } else { @@ -53,6 +53,47 @@ sub has_attribute_ok ($$;$) { } } +# Moose compatible methods/functions + +package Mouse::Meta::Module; + +sub version { no strict 'refs'; ${shift->name.'::VERSION'} } +sub authority { no strict 'refs'; ${shift->name.'::AUTHORITY'} } +sub identifier { + my $self = shift; + return join '-' => ( + $self->name, + ($self->version || ()), + ($self->authority || ()), + ); +} + + +package Mouse::Util::TypeConstraints; + +use Mouse::Util::TypeConstraints (); + +sub export_type_constraints_as_functions { # TEST ONLY + my $into = caller; + + foreach my $type( list_all_type_constraints() ) { + my $tc = find_type_constraint($type)->_compiled_type_constraint; + my $as = $into . '::' . $type; + + no strict 'refs'; + *{$as} = sub{ &{$tc} || undef }; + } + return; +} + +package Mouse::Meta::Attribute; + +sub applied_traits{ $_[0]->{traits} } # TEST ONLY +sub has_applied_traits{ exists $_[0]->{traits} } # TEST ONLY + +sub has_documentation{ exists $_[0]->{documentation} } # TEST ONLY +sub documentation{ $_[0]->{documentation} } # TEST ONLY + 1; __END__