From: Shawn M Moore Date: Sat, 31 Jan 2009 04:20:25 +0000 (+0000) Subject: Basic tests for the consumer argument being passed X-Git-Tag: 0.05~10 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=53a8d814a857a66a118e23fcce0538f40c1d3eae;p=gitmo%2FMooseX-Role-Parameterized.git Basic tests for the consumer argument being passed --- diff --git a/t/003-apply.t b/t/003-apply.t index 43ae9a9..5ec55df 100644 --- a/t/003-apply.t +++ b/t/003-apply.t @@ -1,9 +1,10 @@ #!/usr/bin/env perl use strict; use warnings; -use Test::More tests => 15; +use Test::More tests => 20; use Test::Exception; +my %args; do { package MyRole::Storage; use MooseX::Role::Parameterized; @@ -28,6 +29,8 @@ do { role { my $p = shift; + %args = @_; + my $format = $p->format; my ($freezer, $thawer); @@ -63,6 +66,8 @@ do { can_ok('MyClass::Dumper' => qw(freeze_Dumper thaw_Dumper)); cant_ok('MyClass::Dumper' => qw(freeze_Storable thaw_Storable)); +is($args{consumer}, MyClass::Dumper->meta, 'Role block receives consumer'); + do { package MyClass::Storable; use Moose; @@ -74,6 +79,8 @@ do { can_ok('MyClass::Storable' => qw(freeze_Storable thaw_Storable)); cant_ok('MyClass::Storable' => qw(freeze_Dumper thaw_Dumper)); +is($args{consumer}, MyClass::Storable->meta, 'Role block receives consumer'); + do { package MyClass::DumperRenamed; use Moose; @@ -87,6 +94,8 @@ do { can_ok('MyClass::DumperRenamed' => qw(save load)); cant_ok('MyClass::DumperRenamed' => qw(freeze_Dumper freeze_Storable thaw_Dumper thaw_Storable)); +is($args{consumer}, MyClass::DumperRenamed->meta, 'Role block receives consumer'); + do { package MyClass::Both; use Moose; @@ -95,6 +104,7 @@ do { }; can_ok('MyClass::Both' => qw(freeze_Dumper freeze_Storable thaw_Dumper thaw_Storable)); +is($args{consumer}, MyClass::Both->meta, 'Role block receives consumer'); do { package MyClass::Three; @@ -109,6 +119,7 @@ do { }; can_ok('MyClass::Three' => qw(freeze_Dumper freeze_Storable thaw_Dumper thaw_Storable store dump)); +is($args{consumer}, MyClass::Three->meta, 'Role block receives consumer'); throws_ok { package MyClass::Error::Required;