projects
/
gitmo/Mouse.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
(parent:
fc83f4c
)
Add assert_valid() to Meta::TypeConstraint
gfx [Fri, 19 Feb 2010 07:08:54 +0000 (16:08 +0900)]
lib/Mouse/Meta/TypeConstraint.pm
patch
|
blob
|
blame
|
history
t/040_type_constraints/010_misc_type_tests.t
[moved from
t/040_type_constraints/failing/010_misc_type_tests.t
with 100% similarity]
patch
|
blob
|
blame
|
history
diff --git
a/lib/Mouse/Meta/TypeConstraint.pm
b/lib/Mouse/Meta/TypeConstraint.pm
index
f6bdac8
..
dc34532
100644
(file)
--- a/
lib/Mouse/Meta/TypeConstraint.pm
+++ b/
lib/Mouse/Meta/TypeConstraint.pm
@@
-220,6
+220,15
@@
sub parameterize{
);
}
+sub assert_valid {
+ my ($self, $value) = @_;
+
+ if(!$self->_compiled_type_constraint->($value)){
+ Carp::confess($self->get_message($value));
+ }
+ return 1;
+}
+
1;
__END__
diff --git
a/t/040_type_constraints/failing/010_misc_type_tests.t
b/t/040_type_constraints/010_misc_type_tests.t
similarity index 100%
rename from
t/040_type_constraints/failing/010_misc_type_tests.t
rename to
t/040_type_constraints/010_misc_type_tests.t