-use Test::More tests => 62;
+use Test::More tests => 98;
use strict;
use warnings;
use lib 't/lib';
my $name = 'multiple1';
my $alias = "_${name}_accessor";
- for my $meth ($name, $alias) {
- my $cv = svref_2object( $obj->can($meth) );
- is($cv->GV->NAME, $meth, "$meth accessor is named");
- is($cv->GV->STASH->NAME, 'AccessorGroups', "$meth class correct");
- }
-
my $warned = 0;
local $SIG{__WARN__} = sub {
if (shift =~ /DESTROY/i) {
ok($warned);
};
-
my $obj = AccessorGroupsSubclass->new;
my $test_accessors = {
},
};
-
for my $name (sort keys %$test_accessors) {
my $alias = "_${name}_accessor";
my $field = $test_accessors->{$name}{custom_field} || $name;
ok(!$obj->can($field))
if $field ne $name;
+ for my $meth ($name, $alias) {
+ my $cv = svref_2object( $obj->can($meth) );
+ is($cv->GV->NAME, $meth, "$meth accessor is named");
+ is($cv->GV->STASH->NAME, 'AccessorGroups', "$meth class correct");
+ }
+
is($obj->$name, undef);
is($obj->$alias, undef);
# alias gets same as name
is($obj->$name, 'b');
+
+ for my $meth ($name, $alias) {
+ my $cv = svref_2object( $obj->can($meth) );
+ is($cv->GV->NAME, $meth, "$meth accessor is named after operations");
+ is($cv->GV->STASH->NAME, 'AccessorGroups', "$meth class correct after operations");
+ }
};
# important