10 if ($_[0] =~ /^Hides field 'b1' in base class/) {
19 use fields qw(b1 b2 b3);
23 use fields qw(b1 _b2 b2);
25 sub new { bless [], shift }
29 use fields qw(d1 d2 d3);
33 use fields qw(_d1 _d2);
38 use fields qw(b1 d1 _b1 _d1); # hide b1
42 use fields qw(_d3 d3);
53 package Foo::Bar::Baz;
55 use fields qw(foo bar baz);
63 for my $k (sort {$h->{$a} <=> $h->{$b}} keys %$h) {
67 my $str = join(",", @tmp);
68 print "$h => $str\n" if $DEBUG;
73 B1 => "b1:1,b2:2,b3:3",
74 B2 => "_b1:1,b1:2,_b2:3,b2:4",
75 D1 => "b1:1,b2:2,b3:3,d1:4,d2:5,d3:6",
76 D2 => "b1:1,b2:2,b3:3,_d1:4,_d2:5,d1:6,d2:7",
77 D3 => "b2:4,b1:5,d1:6,_b1:7,_d1:8",
78 D4 => "b2:4,b1:5,d1:6,_d3:9,d3:10",
80 'Foo::Bar::Baz' => 'b1:1,b2:2,b3:3,foo:4,bar:5,baz:6',
83 print "1..", int(keys %expect)+3, "\n";
85 while (my($class, $exp) = each %expect) {
87 my $fstr = fstr(\%{$class."::FIELDS"});
88 print "EXP: $exp\nGOT: $fstr\nnot " unless $fstr eq $exp;
89 print "ok ", ++$testno, "\n";
92 # Did we get the appropriate amount of warnings?
93 print "not " unless $w == 1;
94 print "ok ", ++$testno, "\n";
96 # A simple object creation and AVHV attribute access test
97 my B2 $obj1 = D3->new;
102 print "not " unless $obj1->[2] eq "B2" && $obj1->[5] eq "D3";
103 print "ok ", ++$testno, "\n";
105 # We should get compile time failures field name typos
106 eval q(my D3 $obj3 = $obj2; $obj3->{notthere} = "");
107 print "not " unless $@ && $@ =~ /^No such field "notthere"/;
108 print "ok ", ++$testno, "\n";