summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorToby Inkster <mail@tobyinkster.co.uk>2013-06-28 01:30:18 +0100
committerToby Inkster <mail@tobyinkster.co.uk>2013-06-28 01:30:18 +0100
commit21791f6882049e9f1d7e7d4590a9242da33ce23a (patch)
tree2d4ff097c984c82ea4ac7e749a9e8f8551df9555 /t
parent37d610df495875557279ab3fb014673e97ed4ef6 (diff)
strip out loads of code for parsing type constraints and replace with Type::Parser+Type::Registry
Diffstat (limited to 't')
-rw-r--r--t/03invalid_tc.t29
1 files changed, 9 insertions, 20 deletions
diff --git a/t/03invalid_tc.t b/t/03invalid_tc.t
index ba7c4d0..e006981 100644
--- a/t/03invalid_tc.t
+++ b/t/03invalid_tc.t
@@ -1,7 +1,6 @@
=head1 PURPOSE
-Check that we get warnings about unrecognisable type constraints, but only
-when a value is actually tested against the constraint.
+Check that we get error messages about unrecognisable type constraints.
=head1 AUTHOR
@@ -19,32 +18,22 @@ the same terms as the Perl 5 programming language system itself.
use strict;
use warnings;
-use if !eval { require Test::Warn },
- 'Test::More', skip_all => 'requires Test::Warn';
-use Test::Warn;
use Test::More;
-eval q {
+$@ = undef;
+ok !eval q {
# line 1 "embedded"
package Foo;
use Moo;
use MooX::late;
has foo => (is => 'ro', isa => 'X Y Z', required => 0);
+ 1;
};
-# type constraint should not be checked, so no warning expected
-warnings_are {
- my $foo = Foo->new();
-} [];
-
-# But this should warn
-warnings_like {
- my $foo = Foo->new(foo => 1);
-} qr{Type constraint 'X Y Z' not fully enforced \(defined at embedded:4, package Foo\)};
-
-# But we shouldn't get the same warning again. Too much noise!
-warnings_are {
- my $foo = Foo->new(foo => 1);
-} [];
+like(
+ $@,
+ qr{^Unexpected tail on type expression: Y Z},
+ 'error message looks ok',
+);
done_testing;