From: Florian Ragwitz Date: Tue, 3 Feb 2009 18:27:22 +0000 (+0000) Subject: Add failing test for Class::Accessor::Chained::Fast compatibility. X-Git-Tag: 0.00800~6 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=d4e8b9b22a23ed4d6adcda7f1a82d28ab9e2bce2;p=gitmo%2FMooseX-Emulate-Class-Accessor-Fast.git Add failing test for Class::Accessor::Chained::Fast compatibility. --- diff --git a/t/class_accessor_chained_fast.t b/t/class_accessor_chained_fast.t new file mode 100644 index 0000000..8d5f265 --- /dev/null +++ b/t/class_accessor_chained_fast.t @@ -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.'); +}