From: Ricardo Signes Date: Mon, 25 Oct 2010 17:59:49 +0000 (-0400) Subject: avoid warning in TC-with-dash test X-Git-Tag: 1.18~64 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=4d1b85c131be21ad3a7a0a32a8125bd1a4aa9a97;p=gitmo%2FMoose.git avoid warning in TC-with-dash test --- diff --git a/t/040_type_constraints/033_type_names.t b/t/040_type_constraints/033_type_names.t index bf39ea7..dafade2 100644 --- a/t/040_type_constraints/033_type_names.t +++ b/t/040_type_constraints/033_type_names.t @@ -12,9 +12,21 @@ TODO: { local $TODO = 'type names are not validated in the TC metaclass'; - like exception { Moose::Meta::TypeConstraint->new( name => 'Foo-Bar' ) }, - qr/contains invalid characters/, - 'Type names cannot contain a dash'; + # Test written in this way to avoid a warning from like(undef, qr...); + # -- rjbs, 2010-10-25 + my $error = exception { + Moose::Meta::TypeConstraint->new( name => 'Foo-Bar' ) + }; + + if (defined $error) { + like( + $error, + qr/contains invalid characters/, + 'Type names cannot contain a dash', + ); + } else { + fail("Type names cannot contain a dash"); + } } ok ! exception { Moose::Meta::TypeConstraint->new( name => 'Foo.Bar::Baz' ) },