From 7a8ff9e82b4079f973dcceb55e734b9222039034 Mon Sep 17 00:00:00 2001 From: jnthn Date: Thu, 22 Jan 2015 22:31:36 +0100 Subject: [PATCH] Test .^can interaction with submethods. --- S12-introspection/can.t | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/S12-introspection/can.t b/S12-introspection/can.t index 1fa088fa6e..290bca85b5 100644 --- a/S12-introspection/can.t +++ b/S12-introspection/can.t @@ -8,7 +8,7 @@ Tests for can. =end pod -plan 25; +plan 29; # L @@ -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