From: Tomas Doran (t0m) Date: Thu, 28 May 2009 17:32:51 +0000 (+0100) Subject: Add a failing test for behavior if you have a local BUILD method in your class X-Git-Tag: 0.00900~5 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=gitmo%2FMooseX-Emulate-Class-Accessor-Fast.git;a=commitdiff_plain;h=e28467cf29962234a570f8e2553319e659090c6b Add a failing test for behavior if you have a local BUILD method in your class --- diff --git a/t/BUILD_in_local_class.t b/t/BUILD_in_local_class.t new file mode 100644 index 0000000..ceebd5d --- /dev/null +++ b/t/BUILD_in_local_class.t @@ -0,0 +1,19 @@ +{ + package My::Class; + use Moose; + use namespace::clean -except => 'meta'; + + with 'MooseX::Emulate::Class::Accessor::Fast'; + + sub BUILD { + my ($self, $args) = @_; + return $self; + } + + __PACKAGE__->meta->make_immutable; +} + +use Test::More tests => 1; +my $i = My::Class->new(totally_random_not_an_attribute => 1); +is $i->{totally_random_not_an_attribute}, 1, 'Unknown attrs get into hash'; +