[Moose-commits] r7227 - in Moose/trunk: lib/Moose/Meta
t/020_attributes
rafl at code2.0beta.co.uk
rafl at code2.0beta.co.uk
Sat Jan 3 05:28:27 GMT 2009
Author: rafl
Date: 2009-01-02 21:28:26 -0800 (Fri, 02 Jan 2009)
New Revision: 7227
Modified:
Moose/trunk/lib/Moose/Meta/Class.pm
Moose/trunk/t/020_attributes/009_attribute_inherited_slot_specs.t
Log:
Mention the offending class when reporting errors when processing inherited attributes.
Also test for it.
Modified: Moose/trunk/lib/Moose/Meta/Class.pm
===================================================================
--- Moose/trunk/lib/Moose/Meta/Class.pm 2009-01-02 20:34:16 UTC (rev 7226)
+++ Moose/trunk/lib/Moose/Meta/Class.pm 2009-01-03 05:28:26 UTC (rev 7227)
@@ -514,7 +514,7 @@
my ($self, $attr_name, %options) = @_;
my $inherited_attr = $self->find_attribute_by_name($attr_name);
(defined $inherited_attr)
- || $self->throw_error("Could not find an attribute by the name of '$attr_name' to inherit from", data => $attr_name);
+ || $self->throw_error("Could not find an attribute by the name of '$attr_name' to inherit from in ${\$self->name}", data => $attr_name);
if ($inherited_attr->isa('Moose::Meta::Attribute')) {
return $inherited_attr->clone_and_inherit_options(%options);
}
Modified: Moose/trunk/t/020_attributes/009_attribute_inherited_slot_specs.t
===================================================================
--- Moose/trunk/t/020_attributes/009_attribute_inherited_slot_specs.t 2009-01-02 20:34:16 UTC (rev 7226)
+++ Moose/trunk/t/020_attributes/009_attribute_inherited_slot_specs.t 2009-01-03 05:28:26 UTC (rev 7227)
@@ -3,7 +3,7 @@
use strict;
use warnings;
-use Test::More tests => 82;
+use Test::More tests => 83;
use Test::Exception;
@@ -100,6 +100,9 @@
::dies_ok {
has '+other_fail' => (weak_ref => 1);
} '... cannot create an attribute with an illegal option';
+ ::throws_ok {
+ has '+does_not_exist' => (isa => 'Str');
+ } qr/in Bar/, '... cannot extend a non-existing attribute';
}
my $foo = Foo->new;
More information about the Moose-commits
mailing list