From: Graham Knop Date: Tue, 4 Mar 2014 02:45:44 +0000 (-0500) Subject: testing for methods_provided_by X-Git-Tag: v1.003003~9 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=gitmo%2FRole-Tiny.git;a=commitdiff_plain;h=eb2145fc4f892add7d3f920b984cc711b61e2f67 testing for methods_provided_by --- diff --git a/t/concrete-methods.t b/t/concrete-methods.t index 6e7a695..4fc0601 100644 --- a/t/concrete-methods.t +++ b/t/concrete-methods.t @@ -27,8 +27,16 @@ my $role_methods = Role::Tiny->_concrete_methods_of('MyRole1'); is_deeply([sort keys %$role_methods], ['after_role'], 'only subs after Role::Tiny import are methods' ); +my @role_method_list = Role::Tiny->methods_provided_by('MyRole1'); +is_deeply(\@role_method_list, ['after_role'], + 'methods_provided_by gives method list' ); + my $class_methods = Role::Tiny->_concrete_methods_of('MyClass1'); is_deeply([sort keys %$class_methods], ['method'], 'only subs from non-Role::Tiny packages are methods' ); +like exception { Role::Tiny->methods_provided_by('MyClass1') }, + qr/is not a Role::Tiny/, + 'methods_provided_by refuses to work on classes'; + done_testing;