File: late_reinitialize.t

package info (click to toggle)
libmoosex-methodattributes-perl 0.32-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 496 kB
  • sloc: perl: 648; makefile: 2
file content (38 lines) | stat: -rw-r--r-- 1,064 bytes parent folder | download
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
32
33
34
35
36
37
38
use strict;
use warnings;
use Test::More 0.88;

{
    package Foo;
    use Moose::Role;
    sub role_method {}
}

{
    package BaseClass;
    use Moose;
    BEGIN { with 'MooseX::MethodAttributes::Role::AttrContainer::Inheritable' }
}

# FIXME - This now works with later Moose versions, but needs a
#         bisect and a version bump to work out when it started working!
TODO: {
    package Bar;
    BEGIN { $::TODO = "Known broken" }
    use Moose;
    BEGIN { ::ok(!Bar->meta->has_method('role_method')) }
    BEGIN { ::ok(!Bar->can('role_method')) }
    BEGIN { extends 'BaseClass'; with 'Foo' }
    BEGIN { ::ok( Bar->meta->has_method('role_method')) }
    BEGIN { ::ok( Bar->can('role_method')) }
    use namespace::autoclean;
    BEGIN { ::ok( Bar->meta->has_method('role_method')) }
    BEGIN { ::ok( Bar->can('role_method')) }
    sub foo : Bar {}
    BEGIN { ::ok( Bar->meta->has_method('role_method')) }
    BEGIN { ::ok( Bar->can('role_method')) }
    ::ok( Bar->meta->has_method('role_method'));
    ::ok( Bar->can('role_method'));
}

done_testing;