[Moose-commits] r7498 - MooseX-Emulate-Class-Accessor-Fast/trunk/t
rafl at code2.0beta.co.uk
rafl at code2.0beta.co.uk
Tue Feb 3 18:27:22 GMT 2009
Author: rafl
Date: 2009-02-03 10:27:22 -0800 (Tue, 03 Feb 2009)
New Revision: 7498
Added:
MooseX-Emulate-Class-Accessor-Fast/trunk/t/class_accessor_chained_fast.t
Log:
Add failing test for Class::Accessor::Chained::Fast compatibility.
Added: MooseX-Emulate-Class-Accessor-Fast/trunk/t/class_accessor_chained_fast.t
===================================================================
--- MooseX-Emulate-Class-Accessor-Fast/trunk/t/class_accessor_chained_fast.t (rev 0)
+++ MooseX-Emulate-Class-Accessor-Fast/trunk/t/class_accessor_chained_fast.t 2009-02-03 18:27:22 UTC (rev 7498)
@@ -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.');
+}
More information about the Moose-commits
mailing list