#!/usr/bin/perl
+# This is automatically generated by author/import-moose-test.pl.
+# DO NOT EDIT THIS FILE. ANY CHANGES WILL BE LOST!!!
+use t::lib::MooseCompat;
use strict;
use warnings;
-use Test::More tests => 26;
+use Test::More;
+$TODO = q{Mouse is not yet completed};
use Test::Exception;
use Mouse::Util::TypeConstraints;
## Create a subclass with a custom method
{
- package Test::Mouse::Meta::TypeConstraint::AnySubType;
+ package Test::Mouse::Meta::TypeConstraint;
use Mouse;
extends 'Mouse::Meta::TypeConstraint';
}
my $Int = find_type_constraint('Int');
-ok $Int, 'Got a good type contstraint';
+ok $Int, 'Got a good type constraint';
-my $parent = Test::Mouse::Meta::TypeConstraint::AnySubType->new({
- name => "Test::Mouse::Meta::TypeConstraint::AnySubType" ,
- parent => $Int,
+my $parent = Test::Mouse::Meta::TypeConstraint->new({
+ name => "Test::Mouse::Meta::TypeConstraint" ,
+ parent => $Int,
});
ok $parent, 'Created type constraint';
ok $isa_foo->check( Foo->new ), 'Foo passes check';
ok $isa_foo->check( Bar->new ), 'Bar passes check';
ok ! $isa_foo->check( Baz->new ), 'Baz does not pass check';
-like $foo->get_message( Baz->new ), qr/^Validation failed for 'Foo' failed with value Baz=HASH\(0x\w+\) \(not isa Foo\)/, 'Better validation message';
+like $foo->get_message( Baz->new ), qr/^Validation failed for 'Foo' with value Baz=HASH\(0x\w+\) \(not isa Foo\)/, 'Better validation message';
# Maybe in the future this *should* inherit?
-like $isa_foo->get_message( Baz->new ), qr/^Validation failed for 'IsaFoo' failed with value Baz=HASH\(0x\w+\)$/, "Subtypes do not automatically inherit parent type's message";
+like $isa_foo->get_message( Baz->new ), qr/^Validation failed for 'IsaFoo' with value Baz=HASH\(0x\w+\)$/, "Subtypes do not automatically inherit parent type's message";
# Implicit types
throws_ok {
Quux->new(age => 3)
-} qr/^Attribute \(age\) does not pass the type constraint because: Validation failed for 'Positive' failed with value 3 \(not isa Positive\)/;
+} qr/^Attribute \(age\) does not pass the type constraint because: Validation failed for 'Positive' with value 3 \(not isa Positive\)/;
lives_ok {
Quux->new(age => (bless {}, 'Positive'));
throws_ok {
Quux->new(age => 3)
-} qr/^Attribute \(age\) does not pass the type constraint because: Validation failed for 'Positive' failed with value 3 \(not isa Positive\)/;
+} qr/^Attribute \(age\) does not pass the type constraint because: Validation failed for 'Positive' with value 3 \(not isa Positive\)/;
lives_ok {
Quux->new(age => Positive->new)
lives_ok {
Quux::Ier->new(age => (bless {}, 'Negative'))
};
+
+done_testing;