[Moose-commits] r7404 - Moose/trunk/t/040_type_constraints
autarch at code2.0beta.co.uk
autarch at code2.0beta.co.uk
Wed Jan 28 18:47:24 GMT 2009
Author: autarch
Date: 2009-01-28 10:47:23 -0800 (Wed, 28 Jan 2009)
New Revision: 7404
Added:
Moose/trunk/t/040_type_constraints/031_subtype_auto_vivify_parent.t
Log:
A subtype should not ignore the parent type name. It should do
_something_ (and we've decided it will auto-vivify as a class type
constraint).
Added: Moose/trunk/t/040_type_constraints/031_subtype_auto_vivify_parent.t
===================================================================
--- Moose/trunk/t/040_type_constraints/031_subtype_auto_vivify_parent.t (rev 0)
+++ Moose/trunk/t/040_type_constraints/031_subtype_auto_vivify_parent.t 2009-01-28 18:47:23 UTC (rev 7404)
@@ -0,0 +1,31 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+use Test::More 'no_plan';
+
+use Moose::Util::TypeConstraints;
+
+
+{
+ package Foo;
+
+ sub new {
+ my $class = shift;
+
+ return bless {@_}, $class;
+ }
+}
+
+subtype 'FooWithSize'
+ => as 'Foo'
+ => where { $_[0]->{size} };
+
+
+my $type = find_type_constraint('FooWithSize');
+ok( $type, 'made a FooWithSize constraint' );
+ok( $type->parent, 'type has a parent type' );
+is( $type->parent->name, 'Foo', 'parent type is Foo' );
+isa_ok( $type->parent, 'Moose::Meta::TypeConstraint::Class',
+ 'parent type constraint is a class type' );
Property changes on: Moose/trunk/t/040_type_constraints/031_subtype_auto_vivify_parent.t
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Rev
Name: svn:eol-style
+ native
More information about the Moose-commits
mailing list