X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F003-apply.t;h=925dc2b9ee54dfe3a077b6ec8704b52a09ebc5cd;hb=d55c88619b6587f64fb0d0b76d44d3c3b12266d7;hp=6b3d81e4d30beccc75fdb27e55aa40ae294a479f;hpb=09156b037c16c627ef409299d31e1b1031d94bb0;p=gitmo%2FMooseX-Role-Parameterized.git diff --git a/t/003-apply.t b/t/003-apply.t index 6b3d81e..925dc2b 100644 --- a/t/003-apply.t +++ b/t/003-apply.t @@ -1,7 +1,7 @@ #!/usr/bin/env perl use strict; use warnings; -use Test::More tests => 14; +use Test::More tests => 15; use Test::Exception; do { @@ -55,12 +55,6 @@ do { }; }; -throws_ok { - package MyClass::Error; - use Moose; - with 'MyRole::Storage'; -} qr/^Attribute \(format\) is required/; - do { package MyClass::Dumper; use Moose; @@ -70,7 +64,7 @@ do { }; can_ok('MyClass::Dumper' => qw(freeze_Dumper thaw_Dumper)); -cant_ok('MyClass::Storable' => qw(freeze_Storable thaw_Storable)); +cant_ok('MyClass::Dumper' => qw(freeze_Storable thaw_Storable)); do { package MyClass::Storable; @@ -119,6 +113,20 @@ do { can_ok('MyClass::Three' => qw(freeze_Dumper freeze_Storable thaw_Dumper thaw_Storable store dump)); +throws_ok { + package MyClass::Error::Required; + use Moose; + with 'MyRole::Storage'; +} qr/^Attribute \(format\) is required/; + +throws_ok { + package MyClass::Error::Invalid; + use Moose; + with 'MyRole::Storage' => { + format => 'YAML', + }; +} qr/^Attribute \(format\) does not pass the type constraint/; + sub cant_ok { local $Test::Builder::Level = $Test::Builder::Level + 1; my $instance = shift;