From: Jesse Luehrs Date: Sun, 19 Jun 2011 06:52:07 +0000 (-0500) Subject: tests and changelog X-Git-Tag: 2.0009~10 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=ba6e30c6c597e41bcf567206586159c4edae1cd4;p=gitmo%2FMoose.git tests and changelog --- diff --git a/Changes b/Changes index 7ab0826..aacab50 100644 --- a/Changes +++ b/Changes @@ -11,6 +11,11 @@ for, noteworthy changes. * Moose::Util::apply_all_roles now works even if the applicant is a non-Moose class. (perigrin) + [OTHER] + + * Better error message if Moose->init_meta is called with a 'metaclass' + option when that metaclass hasn't been loaded. (jasonmay) + 2.0008 Thu, Jun 16, 2011 [BUG FIXES] diff --git a/t/metaclasses/moose_exporter.t b/t/metaclasses/moose_exporter.t index 3635a8b..66a0f30 100644 --- a/t/metaclasses/moose_exporter.t +++ b/t/metaclasses/moose_exporter.t @@ -416,4 +416,46 @@ use Test::Requires { for qw( with_meta1 with_meta2 with_caller1 with_caller2 as_is1 ); } +{ + package InitMetaError; + use Moose::Exporter; + use Moose (); + Moose::Exporter->setup_import_methods(also => ['Moose']); + sub init_meta { + my $package = shift; + my %options = @_; + Moose->init_meta(%options, metaclass => 'Not::Loaded'); + } +} + +{ + package InitMetaError::Role; + use Moose::Exporter; + use Moose::Role (); + Moose::Exporter->setup_import_methods(also => ['Moose::Role']); + sub init_meta { + my $package = shift; + my %options = @_; + Moose::Role->init_meta(%options, metaclass => 'Not::Loaded'); + } +} + +{ + package WantsInvalidMetaclass; + ::like( + ::exception { InitMetaError->import }, + qr/The Metaclass Not::Loaded must be loaded\. \(Perhaps you forgot to 'use Not::Loaded'\?\)/, + "error when wanting a nonexistent metaclass" + ); +} + +{ + package WantsInvalidMetaclass::Role; + ::like( + ::exception { InitMetaError::Role->import }, + qr/The Metaclass Not::Loaded must be loaded\. \(Perhaps you forgot to 'use Not::Loaded'\?\)/, + "error when wanting a nonexistent metaclass" + ); +} + done_testing;