6 use Test::More tests => 10;
7 use Moose::Util::TypeConstraints;
8 use MooseX::Types::Data::GUID qw/GUID/;
10 for my $key ( GUID, 'Data::GUID' ){
11 if(my $constraint = find_type_constraint($key) ){
12 isa_ok( $constraint, "Moose::Meta::TypeConstraint" );
13 if ( $constraint->has_coercion ){
14 ok(1, 'has coercion');
15 my $coercion = $constraint->coercion;
16 ok( $coercion->has_coercion_for_type('Str'), 'has coercion for Str');
17 my $original_str = 'C6A9FE9A-72FE-11DD-B3B4-B2EC1DADD46B';
18 if( my $guid = $coercion->coerce($original_str) ){
19 isa_ok($guid, 'Data::GUID');
20 is($guid->as_string, $original_str, 'Same GUID was built');
23 ok(0, 'Failed to find type coercion');
26 ok(0, "Failed to find type constraint '${key}'");