We only need local $? if we inline calls to DEMOLISH
[gitmo/Moose.git] / t / type_constraints / define_type_twice_throws.t
1 #!/usr/bin/perl
2
3 use strict;
4 use warnings;
5
6 use Test::More;
7 use Test::Fatal;
8
9 use Moose::Util::TypeConstraints;
10
11 {
12     package Some::Class;
13     use Moose::Util::TypeConstraints;
14
15     subtype 'MySubType' => as 'Int' => where { 1 };
16 }
17
18 like( exception {
19     package Some::Other::Class;
20     use Moose::Util::TypeConstraints;
21
22     subtype 'MySubType' => as 'Int' => where { 1 };
23 }, qr/cannot be created again/, 'Trying to create same type twice throws' );
24
25 done_testing;