use strict;
# This is automatically generated by author/import-moose-test.pl.
# DO NOT EDIT THIS FILE. ANY CHANGES WILL BE LOST!!!
use t::lib::MooseCompat;
use warnings;

use Test::More;
use Mouse::Util qw( apply_all_roles );

{
    package Role::Foo;
    use Mouse::Role;
}

{
    package Role::Bar;
    use Mouse::Role;
}

{
    package Role::Baz;
    use Mouse::Role;
}

{
    package Class::A;
    use Mouse;
}

{
    package Class::B;
    use Mouse;
}

{
    package Class::C;
    use Mouse;
}

{
    package Class::D;
    use Mouse;
}

{
    package Class::E;
    use Mouse;
}

my @roles = qw( Role::Foo Role::Bar Role::Baz );
apply_all_roles( 'Class::A', @roles );
ok( Class::A->meta->does_role($_), "Class::A does $_" ) for @roles;

apply_all_roles( 'Class::B', map { $_->meta } @roles );
ok( Class::A->meta->does_role($_),
    "Class::B does $_ (applied with meta role object)" )
    for @roles;

@roles = qw( Role::Foo );
apply_all_roles( 'Class::C', @roles );
ok( Class::A->meta->does_role($_), "Class::C does $_" ) for @roles;

apply_all_roles( 'Class::D', map { $_->meta } @roles );
ok( Class::A->meta->does_role($_),
    "Class::D does $_ (applied with meta role object)" )
    for @roles;

@roles = qw( Role::Foo Role::Bar ), Role::Baz->meta;
apply_all_roles( 'Class::E', @roles );
ok( Class::A->meta->does_role($_),
    "Class::E does $_ (mix of names and meta role object)" )
    for @roles;

done_testing;
