use warnings;
use Moose ();
+use Moose::Util::TypeConstraints;
use Test::More;
use Test::Exception;
use Test::Moose;
{
run_tests(build_class);
run_tests( build_class( lazy => 1 ) );
+
+ # Will force the inlining code to check the entire hashref when it is modified.
+ subtype 'MyBool', as 'Bool', where { 1 };
+
+ run_tests( build_class( isa => 'MyBool' ) );
+
+ coerce 'MyBool', from 'Bool', via { $_ };
+
+ run_tests( build_class( isa => 'MyBool', coerce => 1 ) );
}
sub run_tests {
use warnings;
use Moose ();
+use Moose::Util::TypeConstraints;
use Test::Exception;
use Test::More;
use Test::Moose;
{
run_tests(build_class);
run_tests( build_class( lazy => 1 ) );
+
+ # Will force the inlining code to check the entire hashref when it is modified.
+ subtype 'MyInt', as 'Int', where { 1 };
+
+ run_tests( build_class( isa => 'MyInt' ) );
+
+ coerce 'MyInt', from 'Int', via { $_ };
+
+ run_tests( build_class( isa => 'MyInt', coerce => 1 ) );
}
sub run_tests {
use warnings;
use Moose ();
+use Moose::Util::TypeConstraints;
use Test::Exception;
use Test::More;
use Test::Moose;
{
run_tests(build_class);
run_tests( build_class( lazy => 1 ) );
+
+ # Will force the inlining code to check the entire hashref when it is modified.
+ subtype 'MyInt', as 'Int', where { 1 };
+
+ run_tests( build_class( isa => 'MyInt' ) );
+
+ coerce 'MyInt', from 'Int', via { $_ };
+
+ run_tests( build_class( isa => 'MyInt', coerce => 1 ) );
}
sub run_tests {
use warnings;
use Moose ();
+use Moose::Util::TypeConstraints;
use Test::More;
use Test::Exception;
use Test::Moose;
{
run_tests(build_class);
run_tests( build_class( lazy => 1, default => q{} ) );
+
+ # Will force the inlining code to check the entire hashref when it is modified.
+ subtype 'MyStr', as 'Str', where { 1 };
+
+ run_tests( build_class( isa => 'MyStr' ) );
+
+ coerce 'MyStr', from 'Str', via { $_ };
+
+ run_tests( build_class( isa => 'MyStr', coerce => 1 ) );
}
sub run_tests {