Add a failing test for behavior if you have a local BUILD method in your class
Tomas Doran (t0m) [Thu, 28 May 2009 17:32:51 +0000 (18:32 +0100)]
t/BUILD_in_local_class.t [new file with mode: 0644]

diff --git a/t/BUILD_in_local_class.t b/t/BUILD_in_local_class.t
new file mode 100644 (file)
index 0000000..ceebd5d
--- /dev/null
@@ -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';
+