Commit | Line | Data |
c47cf415 |
1 | #!/usr/bin/env perl |
2 | # This is automatically generated by author/import-moose-test.pl. |
3 | # DO NOT EDIT THIS FILE. ANY CHANGES WILL BE LOST!!! |
4 | use t::lib::MooseCompat; |
5 | use strict; |
6 | use warnings; |
7 | use Test::More; |
8 | $TODO = q{Mouse is not yet completed}; |
9 | use Test::Mouse; |
10 | |
11 | use Mouse (); |
12 | use Mouse::Util qw(with_traits); |
13 | |
14 | { |
15 | package Foo; |
16 | use Mouse; |
17 | } |
18 | |
19 | { |
20 | package Foo::Role; |
21 | use Mouse::Role; |
22 | } |
23 | |
24 | { |
25 | package Foo::Role2; |
26 | use Mouse::Role; |
27 | } |
28 | |
29 | { |
30 | my $traited_class = with_traits('Foo', 'Foo::Role'); |
31 | ok($traited_class->meta->is_anon_class, "we get an anon class"); |
32 | isa_ok($traited_class, 'Foo'); |
33 | does_ok($traited_class, 'Foo::Role'); |
34 | } |
35 | |
36 | { |
37 | my $traited_class = with_traits('Foo', 'Foo::Role', 'Foo::Role2'); |
38 | ok($traited_class->meta->is_anon_class, "we get an anon class"); |
39 | isa_ok($traited_class, 'Foo'); |
40 | does_ok($traited_class, 'Foo::Role'); |
41 | does_ok($traited_class, 'Foo::Role2'); |
42 | } |
43 | |
44 | { |
45 | my $traited_class = with_traits('Foo'); |
46 | is($traited_class, 'Foo', "don't apply anything if we don't get any traits"); |
47 | } |
48 | |
49 | { |
50 | my $traited_class = with_traits('Foo', 'Foo::Role'); |
51 | my $traited_class2 = with_traits('Foo', 'Foo::Role'); |
52 | is($traited_class, $traited_class2, "get the same class back when passing the same roles"); |
53 | } |
54 | |
55 | done_testing; |