File: broken_meta.t

package info (click to toggle)
libnamespace-autoclean-perl 0.31-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 520 kB
  • sloc: perl: 580; makefile: 2
file content (31 lines) | stat: -rw-r--r-- 802 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
use strict;
use warnings;
use Test::More 0.88;

{
    package OldMoose;
    sub meta { }
    sub does {  # copied roughly from Moose::Object, pre-2.0300
        my ($self, $role_name) = @_;
        my $meta = $self->meta;
        return 1 if $meta->can('does_role') && $meta->does_role($role_name);
        return 0;
    }
    sub dump {}
}

{
    package Foo;
    our @ISA = ('OldMoose');
    sub bar { }
    use namespace::autoclean;
    sub moo { }
    BEGIN { *kooh = *kooh = do { package Moo; sub { }; }; }
}

ok( Foo->can('bar'), 'Foo can bar - standard method');
ok( Foo->can('moo'), 'Foo can moo - standard method');
ok(!Foo->can('kooh'), 'Foo cannot kooh - anon sub from another package assigned to glob');
ok( Foo->can('dump'), 'Foo can dump - standard method from parent');

done_testing();