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

{
    package FooTrait;
    use Mouse::Role;
}
{
    package Foo;
    use Mouse -traits => ['FooTrait'];
}

is(Mouse::Util::class_of('Foo'), Foo->meta,
    "class_of and ->meta are the same on Foo");
my $meta = Foo->meta;
is(Mouse::Util::class_of($meta), $meta->meta,
    "class_of and ->meta are the same on Foo's metaclass");
isa_ok(Mouse::Util::class_of($meta), 'Mouse::Meta::Class');
isa_ok($meta->meta, 'Mouse::Meta::Class');
ok($meta->is_mutable, "class is mutable");
ok(Mouse::Util::class_of($meta)->is_mutable, "metaclass is mutable");
ok($meta->meta->does_role('FooTrait'), "does the trait");
Foo->meta->make_immutable;
is(Mouse::Util::class_of('Foo'), Foo->meta,
    "class_of and ->meta are the same on Foo (immutable)");
$meta = Foo->meta;
isa_ok($meta->meta, 'Mouse::Meta::Class');
ok($meta->is_immutable, "class is immutable");
{ local $TODO = 'Mouse dos not support $meta->meta->is_immutable';
ok($meta->meta->is_immutable, "metaclass is immutable (immutable class)");
}
is(Mouse::Util::class_of($meta), $meta->meta,
    "class_of and ->meta are the same on Foo's metaclass (immutable)");
isa_ok(Mouse::Util::class_of($meta), 'Mouse::Meta::Class');
ok($meta->meta->does_role('FooTrait'), "still does the trait after immutable");

done_testing;
