From: Shawn M Moore Date: Sun, 9 Nov 2008 06:27:31 +0000 (+0000) Subject: method tests X-Git-Tag: 0.05~89 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=dbb3fea28a809175c56782fac1f86f2f5ccdaded;p=gitmo%2FMooseX-Role-Parameterized.git method tests --- diff --git a/t/002-role-block.t b/t/002-role-block.t index e417880..9c9639d 100644 --- a/t/002-role-block.t +++ b/t/002-role-block.t @@ -1,7 +1,7 @@ #!/usr/bin/env perl use strict; use warnings; -use Test::More tests => 5; +use Test::More tests => 7; use Test::Exception; my ($parameters, %args); @@ -23,6 +23,11 @@ do { is => 'ro', default => $parameters->default_age, ); + + method birthday => sub { + my $self = shift; + return 2000 - $self->age; + }; }; }; @@ -40,3 +45,6 @@ is($args{operating_on}, $role, "we pass in the role metaclass that we're operati my $age_attr = $role->get_attribute('age'); is($age_attr->{default}, 7, "role's age attribute has the right default"); +my $birthday_method = $role->get_method('birthday'); +is($birthday_method->name, 'birthday', "method name"); +is($birthday_method->package_name, 'MyPerson', "package name");