diff options
Diffstat (limited to 't/type_constraints/define_type_twice_throws.t')
-rw-r--r-- | t/type_constraints/define_type_twice_throws.t | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/t/type_constraints/define_type_twice_throws.t b/t/type_constraints/define_type_twice_throws.t new file mode 100644 index 0000000..a9b9b83 --- /dev/null +++ b/t/type_constraints/define_type_twice_throws.t @@ -0,0 +1,23 @@ +use strict; +use warnings; + +use Test::More; +use Test::Fatal; + +use Moose::Util::TypeConstraints; + +{ + package Some::Class; + use Moose::Util::TypeConstraints; + + subtype 'MySubType' => as 'Int' => where { 1 }; +} + +like( exception { + package Some::Other::Class; + use Moose::Util::TypeConstraints; + + subtype 'MySubType' => as 'Int' => where { 1 }; +}, qr/cannot be created again/, 'Trying to create same type twice throws' ); + +done_testing; |