Cleanup failing tests
[gitmo/Mouse.git] / Moose-t-failing / 040_type_constraints / 008_union_types.t
@@ -1,9 +1,13 @@
 #!/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 => 35;
+use Test::More;
+$TODO = q{Mouse is not yet completed};
 use Test::Exception;
 
 BEGIN {
@@ -21,8 +25,8 @@ ok($Str->check('String'), '... Str can accept an String value');
 ok(!$Undef->check('String'), '... Undef cannot accept an Str value');
 ok($Undef->check(undef), '... Undef can accept an Undef value');
 
-my $Str_or_Undef = Mouse::Meta::TypeConstraint::Union->new(type_constraints => [$Str, $Undef]);
-isa_ok($Str_or_Undef, 'Mouse::Meta::TypeConstraint::Union');
+my $Str_or_Undef = Mouse::Meta::TypeConstraint->new(type_constraints => [$Str, $Undef]);
+isa_ok($Str_or_Undef, 'Mouse::Meta::TypeConstraint');
 
 ok($Str_or_Undef->check(undef), '... (Str | Undef) can accept an Undef value');
 ok($Str_or_Undef->check('String'), '... (Str | Undef) can accept a String value');
@@ -30,10 +34,14 @@ ok($Str_or_Undef->check('String'), '... (Str | Undef) can accept a String value'
 ok($Str_or_Undef->is_a_type_of($Str), "subtype of Str");
 ok($Str_or_Undef->is_a_type_of($Undef), "subtype of Undef");
 
+cmp_ok($Str_or_Undef->find_type_for('String'), 'eq', 'Str', 'find_type_for Str');
+cmp_ok($Str_or_Undef->find_type_for(undef), 'eq', 'Undef', 'find_type_for Undef');
+ok(!defined($Str_or_Undef->find_type_for(sub { })), 'no find_type_for CodeRef');
+
 ok( !$Str_or_Undef->equals($Str), "not equal to Str" );
 ok( $Str_or_Undef->equals($Str_or_Undef), "equal to self" );
-ok( $Str_or_Undef->equals(Mouse::Meta::TypeConstraint::Union->new(type_constraints => [ $Str, $Undef ])), "equal to clone" );
-ok( $Str_or_Undef->equals(Mouse::Meta::TypeConstraint::Union->new(type_constraints => [ $Undef, $Str ])), "equal to reversed clone" );
+ok( $Str_or_Undef->equals(Mouse::Meta::TypeConstraint->new(type_constraints => [ $Str, $Undef ])), "equal to clone" );
+ok( $Str_or_Undef->equals(Mouse::Meta::TypeConstraint->new(type_constraints => [ $Undef, $Str ])), "equal to reversed clone" );
 
 ok( !$Str_or_Undef->is_a_type_of("ThisTypeDoesNotExist"), "not type of non existant type" );
 ok( !$Str_or_Undef->is_subtype_of("ThisTypeDoesNotExist"), "not subtype of non existant type" );
@@ -51,8 +59,8 @@ ok(!$ArrayRef->check({}), '... ArrayRef cannot accept an {} value');
 ok($HashRef->check({}), '... HashRef can accept an {} value');
 ok(!$HashRef->check([]), '... HashRef cannot accept an [] value');
 
-my $HashOrArray = Mouse::Meta::TypeConstraint::Union->new(type_constraints => [$ArrayRef, $HashRef]);
-isa_ok($HashOrArray, 'Mouse::Meta::TypeConstraint::Union');
+my $HashOrArray = Mouse::Meta::TypeConstraint->new(type_constraints => [$ArrayRef, $HashRef]);
+isa_ok($HashOrArray, 'Mouse::Meta::TypeConstraint');
 
 ok($HashOrArray->check([]), '... (ArrayRef | HashRef) can accept []');
 ok($HashOrArray->check({}), '... (ArrayRef | HashRef) can accept {}');
@@ -67,14 +75,15 @@ ok(!defined($HashOrArray->validate([])), '... (ArrayRef | HashRef) can accept []
 ok(!defined($HashOrArray->validate({})), '... (ArrayRef | HashRef) can accept {}');
 
 like($HashOrArray->validate(\(my $var2)),
-qr/Validation failed for \'ArrayRef\' failed with value SCALAR\(0x.+?\) and Validation failed for \'HashRef\' failed with value SCALAR\(0x.+?\) in \(ArrayRef\|HashRef\)/,
+qr/Validation failed for \'ArrayRef\' with value SCALAR\(0x.+?\) and Validation failed for \'HashRef\' with value SCALAR\(0x.+?\) in \(ArrayRef\|HashRef\)/,
 '... (ArrayRef | HashRef) cannot accept scalar refs');
 
 like($HashOrArray->validate(sub {}),
-qr/Validation failed for \'ArrayRef\' failed with value CODE\(0x.+?\) and Validation failed for \'HashRef\' failed with value CODE\(0x.+?\) in \(ArrayRef\|HashRef\)/,
+qr/Validation failed for \'ArrayRef\' with value CODE\(0x.+?\) and Validation failed for \'HashRef\' with value CODE\(0x.+?\) in \(ArrayRef\|HashRef\)/,
 '... (ArrayRef | HashRef) cannot accept code refs');
 
 is($HashOrArray->validate(50),
-'Validation failed for \'ArrayRef\' failed with value 50 and Validation failed for \'HashRef\' failed with value 50 in (ArrayRef|HashRef)',
+'Validation failed for \'ArrayRef\' with value 50 and Validation failed for \'HashRef\' with value 50 in (ArrayRef|HashRef)',
 '... (ArrayRef | HashRef) cannot accept Numbers');
 
+done_testing;