X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F55namespaces_cleaned.t;h=2556546f82e1d2f33c101f581129f94db14344ed;hb=70c288086248e5a4008490df22a56632341f2473;hp=85c288b47d380a136b31626d3e328e97056c5975;hpb=a1249d49dffc7703374d3ea8aa3637609f21843e;p=dbsrgits%2FDBIx-Class.git diff --git a/t/55namespaces_cleaned.t b/t/55namespaces_cleaned.t index 85c288b..2556546 100644 --- a/t/55namespaces_cleaned.t +++ b/t/55namespaces_cleaned.t @@ -79,13 +79,16 @@ for my $mod (@modules) { my $gv = svref_2object($all_method_like{$name})->GV; my $origin = $gv->STASH->NAME; - next if $seen->{"${origin}:${name}"}++; - TODO: { local $TODO = 'CAG does not clean its BEGIN constants' if $name =~ /^__CAG_/; - is ($gv->NAME, $name, "Properly named $name method at $origin"); + is ($gv->NAME, $name, "Properly named $name method at $origin" . ($origin eq $mod + ? '' + : " (inherited by $mod)" + )); } + next if $seen->{"${origin}:${name}"}++; + if ($origin eq $mod) { pass ("$name is a native $mod method"); } @@ -108,6 +111,25 @@ for my $mod (@modules) { ); } } + + # some common import names (these should never ever be methods) + for my $f (qw/carp carp_once carp_unique croak confess cluck try catch finally/) { + if ($mod->can($f)) { + my $via; + for (reverse @{mro::get_linear_isa($mod)} ) { + if ( ($_->can($f)||'') eq $all_method_like{$f} ) { + $via = $_; + last; + } + } + fail ("Import $f leaked into method list of ${mod}, appears to have entered inheritance chain at " + . ($via || 'UNKNOWN') + ); + } + else { + pass ("Import $f not leaked into method list of $mod"); + } + } } }