Add failing test for Class::Accessor::Chained::Fast compatibility.
Florian Ragwitz [Tue, 3 Feb 2009 18:27:22 +0000 (18:27 +0000)]
t/class_accessor_chained_fast.t [new file with mode: 0644]

diff --git a/t/class_accessor_chained_fast.t b/t/class_accessor_chained_fast.t
new file mode 100644 (file)
index 0000000..8d5f265
--- /dev/null
@@ -0,0 +1,36 @@
+use strict;
+use warnings;
+use Test::More tests => 1;
+use MooseX::Adopt::Class::Accessor::Fast;
+
+{
+  package MyClass::Accessor::Chained::Fast;
+  use strict;
+  use base 'Class::Accessor::Fast';
+
+  sub make_accessor {
+    my($class, $field) = @_;
+
+    return sub {
+      my $self = shift;
+      if(@_) {
+        $self->{$field} = (@_ == 1 ? $_[0] : [@_]);
+        return $self;
+      }
+      return $self->{$field};
+    };
+  }
+}
+
+{
+   package TestPackage;
+   use base qw/MyClass::Accessor::Chained::Fast/;
+   __PACKAGE__->mk_accessors('foo');
+}
+
+my $i = bless {}, 'TestPackage';
+my $other_i = $i->foo('bar');
+TODO: {
+  local $TODO = 'ENOWORKEY';
+  is($other_i, $i, 'Accessor returns instance as opposed to value.');
+}