Skip to content

Commit

Permalink
Test .^can interaction with submethods.
Browse files Browse the repository at this point in the history
  • Loading branch information
jnthn committed Jan 22, 2015
1 parent 317910a commit 7a8ff9e
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion S12-introspection/can.t
Expand Up @@ -8,7 +8,7 @@ Tests for can.
=end pod

plan 25;
plan 29;

# L<S12/"Introspection"/Unlike in Perl 5 where .can returns a single Code object>

Expand Down Expand Up @@ -112,4 +112,18 @@ ok Str.can('split') ~~ /split/, 'return value of .can stringifies sensibly';
'can call method reference outside the class';
}

{
# RT #123621
my class A {
submethod x() { 42 }
}
ok A.^can("x"), 'submethods found by .^can';
ok A.can("x"), 'submethods found by .can';

class B is A {
}
nok B.^can("x"), 'submethods from base classes not bogusly found by .^can';
nok B.can("x"), 'submethods from base classes not bogusly found by .can';
}

# vim: ft=perl6

0 comments on commit 7a8ff9e

Please sign in to comment.