1use strict;
2use warnings;
3
4use Test::More;
5use Test::Moose::More;
6
7#use MooseX::Util::Meta::Class;
8use MooseX::Util 'with_traits';
9
10{ package Zombie::Catcher;                              use Moose;       }
11{ package Zombie::Catcher::Tools::Machete;              use Moose::Role; }
12{ package Zombie::Catcher::Tools::TracyChapmansFastCar; use Moose::Role; }
13
14my $catcher = with_traits(
15    'Zombie::Catcher' => qw{
16        Zombie::Catcher::Tools::Machete
17    },
18);
19
20# created anon classname like: Zombie::Catcher::__ANON__::SERIAL::42
21note $catcher;
22
23validate_class $catcher => (
24    anonymous => 1,
25    isa       => [ 'Zombie::Catcher' ],
26    does      => [ qw{
27        Zombie::Catcher::Tools::Machete
28    }],
29);
30
31like $catcher, qr/^Zombie::Catcher::__ANON__::SERIAL::\d+$/, 'named as expected';
32
33my $fast_catcher = with_traits(
34    $catcher => qw{
35        Zombie::Catcher::Tools::TracyChapmansFastCar
36    },
37);
38
39validate_class $fast_catcher => (
40    anonymous => 1,
41    isa => [ $catcher ],
42    does => [ qw{
43        Zombie::Catcher::Tools::TracyChapmansFastCar
44    }],
45);
46
47like $fast_catcher, qr/^Zombie::Catcher::__ANON__::SERIAL::\d+$/, 'named as expected';
48
49done_testing;
50