[Moose-commits] r7499 - MooseX-Emulate-Class-Accessor-Fast/trunk/t
rafl at code2.0beta.co.uk
rafl at code2.0beta.co.uk
Tue Feb 3 18:27:32 GMT 2009
Author: rafl
Date: 2009-02-03 10:27:32 -0800 (Tue, 03 Feb 2009)
New Revision: 7499
Added:
MooseX-Emulate-Class-Accessor-Fast/trunk/t/double_apply.t
Log:
Add test for adding accessors more than once.
Added: MooseX-Emulate-Class-Accessor-Fast/trunk/t/double_apply.t
===================================================================
--- MooseX-Emulate-Class-Accessor-Fast/trunk/t/double_apply.t (rev 0)
+++ MooseX-Emulate-Class-Accessor-Fast/trunk/t/double_apply.t 2009-02-03 18:27:32 UTC (rev 7499)
@@ -0,0 +1,31 @@
+#!perl
+use strict;
+use warnings;
+use Test::More tests => 5;
+use Test::Exception;
+
+# 1
+use_ok('MooseX::Adopt::Class::Accessor::Fast');
+{
+ package My::Package;
+ use base qw/Class::Accessor::Fast/;
+ for (0..1) {
+ __PACKAGE__->mk_accessors(qw( foo ));
+ __PACKAGE__->mk_ro_accessors(qw( bar ));
+ __PACKAGE__->mk_wo_accessors(qw( baz ));
+ }
+}
+
+my $i = bless { bar => 'bar' }, 'My::Package';
+
+# 2
+lives_ok {
+ $i->foo('foo');
+ $i->baz('baz');
+
+ # 3-5
+ is($i->foo, 'foo');
+ is($i->bar, 'bar');
+ is($i->{baz}, 'baz');
+} 'No exception';
+
More information about the Moose-commits
mailing list