Skip to content

Commit

Permalink
Add test for adding accessors more than once.
Browse files Browse the repository at this point in the history
  • Loading branch information
rafl committed Feb 3, 2009
1 parent d4e8b9b commit 7869e2b
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions t/double_apply.t
Original file line number Diff line number Diff line change
@@ -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';

0 comments on commit 7869e2b

Please sign in to comment.