Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #28 from dagurval/master
test for having a method with the same name as an accessor
  • Loading branch information
dagurval committed Mar 3, 2013
2 parents 21c8ec8 + 76a86f7 commit 24bb91f
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion S12-attributes/class.t
Expand Up @@ -11,7 +11,7 @@ Class Attributes
#L<S12/Class attributes/"Class attributes are declared">
#L<S12/Class methods/Such a metaclass method is always delegated>

plan 23;
plan 25;

class Foo {
our $.bar = 23;
Expand Down Expand Up @@ -105,4 +105,19 @@ dies_ok {$test5 = Quux.bar}, 'class attribute accessor hidden by accessor in sub
ok $! ~~ Exception, "bad code: '$bad_code'";
}

{
class A {
has $.b = 1;
method b() { 2; }
};
is A.new.b, 2, "don't create accessor if the class declares an explicit method of that name";


role B {
has $.b = 1;
method b() { 2; }
};
is B.new.b, 2;
}

# vim: ft=perl6

0 comments on commit 24bb91f

Please sign in to comment.