From: Florian Ragwitz Date: Tue, 3 Feb 2009 18:27:32 +0000 (+0000) Subject: Add test for adding accessors more than once. X-Git-Tag: 0.00800~5 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=gitmo%2FMooseX-Emulate-Class-Accessor-Fast.git;a=commitdiff_plain;h=7869e2be6e0b6c670fa3ef9bccf3e5703c969051 Add test for adding accessors more than once. --- diff --git a/t/double_apply.t b/t/double_apply.t new file mode 100644 index 0000000..ae520f5 --- /dev/null +++ b/t/double_apply.t @@ -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'; +