use strict;
use warnings;
-use Test::More tests => 43;
+use Test::More tests => 55;
use Test::Exception;
BEGIN {
use warnings;
use Moose;
- has 'x' => (isa => Int(), is => 'ro');
- has 'y' => (isa => Int(), is => 'rw');
+ has 'x' => (isa => 'Int', is => 'ro');
+ has 'y' => (isa => 'Int', is => 'rw');
sub clear {
my $self = shift;
extends 'Point';
- has 'z' => (isa => Int());
+ has 'z' => (isa => 'Int');
after 'clear' => sub {
my $self = shift;
ok(Point->meta->has_method($method), '... Point has the method "' . $method . '"');
}
+foreach my $attr_name (@Point_attrs ) {
+ ok(Point->meta->has_attribute($attr_name), '... Point has the attribute "' . $attr_name . '"');
+ my $attr = Point->meta->get_attribute($attr_name);
+ ok($attr->has_type_constraint, '... Attribute ' . $attr_name . ' has a type constraint');
+ isa_ok($attr->type_constraint, 'Moose::Meta::TypeConstraint');
+ is($attr->type_constraint->name, 'Int', '... Attribute ' . $attr_name . ' has an Int type constraint');
+}
+
# poke at Point3D
is_deeply(
foreach my $method (@Point3D_methods) {
ok(Point3D->meta->has_method($method), '... Point3D has the method "' . $method . '"');
}
+
+foreach my $attr_name (@Point3D_attrs ) {
+ ok(Point3D->meta->has_attribute($attr_name), '... Point3D has the attribute "' . $attr_name . '"');
+ my $attr = Point3D->meta->get_attribute($attr_name);
+ ok($attr->has_type_constraint, '... Attribute ' . $attr_name . ' has a type constraint');
+ isa_ok($attr->type_constraint, 'Moose::Meta::TypeConstraint');
+ is($attr->type_constraint->name, 'Int', '... Attribute ' . $attr_name . ' has an Int type constraint');
+}