From: Tomas Doran Date: Tue, 30 Sep 2008 13:27:22 +0000 (+0000) Subject: Add a test case for the bug which autarch fixed in r6033 X-Git-Tag: 0.59~29 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=07eeacb96765357dc34c1bff71e14d49c0553c77;p=gitmo%2FMoose.git Add a test case for the bug which autarch fixed in r6033 --- diff --git a/t/040_type_constraints/029_define_constraint_twice_throws.t b/t/040_type_constraints/029_define_constraint_twice_throws.t new file mode 100644 index 0000000..df553fc --- /dev/null +++ b/t/040_type_constraints/029_define_constraint_twice_throws.t @@ -0,0 +1,26 @@ +#!/usr/bin/perl + +use strict; +use warnings; + +use Test::More tests => 2; +use Test::Exception; + +BEGIN { + use_ok('Moose::Util::TypeConstraints'); +} + +{ + package Some::Class; + use Moose::Util::TypeConstraints; + + subtype 'MySubType' => as 'Int' => where { 1 }; +} + +throws_ok { + package Some::Other::Class; + use Moose::Util::TypeConstraints; + + subtype 'MySubType' => as 'Int' => where { 1 }; +} qr/cannot be created again/, 'Trying to create same constraint twice throws'; +