From: gfx Date: Mon, 13 Sep 2010 04:45:55 +0000 (+0900) Subject: Workaround Test::Builder2's problem that it loads the XS stuff of 'Mouse', X-Git-Tag: 0.69~5 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=gitmo%2FMouse.git;a=commitdiff_plain;h=bdef60b43281bb85a2a4bed85de0069ae3925068 Workaround Test::Builder2's problem that it loads the XS stuff of 'Mouse', which could cause SEGV --- diff --git a/lib/Mouse/Util.pm b/lib/Mouse/Util.pm index a41de59..edecfa6 100644 --- a/lib/Mouse/Util.pm +++ b/lib/Mouse/Util.pm @@ -50,7 +50,7 @@ BEGIN{ our $VERSION = '0.68'; - my $xs = !(exists $INC{'Mouse/PurePerl.pm'} || $ENV{MOUSE_PUREPERL} || $ENV{PERL_ONLY}); + my $xs = !(defined(&is_valid_class_name) || $ENV{MOUSE_PUREPERL} || $ENV{PERL_ONLY}); # Because Mouse::Util is loaded first in all the Mouse sub-modules, # XSLoader must be placed here, not in Mouse.pm. diff --git a/t/001_mouse/808-create_class.t b/t/001_mouse/808-create_class.t index 2c9b63d..fc6f05a 100644 --- a/t/001_mouse/808-create_class.t +++ b/t/001_mouse/808-create_class.t @@ -1,9 +1,10 @@ use strict; use warnings; -use Mouse (); use Test::More tests => 25; use Test::Exception; +use Mouse (); + # error handling throws_ok { Mouse::Meta::Class->create( diff --git a/t/050_metaclasses/041_moose_nonmoose_chain_init_meta.t b/t/050_metaclasses/041_moose_nonmoose_chain_init_meta.t index 9db6eb6..6df8fa7 100644 --- a/t/050_metaclasses/041_moose_nonmoose_chain_init_meta.t +++ b/t/050_metaclasses/041_moose_nonmoose_chain_init_meta.t @@ -1,5 +1,8 @@ use strict; use warnings; +use Test::More tests => 1; +use Test::Exception; + { package ParentClass; use Mouse; @@ -14,9 +17,6 @@ use warnings; use Mouse; } -use Test::More tests => 1; -use Test::Exception; - lives_ok { Mouse->init_meta(for_class => 'SomeClass'); } 'Mouse class => use base => Mouse Class, then Mouse->init_meta on middle class ok'; diff --git a/t/100_bugs/013_lazybuild_required_undef.t b/t/100_bugs/013_lazybuild_required_undef.t index 2c07718..a5377cb 100644 --- a/t/100_bugs/013_lazybuild_required_undef.t +++ b/t/100_bugs/013_lazybuild_required_undef.t @@ -1,3 +1,6 @@ +use strict; +use Test::More tests => 4; + package Foo; use Mouse; @@ -17,7 +20,6 @@ has 'bar' => ( isa => 'Int | Undef', is => 'rw', coerce => 1 ); sub _build_foo { undef } package main; -use Test::More tests => 4; ok ( !defined(Foo->new->bar), 'NonLazyBuild: Undef default' ); ok ( !defined(Foo->new->bar(undef)), 'NonLazyBuild: Undef explicit' ); @@ -26,6 +28,3 @@ ok ( !defined(Foo->new->foo), 'LazyBuild: Undef default/lazy_build' ); ## This test fails at the time of creation. ok ( !defined(Foo->new->foo(undef)), 'LazyBuild: Undef explicit' ); - - -1; diff --git a/t/100_bugs/022_role_caller.t b/t/100_bugs/022_role_caller.t index 6df661d..7c339f6 100644 --- a/t/100_bugs/022_role_caller.t +++ b/t/100_bugs/022_role_caller.t @@ -1,3 +1,5 @@ +use Test::More tests => 4; + package MyRole; use Mouse::Role; @@ -11,8 +13,6 @@ package MyClass2; use Mouse; with 'MyRole'; no Mouse; package main; -use Test::More tests => 4; - { local $TODO = 'Role composition does not clone methods yet'; is(MyClass1->foo, 'MyClass1::foo', diff --git a/t/900_mouse_bugs/005_large_int.t b/t/900_mouse_bugs/005_large_int.t index c6982b9..ed05076 100644 --- a/t/900_mouse_bugs/005_large_int.t +++ b/t/900_mouse_bugs/005_large_int.t @@ -1,19 +1,21 @@ # See also http://rt.cpan.org/Public/Bug/Display.html?id=55048 -package MyInteger; -use Mouse; +use strict; +use Test::More tests => 24; -has a_int => ( - is => 'rw', - isa => 'Int', -); +{ + package MyInteger; + use Mouse; -has a_num => ( - is => 'rw', - isa => 'Num', -); + has a_int => ( + is => 'rw', + isa => 'Int', + ); -package main; -use Test::More tests => 24; + has a_num => ( + is => 'rw', + isa => 'Num', + ); +} foreach my $i(2**32, 2**40, 2**46) { for my $sig(1, -1) {