Convert all tests to done_testing.
[gitmo/Moose.git] / t / 300_immutable / 014_immutable_metaclass_with_traits.t
CommitLineData
a886a4d6 1#!/usr/bin/env perl
2use strict;
3use warnings;
a28e50e4 4use Test::More;
a886a4d6 5
6{
7 package FooTrait;
8 use Moose::Role;
9}
10{
11 package Foo;
12 use Moose -traits => ['FooTrait'];
13}
14
15is(Class::MOP::class_of('Foo'), Foo->meta,
16 "class_of and ->meta are the same on Foo");
17my $meta = Foo->meta;
18is(Class::MOP::class_of($meta), $meta->meta,
19 "class_of and ->meta are the same on Foo's metaclass");
20isa_ok(Class::MOP::class_of($meta), 'Moose::Meta::Class');
21isa_ok($meta->meta, 'Moose::Meta::Class');
b4633c88 22ok($meta->is_mutable, "class is mutable");
23ok(Class::MOP::class_of($meta)->is_mutable, "metaclass is mutable");
28469dc6 24ok($meta->meta->does_role('FooTrait'), "does the trait");
a886a4d6 25Foo->meta->make_immutable;
26is(Class::MOP::class_of('Foo'), Foo->meta,
27 "class_of and ->meta are the same on Foo (immutable)");
28$meta = Foo->meta;
29isa_ok($meta->meta, 'Moose::Meta::Class');
b4633c88 30ok($meta->is_immutable, "class is immutable");
5d0d2c0b 31ok($meta->meta->is_immutable, "metaclass is immutable (immutable class)");
6691b1f8 32is(Class::MOP::class_of($meta), $meta->meta,
33 "class_of and ->meta are the same on Foo's metaclass (immutable)");
34isa_ok(Class::MOP::class_of($meta), 'Moose::Meta::Class');
28469dc6 35ok($meta->meta->does_role('FooTrait'), "still does the trait after immutable");
a28e50e4 36
37done_testing;