[Moose-commits] r7439 - MooseX-Role-Parameterized/trunk/t
sartak at code2.0beta.co.uk
sartak at code2.0beta.co.uk
Sat Jan 31 04:20:25 GMT 2009
Author: sartak
Date: 2009-01-30 20:20:25 -0800 (Fri, 30 Jan 2009)
New Revision: 7439
Modified:
MooseX-Role-Parameterized/trunk/t/003-apply.t
Log:
Basic tests for the consumer argument being passed
Modified: MooseX-Role-Parameterized/trunk/t/003-apply.t
===================================================================
--- MooseX-Role-Parameterized/trunk/t/003-apply.t 2009-01-31 03:42:59 UTC (rev 7438)
+++ MooseX-Role-Parameterized/trunk/t/003-apply.t 2009-01-31 04:20:25 UTC (rev 7439)
@@ -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 @@
role {
my $p = shift;
+ %args = @_;
+
my $format = $p->format;
my ($freezer, $thawer);
@@ -63,6 +66,8 @@
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 @@
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 @@
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 @@
};
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 @@
};
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;
More information about the Moose-commits
mailing list