From: Jesse Luehrs Date: Wed, 7 Nov 2012 19:47:59 +0000 (-0600) Subject: make tests work better with forkprove X-Git-Tag: 2.0800~19 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=986a8b2250ccc45f86cc55c6db34435302972ffb;p=gitmo%2FMoose.git make tests work better with forkprove --- diff --git a/t/bugs/create_anon_recursion.t b/t/bugs/create_anon_recursion.t index 1957381..436048a 100644 --- a/t/bugs/create_anon_recursion.t +++ b/t/bugs/create_anon_recursion.t @@ -4,6 +4,11 @@ use warnings; use Test::More; use Test::Fatal; +BEGIN { + plan skip_all => "preloading things makes this test meaningless" + if exists $INC{'Moose.pm'}; +} + use Moose::Meta::Class; $SIG{__WARN__} = sub { die if shift =~ /recurs/ }; diff --git a/t/cmop/load.t b/t/cmop/load.t index 7e5a94d..ea30da1 100644 --- a/t/cmop/load.t +++ b/t/cmop/load.t @@ -1,6 +1,10 @@ use strict; use warnings; +# for instance, App::ForkProve +my $preloaded; +BEGIN { $preloaded = exists $INC{'Class/MOP.pm'} } + use Test::More; use Class::Load qw(is_class_loaded); @@ -71,71 +75,75 @@ for my $meta (values %METAS) { } } -is_deeply( - {Class::MOP::get_all_metaclasses}, - \%METAS, - '... got all the metaclasses' -); - -is_deeply( - [ - sort { $a->name cmp $b->name } Class::MOP::get_all_metaclass_instances - ], - [ - Class::MOP::Attribute->meta, - Class::MOP::Class->meta, - Class::MOP::Class::Immutable::Class::MOP::Class->meta, - Class::MOP::class_of('Class::MOP::Class::Immutable::Trait'), - Class::MOP::Instance->meta, - Class::MOP::Method->meta, - Class::MOP::Method::Accessor->meta, - Class::MOP::Method::Constructor->meta, - Class::MOP::Method::Generated->meta, - Class::MOP::Method::Inlined->meta, - Class::MOP::Method::Meta->meta, - Class::MOP::Method::Overload->meta, - Class::MOP::Method::Wrapped->meta, - Class::MOP::Mixin->meta, - Class::MOP::Mixin::AttributeCore->meta, - Class::MOP::Mixin::HasAttributes->meta, - Class::MOP::Mixin::HasMethods->meta, - Class::MOP::Module->meta, - Class::MOP::Object->meta, - Class::MOP::Package->meta, - Class::MOP::class_of('UNIVERSAL'), - ], - '... got all the metaclass instances' -); - -is_deeply( - [ sort { $a cmp $b } Class::MOP::get_all_metaclass_names() ], - [ - sort qw/ - Class::MOP::Attribute - Class::MOP::Class - Class::MOP::Class::Immutable::Class::MOP::Class - Class::MOP::Class::Immutable::Trait - Class::MOP::Mixin - Class::MOP::Mixin::AttributeCore - Class::MOP::Mixin::HasAttributes - Class::MOP::Mixin::HasMethods - Class::MOP::Instance - Class::MOP::Method - Class::MOP::Method::Accessor - Class::MOP::Method::Constructor - Class::MOP::Method::Generated - Class::MOP::Method::Inlined - Class::MOP::Method::Wrapped - Class::MOP::Method::Meta - Class::MOP::Method::Overload - Class::MOP::Module - Class::MOP::Object - Class::MOP::Package - UNIVERSAL - /, - ], - '... got all the metaclass names' -); +SKIP: { + skip "this list may be incorrect if we preloaded things", 3 if $preloaded; + is_deeply( + {Class::MOP::get_all_metaclasses}, + \%METAS, + '... got all the metaclasses' + ); + + is_deeply( + [ + sort { $a->name cmp $b->name } + Class::MOP::get_all_metaclass_instances + ], + [ + Class::MOP::Attribute->meta, + Class::MOP::Class->meta, + Class::MOP::Class::Immutable::Class::MOP::Class->meta, + Class::MOP::class_of('Class::MOP::Class::Immutable::Trait'), + Class::MOP::Instance->meta, + Class::MOP::Method->meta, + Class::MOP::Method::Accessor->meta, + Class::MOP::Method::Constructor->meta, + Class::MOP::Method::Generated->meta, + Class::MOP::Method::Inlined->meta, + Class::MOP::Method::Meta->meta, + Class::MOP::Method::Overload->meta, + Class::MOP::Method::Wrapped->meta, + Class::MOP::Mixin->meta, + Class::MOP::Mixin::AttributeCore->meta, + Class::MOP::Mixin::HasAttributes->meta, + Class::MOP::Mixin::HasMethods->meta, + Class::MOP::Module->meta, + Class::MOP::Object->meta, + Class::MOP::Package->meta, + Class::MOP::class_of('UNIVERSAL'), + ], + '... got all the metaclass instances' + ); + + is_deeply( + [ sort { $a cmp $b } Class::MOP::get_all_metaclass_names() ], + [ + sort qw/ + Class::MOP::Attribute + Class::MOP::Class + Class::MOP::Class::Immutable::Class::MOP::Class + Class::MOP::Class::Immutable::Trait + Class::MOP::Mixin + Class::MOP::Mixin::AttributeCore + Class::MOP::Mixin::HasAttributes + Class::MOP::Mixin::HasMethods + Class::MOP::Instance + Class::MOP::Method + Class::MOP::Method::Accessor + Class::MOP::Method::Constructor + Class::MOP::Method::Generated + Class::MOP::Method::Inlined + Class::MOP::Method::Wrapped + Class::MOP::Method::Meta + Class::MOP::Method::Overload + Class::MOP::Module + Class::MOP::Object + Class::MOP::Package + UNIVERSAL + /, + ], + '... got all the metaclass names' + ); +} # testing the meta-circularity of the system