Redid conversion to Test::Fatal
[gitmo/Moose.git] / t / 040_type_constraints / 029_define_type_twice_throws.t
CommitLineData
07eeacb9 1#!/usr/bin/perl
2
3use strict;
4use warnings;
5
a28e50e4 6use Test::More;
b10dde3a 7use Test::Fatal;
07eeacb9 8
9BEGIN {
10 use_ok('Moose::Util::TypeConstraints');
11}
12
13{
14 package Some::Class;
15 use Moose::Util::TypeConstraints;
16
17 subtype 'MySubType' => as 'Int' => where { 1 };
18}
19
b10dde3a 20like( exception {
07eeacb9 21 package Some::Other::Class;
22 use Moose::Util::TypeConstraints;
23
24 subtype 'MySubType' => as 'Int' => where { 1 };
b10dde3a 25}, qr/cannot be created again/, 'Trying to create same type twice throws' );
07eeacb9 26
a28e50e4 27done_testing;