Skip a test that fails on some platforms
[gitmo/Mouse.git] / t / 010_basics / 013_create.t
CommitLineData
60ad2cb7 1#!/usr/bin/perl
2
3use strict;
4use warnings;
5
6use Test::More tests => 7;
7use Test::Exception;
8
9{
10 package Class;
11 use Mouse;
12
13 package Foo;
14 use Mouse::Role;
15 sub foo_role_applied { 1 }
16
17 package Conflicts::With::Foo;
18 use Mouse::Role;
19 sub foo_role_applied { 0 }
20
21 package Not::A::Role;
22 sub lol_wut { 42 }
23}
24
25my $new_class;
26
27lives_ok {
28 $new_class = Mouse::Meta::Class->create(
29 'Class::WithFoo',
30 superclasses => ['Class'],
31 roles => ['Foo'],
32 );
33} 'creating lives';
34ok $new_class;
35
36my $with_foo = Class::WithFoo->new;
37
38ok $with_foo->foo_role_applied;
39isa_ok $with_foo, 'Class', '$with_foo';
40
41throws_ok {
42 Mouse::Meta::Class->create(
43 'Made::Of::Fail',
44 superclasses => ['Class'],
45 roles => 'Foo', # "oops"
46 );
47} qr/You must pass an ARRAY ref of roles/;
48
8447b3b1 49ok !Mouse::Util::is_class_loaded('Made::Of::Fail'), "did not create Made::Of::Fail";
60ad2cb7 50
51dies_ok {
52 Mouse::Meta::Class->create(
53 'Continuing::To::Fail',
54 superclasses => ['Class'],
55 roles => ['Foo', 'Conflicts::With::Foo'],
56 );
57} 'conflicting roles == death';
58
59# XXX: Continuing::To::Fail gets created anyway
60