From: Dave Rolsky Date: Tue, 5 Aug 2008 03:04:22 +0000 (+0000) Subject: Moose now warns when you try to load it from the main package. Added a X-Git-Tag: 0_55_01~57 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=7ff5653479c2bfc0794635f7fbade9bfe7bb2381;p=gitmo%2FMoose.git Moose now warns when you try to load it from the main package. Added a test for this (which requires Test::Output to run). The tests had many "use_ok('Moose')" lines that started warning. The use_ok tests weren't really testing anything, since the tests need the modules they were trying to load in order to run. You actually get a better error message by just using the module normally (if said module fails to compile). --- diff --git a/Changes b/Changes index 175298b..d28929a 100644 --- a/Changes +++ b/Changes @@ -6,6 +6,11 @@ Revision history for Perl extension Moose - Add a remove_keywords function so if you extend Moose you don't have to cargo cult Moose's unimport (Sartak) + * Moose + - Moose now warns when you try to have it export its sugar + functions into the "main" package. Previously it silently did + nothing. (Dave Rolsky) + 0.55 Sun August 3, 2008 * Moose::Meta::Attribute - breaking down the way 'handles' methods are diff --git a/lib/Moose.pm b/lib/Moose.pm index 9551c07..21ef374 100644 --- a/lib/Moose.pm +++ b/lib/Moose.pm @@ -167,7 +167,10 @@ use Moose::Util (); warnings->import; # we should never export to main - return if $CALLER eq 'main'; + if ($CALLER eq 'main') { + warn qq{Moose does not export its sugar to the 'main' package.\n}; + return; + } init_meta( $CALLER, 'Moose::Object' ); diff --git a/t/000_load.t b/t/000_load.t index 0c59d05..697464c 100644 --- a/t/000_load.t +++ b/t/000_load.t @@ -5,6 +5,10 @@ use warnings; use Test::More tests => 1; -BEGIN { - use_ok('Moose'); -} +package Foo; + +# Moose will issue a warning if we try to load it from the main +# package. +::use_ok('Moose'); + + diff --git a/t/000_recipes/basics/001_point.t b/t/000_recipes/basics/001_point.t index 771a795..46dbf9c 100644 --- a/t/000_recipes/basics/001_point.t +++ b/t/000_recipes/basics/001_point.t @@ -3,13 +3,9 @@ use strict; use warnings; -use Test::More tests => 58; +use Test::More tests => 57; use Test::Exception; -BEGIN { - use_ok('Moose'); -} - { package Point; use Moose; diff --git a/t/000_recipes/basics/002_bank_account.t b/t/000_recipes/basics/002_bank_account.t index 4e0b571..36c677b 100644 --- a/t/000_recipes/basics/002_bank_account.t +++ b/t/000_recipes/basics/002_bank_account.t @@ -3,13 +3,9 @@ use strict; use warnings; -use Test::More tests => 24; +use Test::More tests => 23; use Test::Exception; -BEGIN { - use_ok('Moose'); -} - { package BankAccount; use Moose; diff --git a/t/000_recipes/basics/003_binary_tree.t b/t/000_recipes/basics/003_binary_tree.t index cc7afbd..0f85f95 100644 --- a/t/000_recipes/basics/003_binary_tree.t +++ b/t/000_recipes/basics/003_binary_tree.t @@ -3,15 +3,11 @@ use strict; use warnings; -use Test::More tests => 34; +use Test::More tests => 33; use Test::Exception; use Scalar::Util 'isweak'; -BEGIN { - use_ok('Moose'); -} - { package BinaryTree; use Moose; diff --git a/t/000_recipes/basics/004_company.t b/t/000_recipes/basics/004_company.t index 44bfa13..cc53a71 100644 --- a/t/000_recipes/basics/004_company.t +++ b/t/000_recipes/basics/004_company.t @@ -8,15 +8,13 @@ use Test::More; BEGIN { eval "use Regexp::Common; use Locale::US;"; plan skip_all => "Regexp::Common & Locale::US required for this test" if $@; - plan tests => 66; + plan tests => 65; } use Test::Exception; use Scalar::Util 'isweak'; -BEGIN { - use_ok('Moose'); -} + { package Address; diff --git a/t/000_recipes/basics/005_coercion.t b/t/000_recipes/basics/005_coercion.t index 7ea0371..773742b 100644 --- a/t/000_recipes/basics/005_coercion.t +++ b/t/000_recipes/basics/005_coercion.t @@ -8,15 +8,11 @@ use Test::More; BEGIN { eval "use HTTP::Headers; use Params::Coerce; use URI;"; plan skip_all => "HTTP::Headers & Params::Coerce & URI required for this test" if $@; - plan tests => 18; + plan tests => 17; } use Test::Exception; -BEGIN { - use_ok('Moose'); -} - { package Request; use Moose; diff --git a/t/000_recipes/basics/006_augment_inner.t b/t/000_recipes/basics/006_augment_inner.t index 53d2b75..04f2f1d 100644 --- a/t/000_recipes/basics/006_augment_inner.t +++ b/t/000_recipes/basics/006_augment_inner.t @@ -3,12 +3,10 @@ use strict; use warnings; -use Test::More tests => 3; +use Test::More tests => 2; use Test::Exception; -BEGIN { - use_ok('Moose'); -} + ## Augment/Inner diff --git a/t/000_recipes/meta/002_meta_attribute.t b/t/000_recipes/meta/002_meta_attribute.t index 7e5abcf..efe675c 100644 --- a/t/000_recipes/meta/002_meta_attribute.t +++ b/t/000_recipes/meta/002_meta_attribute.t @@ -3,12 +3,10 @@ use strict; use warnings; -use Test::More tests => 2; +use Test::More tests => 1; use Test::Exception; -BEGIN { - use_ok('Moose'); -} + ## meta-attribute example { diff --git a/t/000_recipes/meta/003_attribute_trait.t b/t/000_recipes/meta/003_attribute_trait.t index 223fb65..7b8157f 100644 --- a/t/000_recipes/meta/003_attribute_trait.t +++ b/t/000_recipes/meta/003_attribute_trait.t @@ -3,12 +3,10 @@ use strict; use warnings; -use Test::More tests => 3; +use Test::More tests => 2; use Test::Exception; -BEGIN { - use_ok('Moose'); -} + ## attribute trait example { diff --git a/t/000_recipes/roles/001_roles.t b/t/000_recipes/roles/001_roles.t index fb6f834..6f89b83 100644 --- a/t/000_recipes/roles/001_roles.t +++ b/t/000_recipes/roles/001_roles.t @@ -3,12 +3,10 @@ use strict; use warnings; -use Test::More tests => 64; +use Test::More tests => 63; use Test::Exception; -BEGIN { - use_ok('Moose'); -} + ## Roles diff --git a/t/010_basics/001_basic_class_setup.t b/t/010_basics/001_basic_class_setup.t index 7647693..0520394 100644 --- a/t/010_basics/001_basic_class_setup.t +++ b/t/010_basics/001_basic_class_setup.t @@ -3,12 +3,10 @@ use strict; use warnings; -use Test::More tests => 23; +use Test::More tests => 22; use Test::Exception; -BEGIN { - use_ok('Moose'); -} + { package Foo; diff --git a/t/010_basics/002_require_superclasses.t b/t/010_basics/002_require_superclasses.t index ced023f..28b52e0 100644 --- a/t/010_basics/002_require_superclasses.t +++ b/t/010_basics/002_require_superclasses.t @@ -5,11 +5,9 @@ use warnings; use lib 't/lib', 'lib'; -use Test::More tests => 6; +use Test::More tests => 5; + -BEGIN { - use_ok('Moose'); -} { package Bar; diff --git a/t/010_basics/003_super_and_override.t b/t/010_basics/003_super_and_override.t index e04eea5..54d5c2d 100644 --- a/t/010_basics/003_super_and_override.t +++ b/t/010_basics/003_super_and_override.t @@ -3,12 +3,10 @@ use strict; use warnings; -use Test::More tests => 17; +use Test::More tests => 16; use Test::Exception; -BEGIN { - use_ok('Moose'); -} + { package Foo; diff --git a/t/010_basics/004_inner_and_augment.t b/t/010_basics/004_inner_and_augment.t index f129ef2..15f4248 100644 --- a/t/010_basics/004_inner_and_augment.t +++ b/t/010_basics/004_inner_and_augment.t @@ -3,12 +3,10 @@ use strict; use warnings; -use Test::More tests => 17; +use Test::More tests => 16; use Test::Exception; -BEGIN { - use_ok('Moose'); -} + { package Foo; diff --git a/t/010_basics/005_override_augment_inner_super.t b/t/010_basics/005_override_augment_inner_super.t index 6732c60..2d4a330 100644 --- a/t/010_basics/005_override_augment_inner_super.t +++ b/t/010_basics/005_override_augment_inner_super.t @@ -3,11 +3,9 @@ use strict; use warnings; -use Test::More tests => 6; +use Test::More tests => 5; + -BEGIN { - use_ok('Moose'); -} { package Foo; diff --git a/t/010_basics/006_override_and_foreign_classes.t b/t/010_basics/006_override_and_foreign_classes.t index 812002e..26fbb44 100644 --- a/t/010_basics/006_override_and_foreign_classes.t +++ b/t/010_basics/006_override_and_foreign_classes.t @@ -3,11 +3,9 @@ use strict; use warnings; -use Test::More tests => 16; +use Test::More tests => 15; + -BEGIN { - use_ok('Moose'); -} =pod diff --git a/t/010_basics/008_wrapped_method_cxt_propagation.t b/t/010_basics/008_wrapped_method_cxt_propagation.t index 8e97669..226cf54 100644 --- a/t/010_basics/008_wrapped_method_cxt_propagation.t +++ b/t/010_basics/008_wrapped_method_cxt_propagation.t @@ -3,11 +3,9 @@ use strict; use warnings; -use Test::More tests => 8; +use Test::More tests => 7; + -BEGIN { - use_ok('Moose'); -} { package TouchyBase; diff --git a/t/010_basics/009_import_unimport.t b/t/010_basics/009_import_unimport.t index 9bc2c76..7e58c7c 100644 --- a/t/010_basics/009_import_unimport.t +++ b/t/010_basics/009_import_unimport.t @@ -3,11 +3,9 @@ use strict; use warnings; -use Test::More tests => 47; +use Test::More tests => 46; + -BEGIN { - use_ok('Moose'); -} my @moose_exports = qw( extends with diff --git a/t/010_basics/010_method_modifier_with_regexp.t b/t/010_basics/010_method_modifier_with_regexp.t index c57030b..41f55cd 100644 --- a/t/010_basics/010_method_modifier_with_regexp.t +++ b/t/010_basics/010_method_modifier_with_regexp.t @@ -3,12 +3,10 @@ use strict; use warnings; -use Test::More tests => 10; +use Test::More tests => 9; use Test::Exception; -BEGIN { - use_ok('Moose'); -} + { diff --git a/t/010_basics/011_moose_respects_type_constraints.t b/t/010_basics/011_moose_respects_type_constraints.t index ead0d1a..a62f147 100644 --- a/t/010_basics/011_moose_respects_type_constraints.t +++ b/t/010_basics/011_moose_respects_type_constraints.t @@ -3,13 +3,10 @@ use strict; use warnings; -use Test::More tests => 9; +use Test::More tests => 7; use Test::Exception; -BEGIN { - use_ok('Moose'); - use_ok('Moose::Util::TypeConstraints'); -} +use Moose::Util::TypeConstraints; =pod diff --git a/t/010_basics/012_rebless.t b/t/010_basics/012_rebless.t index fcc5dd6..c8ec23e 100644 --- a/t/010_basics/012_rebless.t +++ b/t/010_basics/012_rebless.t @@ -3,14 +3,11 @@ use strict; use warnings; -use Test::More tests => 13; +use Test::More tests => 11; use Test::Exception; use Scalar::Util 'blessed'; -BEGIN { - use_ok('Moose'); - use_ok("Moose::Util::TypeConstraints"); -} +use Moose::Util::TypeConstraints; subtype 'Positive' => as 'Num' diff --git a/t/010_basics/013_create.t b/t/010_basics/013_create.t index 8fbafe7..e83972d 100644 --- a/t/010_basics/013_create.t +++ b/t/010_basics/013_create.t @@ -3,15 +3,9 @@ use strict; use warnings; -use Test::More tests => 10; +use Test::More tests => 7; use Test::Exception; -BEGIN { - use_ok('Moose::Meta::Class'); - use_ok('Moose'); - use_ok('Moose::Role'); -} - { package Class; use Moose; diff --git a/t/010_basics/014_create_anon.t b/t/010_basics/014_create_anon.t index d989455..d324b4b 100644 --- a/t/010_basics/014_create_anon.t +++ b/t/010_basics/014_create_anon.t @@ -3,13 +3,9 @@ use strict; use warnings; -use Test::More tests => 11; +use Test::More tests => 8; -BEGIN { - use_ok('Moose::Meta::Class'); - use_ok('Moose'); - use_ok('Moose::Role'); -} +use Moose::Meta::Class; { package Class; diff --git a/t/010_basics/016_load_into_main.t b/t/010_basics/016_load_into_main.t new file mode 100644 index 0000000..c8cc9fd --- /dev/null +++ b/t/010_basics/016_load_into_main.t @@ -0,0 +1,16 @@ +#!/usr/bin/perl + +use strict; +use warnings; + +use Test::More; + +BEGIN { + eval "use Test::Output;"; + plan skip_all => "Test::Output is required for this test" if $@; + plan tests => 1; +} + +stderr_is( sub { package main; eval 'use Moose' }, + "Moose does not export its sugar to the 'main' package.\n", + 'Moose warns when loaded from the main package' ); diff --git a/t/020_attributes/001_attribute_reader_generation.t b/t/020_attributes/001_attribute_reader_generation.t index 7ad1447..d27dbfc 100644 --- a/t/020_attributes/001_attribute_reader_generation.t +++ b/t/020_attributes/001_attribute_reader_generation.t @@ -3,12 +3,10 @@ use strict; use warnings; -use Test::More tests => 14; +use Test::More tests => 13; use Test::Exception; -BEGIN { - use_ok('Moose'); -} + { package Foo; diff --git a/t/020_attributes/002_attribute_writer_generation.t b/t/020_attributes/002_attribute_writer_generation.t index e803775..1b25f3c 100644 --- a/t/020_attributes/002_attribute_writer_generation.t +++ b/t/020_attributes/002_attribute_writer_generation.t @@ -3,14 +3,12 @@ use strict; use warnings; -use Test::More tests => 30; +use Test::More tests => 29; use Test::Exception; use Scalar::Util 'isweak'; -BEGIN { - use_ok('Moose'); -} + { package Foo; diff --git a/t/020_attributes/003_attribute_accessor_generation.t b/t/020_attributes/003_attribute_accessor_generation.t index d8b3638..0355c2b 100644 --- a/t/020_attributes/003_attribute_accessor_generation.t +++ b/t/020_attributes/003_attribute_accessor_generation.t @@ -3,14 +3,12 @@ use strict; use warnings; -use Test::More tests => 58; +use Test::More tests => 57; use Test::Exception; use Scalar::Util 'isweak'; -BEGIN { - use_ok('Moose'); -} + { package Foo; diff --git a/t/020_attributes/004_attribute_triggers.t b/t/020_attributes/004_attribute_triggers.t index b5cf34e..0695dc3 100644 --- a/t/020_attributes/004_attribute_triggers.t +++ b/t/020_attributes/004_attribute_triggers.t @@ -5,12 +5,10 @@ use warnings; use Scalar::Util 'isweak'; -use Test::More tests => 26; +use Test::More tests => 25; use Test::Exception; -BEGIN { - use_ok('Moose'); -} + { package Foo; diff --git a/t/020_attributes/005_attribute_does.t b/t/020_attributes/005_attribute_does.t index 8161537..d05a808 100644 --- a/t/020_attributes/005_attribute_does.t +++ b/t/020_attributes/005_attribute_does.t @@ -3,12 +3,10 @@ use strict; use warnings; -use Test::More tests => 10; +use Test::More tests => 9; use Test::Exception; -BEGIN { - use_ok('Moose'); -} + { package Foo::Role; diff --git a/t/020_attributes/006_attribute_required.t b/t/020_attributes/006_attribute_required.t index 4f65021..0975765 100644 --- a/t/020_attributes/006_attribute_required.t +++ b/t/020_attributes/006_attribute_required.t @@ -3,12 +3,10 @@ use strict; use warnings; -use Test::More tests => 16; +use Test::More tests => 15; use Test::Exception; -BEGIN { - use_ok('Moose'); -} + { package Foo; diff --git a/t/020_attributes/007_attribute_custom_metaclass.t b/t/020_attributes/007_attribute_custom_metaclass.t index a7b8bdb..eb74b0c 100644 --- a/t/020_attributes/007_attribute_custom_metaclass.t +++ b/t/020_attributes/007_attribute_custom_metaclass.t @@ -3,12 +3,10 @@ use strict; use warnings; -use Test::More tests => 17; +use Test::More tests => 16; use Test::Exception; -BEGIN { - use_ok('Moose'); -} + { package Foo::Meta::Attribute; diff --git a/t/020_attributes/008_attribute_type_unions.t b/t/020_attributes/008_attribute_type_unions.t index 05b94eb..95ce5f9 100644 --- a/t/020_attributes/008_attribute_type_unions.t +++ b/t/020_attributes/008_attribute_type_unions.t @@ -3,12 +3,10 @@ use strict; use warnings; -use Test::More tests => 19; +use Test::More tests => 18; use Test::Exception; -BEGIN { - use_ok('Moose'); -} + { package Foo; diff --git a/t/020_attributes/009_attribute_inherited_slot_specs.t b/t/020_attributes/009_attribute_inherited_slot_specs.t index 7f3b859..7d84bfc 100644 --- a/t/020_attributes/009_attribute_inherited_slot_specs.t +++ b/t/020_attributes/009_attribute_inherited_slot_specs.t @@ -3,12 +3,10 @@ use strict; use warnings; -use Test::More tests => 83; +use Test::More tests => 82; use Test::Exception; -BEGIN { - use_ok('Moose'); -} + { package Thing; diff --git a/t/020_attributes/010_attribute_delegation.t b/t/020_attributes/010_attribute_delegation.t index 2e6e585..91bcf17 100644 --- a/t/020_attributes/010_attribute_delegation.t +++ b/t/020_attributes/010_attribute_delegation.t @@ -3,12 +3,10 @@ use strict; use warnings; -use Test::More tests => 85; +use Test::More tests => 84; use Test::Exception; -BEGIN { - use_ok('Moose'); -} + # ------------------------------------------------------------------- # HASH handles diff --git a/t/020_attributes/012_misc_attribute_tests.t b/t/020_attributes/012_misc_attribute_tests.t index 24e3f70..a8f4bc0 100644 --- a/t/020_attributes/012_misc_attribute_tests.t +++ b/t/020_attributes/012_misc_attribute_tests.t @@ -3,12 +3,10 @@ use strict; use warnings; -use Test::More tests => 44; +use Test::More tests => 43; use Test::Exception; -BEGIN { - use_ok('Moose'); -} + { { diff --git a/t/020_attributes/013_attr_dereference_test.t b/t/020_attributes/013_attr_dereference_test.t index 903134b..11b75d7 100644 --- a/t/020_attributes/013_attr_dereference_test.t +++ b/t/020_attributes/013_attr_dereference_test.t @@ -3,12 +3,10 @@ use strict; use warnings; -use Test::More tests => 12; +use Test::More tests => 11; use Test::Exception; -BEGIN { - use_ok('Moose'); -} + { package Customer; diff --git a/t/020_attributes/014_misc_attribute_coerce_lazy.t b/t/020_attributes/014_misc_attribute_coerce_lazy.t index 37e354d..4fe4ee4 100644 --- a/t/020_attributes/014_misc_attribute_coerce_lazy.t +++ b/t/020_attributes/014_misc_attribute_coerce_lazy.t @@ -3,12 +3,10 @@ use strict; use warnings; -use Test::More tests => 3; +use Test::More tests => 2; use Test::Exception; -BEGIN { - use_ok('Moose'); -} + { package HTTPHeader; diff --git a/t/020_attributes/015_attribute_traits.t b/t/020_attributes/015_attribute_traits.t index 0cb44fd..189d212 100644 --- a/t/020_attributes/015_attribute_traits.t +++ b/t/020_attributes/015_attribute_traits.t @@ -3,13 +3,11 @@ use strict; use warnings; -use Test::More tests => 13; +use Test::More tests => 12; use Test::Exception; use Test::Moose; -BEGIN { - use_ok('Moose'); -} + { package My::Attribute::Trait; diff --git a/t/020_attributes/016_attribute_traits_registered.t b/t/020_attributes/016_attribute_traits_registered.t index 01b9536..91dc88a 100644 --- a/t/020_attributes/016_attribute_traits_registered.t +++ b/t/020_attributes/016_attribute_traits_registered.t @@ -3,13 +3,11 @@ use strict; use warnings; -use Test::More tests => 24; +use Test::More tests => 23; use Test::Exception; use Test::Moose; -BEGIN { - use_ok('Moose'); -} + { package My::Attribute::Trait; diff --git a/t/020_attributes/017_attribute_traits_n_meta.t b/t/020_attributes/017_attribute_traits_n_meta.t index 6930dc1..c4dc206 100644 --- a/t/020_attributes/017_attribute_traits_n_meta.t +++ b/t/020_attributes/017_attribute_traits_n_meta.t @@ -3,13 +3,11 @@ use strict; use warnings; -use Test::More tests => 8; +use Test::More tests => 7; use Test::Exception; use Test::Moose; -BEGIN { - use_ok('Moose'); -} + { package My::Meta::Attribute::DefaultReadOnly; diff --git a/t/020_attributes/018_no_init_arg.t b/t/020_attributes/018_no_init_arg.t index ae714ec..f5ebf87 100644 --- a/t/020_attributes/018_no_init_arg.t +++ b/t/020_attributes/018_no_init_arg.t @@ -3,12 +3,10 @@ use strict; use warnings; -use Test::More tests => 5; +use Test::More tests => 4; use Test::Exception; -BEGIN { - use_ok('Moose'); -} + { package Foo; diff --git a/t/020_attributes/019_attribute_lazy_initializer.t b/t/020_attributes/019_attribute_lazy_initializer.t index 2c6f9ac..6735822 100644 --- a/t/020_attributes/019_attribute_lazy_initializer.t +++ b/t/020_attributes/019_attribute_lazy_initializer.t @@ -3,12 +3,10 @@ use strict; use warnings; -use Test::More tests => 24; +use Test::More tests => 23; use Test::Exception; -BEGIN { - use_ok('Moose'); -} + { package Foo; diff --git a/t/020_attributes/020_trigger_and_coerce.t b/t/020_attributes/020_trigger_and_coerce.t index 712cacf..5d102ba 100644 --- a/t/020_attributes/020_trigger_and_coerce.t +++ b/t/020_attributes/020_trigger_and_coerce.t @@ -3,12 +3,10 @@ use strict; use warnings; -use Test::More tests => 12; +use Test::More tests => 11; use Test::Exception; -BEGIN { - use_ok('Moose'); -} + { package Fake::DateTime; diff --git a/t/020_attributes/021_method_generation_rules.t b/t/020_attributes/021_method_generation_rules.t index db96f52..d0fbe0b 100644 --- a/t/020_attributes/021_method_generation_rules.t +++ b/t/020_attributes/021_method_generation_rules.t @@ -3,12 +3,10 @@ use strict; use warnings; -use Test::More tests => 18; +use Test::More tests => 17; use Test::Exception; -BEGIN { - use_ok('Moose'); -} + =pod diff --git a/t/020_attributes/022_legal_options_for_inheritance.t b/t/020_attributes/022_legal_options_for_inheritance.t index a391465..e30cc97 100644 --- a/t/020_attributes/022_legal_options_for_inheritance.t +++ b/t/020_attributes/022_legal_options_for_inheritance.t @@ -2,11 +2,9 @@ use strict; use warnings; -use Test::More tests => 3; +use Test::More tests => 2; + -BEGIN { - use_ok('Moose'); -} { package Bar::Meta::Attribute; diff --git a/t/030_roles/001_meta_role.t b/t/030_roles/001_meta_role.t index c13b336..f8b377b 100644 --- a/t/030_roles/001_meta_role.t +++ b/t/030_roles/001_meta_role.t @@ -3,13 +3,10 @@ use strict; use warnings; -use Test::More tests => 29; +use Test::More tests => 27; use Test::Exception; -BEGIN { - use_ok('Moose'); - use_ok('Moose::Meta::Role'); -} +use Moose::Meta::Role; { package FooRole; diff --git a/t/030_roles/004_role_composition_errors.t b/t/030_roles/004_role_composition_errors.t index a96244c..0325dc4 100644 --- a/t/030_roles/004_role_composition_errors.t +++ b/t/030_roles/004_role_composition_errors.t @@ -3,12 +3,10 @@ use strict; use warnings; -use Test::More tests => 11; +use Test::More tests => 10; use Test::Exception; -BEGIN { - use_ok('Moose'); -} + { package Foo::Role; diff --git a/t/030_roles/005_role_conflict_detection.t b/t/030_roles/005_role_conflict_detection.t index 0c4f9a8..09a664e 100644 --- a/t/030_roles/005_role_conflict_detection.t +++ b/t/030_roles/005_role_conflict_detection.t @@ -3,14 +3,9 @@ use strict; use warnings; -use Test::More tests => 89; # it's really 126 with kolibre's tests; +use Test::More tests => 87; # it's really 124 with kolibre's tests; use Test::Exception; -BEGIN { - use_ok('Moose'); - use_ok('Moose::Role'); -} - =pod Mutually recursive roles. diff --git a/t/030_roles/006_role_exclusion.t b/t/030_roles/006_role_exclusion.t index 2f99164..578ba82 100644 --- a/t/030_roles/006_role_exclusion.t +++ b/t/030_roles/006_role_exclusion.t @@ -3,14 +3,9 @@ use strict; use warnings; -use Test::More tests => 24; +use Test::More tests => 22; use Test::Exception; -BEGIN { - use_ok('Moose'); - use_ok('Moose::Role'); -} - =pod The idea and examples for this feature are taken diff --git a/t/030_roles/007_roles_and_req_method_edge_cases.t b/t/030_roles/007_roles_and_req_method_edge_cases.t index fa63489..9017f85 100644 --- a/t/030_roles/007_roles_and_req_method_edge_cases.t +++ b/t/030_roles/007_roles_and_req_method_edge_cases.t @@ -3,7 +3,7 @@ use strict; use warnings; -use Test::More tests => 17; +use Test::More tests => 15; use Test::Exception; =pod @@ -16,15 +16,6 @@ are actually related to class construction order and not any real functionality. - SL -=cut - -BEGIN { - use_ok('Moose'); - use_ok('Moose::Role'); -} - -=pod - Role which requires a method implemented in another role as an override (it does not remove the requirement) diff --git a/t/030_roles/008_role_conflict_edge_cases.t b/t/030_roles/008_role_conflict_edge_cases.t index 9d31847..12e4873 100644 --- a/t/030_roles/008_role_conflict_edge_cases.t +++ b/t/030_roles/008_role_conflict_edge_cases.t @@ -3,14 +3,9 @@ use strict; use warnings; -use Test::More tests => 34; +use Test::More tests => 32; use Test::Exception; -BEGIN { - use_ok('Moose'); - use_ok('Moose::Role'); -} - =pod Check for repeated inheritence causing diff --git a/t/030_roles/009_more_role_edge_cases.t b/t/030_roles/009_more_role_edge_cases.t index 41f7a35..0fec31c 100644 --- a/t/030_roles/009_more_role_edge_cases.t +++ b/t/030_roles/009_more_role_edge_cases.t @@ -3,12 +3,10 @@ use strict; use warnings; -use Test::More tests => 75; +use Test::More tests => 74; use Test::Exception; -BEGIN { - use_ok('Moose'); -} + { # NOTE: diff --git a/t/030_roles/010_run_time_role_composition.t b/t/030_roles/010_run_time_role_composition.t index d4a5da9..1a86a18 100644 --- a/t/030_roles/010_run_time_role_composition.t +++ b/t/030_roles/010_run_time_role_composition.t @@ -3,13 +3,11 @@ use strict; use warnings; -use Test::More tests => 28; +use Test::More tests => 27; use Scalar::Util qw(blessed); -BEGIN { - use_ok('Moose'); -} + =pod diff --git a/t/030_roles/011_overriding.t b/t/030_roles/011_overriding.t index 1ebc3eb..1ee53e1 100644 --- a/t/030_roles/011_overriding.t +++ b/t/030_roles/011_overriding.t @@ -3,12 +3,10 @@ use strict; use warnings; -use Test::More tests => 40; +use Test::More tests => 39; use Test::Exception; -BEGIN { - use_ok('Moose'); -} + { # test no conflicts here diff --git a/t/030_roles/012_method_exclusion_in_composition.t b/t/030_roles/012_method_exclusion_in_composition.t index 30f77f4..b3128b3 100644 --- a/t/030_roles/012_method_exclusion_in_composition.t +++ b/t/030_roles/012_method_exclusion_in_composition.t @@ -3,12 +3,10 @@ use strict; use warnings; -use Test::More tests => 20; +use Test::More tests => 19; use Test::Exception; -BEGIN { - use_ok('Moose'); -} + { package My::Role; diff --git a/t/030_roles/013_method_aliasing_in_composition.t b/t/030_roles/013_method_aliasing_in_composition.t index 0405e13..4eeeed6 100644 --- a/t/030_roles/013_method_aliasing_in_composition.t +++ b/t/030_roles/013_method_aliasing_in_composition.t @@ -3,12 +3,10 @@ use strict; use warnings; -use Test::More tests => 36; +use Test::More tests => 35; use Test::Exception; -BEGIN { - use_ok('Moose'); -} + { package My::Role; diff --git a/t/030_roles/014_more_alias_and_exclude.t b/t/030_roles/014_more_alias_and_exclude.t index 3fce48d..346c636 100644 --- a/t/030_roles/014_more_alias_and_exclude.t +++ b/t/030_roles/014_more_alias_and_exclude.t @@ -3,12 +3,10 @@ use strict; use warnings; -use Test::More tests => 10; +use Test::More tests => 9; use Test::Exception; -BEGIN { - use_ok('Moose'); -} + { package Foo; diff --git a/t/030_roles/015_runtime_roles_and_attrs.t b/t/030_roles/015_runtime_roles_and_attrs.t index 3cf2fb6..a2b3842 100644 --- a/t/030_roles/015_runtime_roles_and_attrs.t +++ b/t/030_roles/015_runtime_roles_and_attrs.t @@ -3,13 +3,11 @@ use strict; use warnings; -use Test::More tests => 12; +use Test::More tests => 11; use Test::Exception; use Scalar::Util 'blessed'; -BEGIN { - use_ok('Moose'); -} + { diff --git a/t/030_roles/016_runtime_roles_and_nonmoose.t b/t/030_roles/016_runtime_roles_and_nonmoose.t index 056aef7..ecf1af0 100644 --- a/t/030_roles/016_runtime_roles_and_nonmoose.t +++ b/t/030_roles/016_runtime_roles_and_nonmoose.t @@ -3,13 +3,11 @@ use strict; use warnings; -use Test::More tests => 8; +use Test::More tests => 7; use Test::Exception; use Scalar::Util 'blessed'; -BEGIN { - use_ok('Moose'); -} + { diff --git a/t/030_roles/017_extending_role_attrs.t b/t/030_roles/017_extending_role_attrs.t index 2cb8c11..95572a5 100644 --- a/t/030_roles/017_extending_role_attrs.t +++ b/t/030_roles/017_extending_role_attrs.t @@ -3,12 +3,10 @@ use strict; use warnings; -use Test::More tests => 28; +use Test::More tests => 27; use Test::Exception; -BEGIN { - use_ok('Moose'); -} + =pod diff --git a/t/030_roles/018_runtime_roles_w_params.t b/t/030_roles/018_runtime_roles_w_params.t index 44941ee..d3eddae 100644 --- a/t/030_roles/018_runtime_roles_w_params.t +++ b/t/030_roles/018_runtime_roles_w_params.t @@ -3,12 +3,10 @@ use strict; use warnings; -use Test::More tests => 22; +use Test::More tests => 21; use Test::Exception; -BEGIN { - use_ok('Moose'); -} + { package Foo; diff --git a/t/030_roles/020_role_composite.t b/t/030_roles/020_role_composite.t index ff70579..506968e 100644 --- a/t/030_roles/020_role_composite.t +++ b/t/030_roles/020_role_composite.t @@ -3,14 +3,11 @@ use strict; use warnings; -use Test::More tests => 17; +use Test::More tests => 14; use Test::Exception; -BEGIN { - use_ok('Moose'); - use_ok('Moose::Meta::Role::Application::RoleSummation'); - use_ok('Moose::Meta::Role::Composite'); -} +use Moose::Meta::Role::Application::RoleSummation; +use Moose::Meta::Role::Composite; { package Role::Foo; diff --git a/t/030_roles/021_role_composite_exclusion.t b/t/030_roles/021_role_composite_exclusion.t index 4a1cad6..aa618f5 100644 --- a/t/030_roles/021_role_composite_exclusion.t +++ b/t/030_roles/021_role_composite_exclusion.t @@ -3,14 +3,11 @@ use strict; use warnings; -use Test::More tests => 15; +use Test::More tests => 12; use Test::Exception; -BEGIN { - use_ok('Moose'); - use_ok('Moose::Meta::Role::Application::RoleSummation'); - use_ok('Moose::Meta::Role::Composite'); -} +use Moose::Meta::Role::Application::RoleSummation; +use Moose::Meta::Role::Composite; { package Role::Foo; diff --git a/t/030_roles/022_role_composition_req_methods.t b/t/030_roles/022_role_composition_req_methods.t index 0d04cbc..be56016 100644 --- a/t/030_roles/022_role_composition_req_methods.t +++ b/t/030_roles/022_role_composition_req_methods.t @@ -3,14 +3,11 @@ use strict; use warnings; -use Test::More tests => 19; +use Test::More tests => 16; use Test::Exception; -BEGIN { - use_ok('Moose'); - use_ok('Moose::Meta::Role::Application::RoleSummation'); - use_ok('Moose::Meta::Role::Composite'); -} +use Moose::Meta::Role::Application::RoleSummation; +use Moose::Meta::Role::Composite; { package Role::Foo; diff --git a/t/030_roles/023_role_composition_attributes.t b/t/030_roles/023_role_composition_attributes.t index bc6da7e..b0e7ad2 100644 --- a/t/030_roles/023_role_composition_attributes.t +++ b/t/030_roles/023_role_composition_attributes.t @@ -3,14 +3,11 @@ use strict; use warnings; -use Test::More tests => 10; +use Test::More tests => 7; use Test::Exception; -BEGIN { - use_ok('Moose'); - use_ok('Moose::Meta::Role::Application::RoleSummation'); - use_ok('Moose::Meta::Role::Composite'); -} +use Moose::Meta::Role::Application::RoleSummation; +use Moose::Meta::Role::Composite; { package Role::Foo; diff --git a/t/030_roles/024_role_composition_methods.t b/t/030_roles/024_role_composition_methods.t index a77a4dc..36c3bff 100644 --- a/t/030_roles/024_role_composition_methods.t +++ b/t/030_roles/024_role_composition_methods.t @@ -3,14 +3,11 @@ use strict; use warnings; -use Test::More tests => 22; +use Test::More tests => 19; use Test::Exception; -BEGIN { - use_ok('Moose'); - use_ok('Moose::Meta::Role::Application::RoleSummation'); - use_ok('Moose::Meta::Role::Composite'); -} +use Moose::Meta::Role::Application::RoleSummation; +use Moose::Meta::Role::Composite; { package Role::Foo; diff --git a/t/030_roles/025_role_composition_override.t b/t/030_roles/025_role_composition_override.t index 9f38de3..33b61cd 100644 --- a/t/030_roles/025_role_composition_override.t +++ b/t/030_roles/025_role_composition_override.t @@ -3,14 +3,11 @@ use strict; use warnings; -use Test::More tests => 11; +use Test::More tests => 8; use Test::Exception; -BEGIN { - use_ok('Moose'); - use_ok('Moose::Meta::Role::Application::RoleSummation'); - use_ok('Moose::Meta::Role::Composite'); -} +use Moose::Meta::Role::Application::RoleSummation; +use Moose::Meta::Role::Composite; { package Role::Foo; diff --git a/t/030_roles/026_role_composition_method_mods.t b/t/030_roles/026_role_composition_method_mods.t index ce94eda..d83ee4e 100644 --- a/t/030_roles/026_role_composition_method_mods.t +++ b/t/030_roles/026_role_composition_method_mods.t @@ -3,14 +3,11 @@ use strict; use warnings; -use Test::More tests => 10; +use Test::More tests => 7; use Test::Exception; -BEGIN { - use_ok('Moose'); - use_ok('Moose::Meta::Role::Application::RoleSummation'); - use_ok('Moose::Meta::Role::Composite'); -} +use Moose::Meta::Role::Application::RoleSummation; +use Moose::Meta::Role::Composite; { package Role::Foo; diff --git a/t/030_roles/030_role_parameterized.t b/t/030_roles/030_role_parameterized.t index 75fbdc5..997520b 100644 --- a/t/030_roles/030_role_parameterized.t +++ b/t/030_roles/030_role_parameterized.t @@ -3,14 +3,9 @@ use strict; use warnings; -use Test::More tests => 1; +use Test::More skip_all => 'The feature this test exercises is not yet written'; use Test::Exception; -BEGIN { - use_ok('Moose'); -} - -=pod { package Scalar; @@ -40,6 +35,3 @@ is_deeply( sub eq { shift == shift } } - -=cut - diff --git a/t/040_type_constraints/006_util_type_reloading.t b/t/040_type_constraints/006_util_type_reloading.t index e0a253f..4cde153 100644 --- a/t/040_type_constraints/006_util_type_reloading.t +++ b/t/040_type_constraints/006_util_type_reloading.t @@ -5,12 +5,10 @@ use warnings; use lib 't/lib', 'lib'; -use Test::More tests => 5; +use Test::More tests => 4; use Test::Exception; -BEGIN { - use_ok('Moose'); -} + $SIG{__WARN__} = sub { 0 }; diff --git a/t/040_type_constraints/007_util_more_type_coercion.t b/t/040_type_constraints/007_util_more_type_coercion.t index 6480222..2bcafc1 100644 --- a/t/040_type_constraints/007_util_more_type_coercion.t +++ b/t/040_type_constraints/007_util_more_type_coercion.t @@ -3,12 +3,10 @@ use strict; use warnings; -use Test::More tests => 26; +use Test::More tests => 25; use Test::Exception; -BEGIN { - use_ok('Moose'); -} + { package HTTPHeader; diff --git a/t/040_type_constraints/009_union_types_and_coercions.t b/t/040_type_constraints/009_union_types_and_coercions.t index a7d33d9..69254f5 100644 --- a/t/040_type_constraints/009_union_types_and_coercions.t +++ b/t/040_type_constraints/009_union_types_and_coercions.t @@ -9,12 +9,10 @@ use Test::Exception; BEGIN { eval "use IO::String; use IO::File;"; plan skip_all => "IO::String and IO::File are required for this test" if $@; - plan tests => 29; + plan tests => 28; } -BEGIN { - use_ok('Moose'); -} + { package Email::Moose; diff --git a/t/040_type_constraints/021_maybe_type_constraint.t b/t/040_type_constraints/021_maybe_type_constraint.t index c4f62d7..06528d3 100644 --- a/t/040_type_constraints/021_maybe_type_constraint.t +++ b/t/040_type_constraints/021_maybe_type_constraint.t @@ -3,13 +3,10 @@ use strict; use warnings; -use Test::More tests => 19; +use Test::More tests => 17; use Test::Exception; -BEGIN { - use_ok('Moose'); - use_ok('Moose::Util::TypeConstraints'); -} +use Moose::Util::TypeConstraints; my $type = Moose::Util::TypeConstraints::find_or_parse_type_constraint('Maybe[Int]'); isa_ok($type, 'Moose::Meta::TypeConstraint'); diff --git a/t/040_type_constraints/023_types_and_undef.t b/t/040_type_constraints/023_types_and_undef.t index f5eccd1..f20ee2e 100644 --- a/t/040_type_constraints/023_types_and_undef.t +++ b/t/040_type_constraints/023_types_and_undef.t @@ -3,13 +3,10 @@ use strict; use warnings; -use Test::More tests => 55; +use Test::More tests => 54; use Test::Exception; -BEGIN -{ - use_ok('Moose'); -} + { package Foo; diff --git a/t/050_metaclasses/001_custom_attr_meta_with_roles.t b/t/050_metaclasses/001_custom_attr_meta_with_roles.t index e22cf9b..ba18c69 100644 --- a/t/050_metaclasses/001_custom_attr_meta_with_roles.t +++ b/t/050_metaclasses/001_custom_attr_meta_with_roles.t @@ -3,12 +3,10 @@ use strict; use warnings; -use Test::More tests => 4; +use Test::More tests => 3; use Test::Exception; -BEGIN { - use_ok('Moose'); -} + { package My::Custom::Meta::Attr; diff --git a/t/050_metaclasses/002_custom_attr_meta_as_role.t b/t/050_metaclasses/002_custom_attr_meta_as_role.t index e979ea9..6c0fbfe 100644 --- a/t/050_metaclasses/002_custom_attr_meta_as_role.t +++ b/t/050_metaclasses/002_custom_attr_meta_as_role.t @@ -3,12 +3,10 @@ use strict; use warnings; -use Test::More tests => 3; +use Test::More tests => 2; use Test::Exception; -BEGIN { - use_ok('Moose'); -}; +; lives_ok { package MooseX::Attribute::Test; diff --git a/t/050_metaclasses/003_moose_w_metaclass.t b/t/050_metaclasses/003_moose_w_metaclass.t index dce160b..bc6db3e 100644 --- a/t/050_metaclasses/003_moose_w_metaclass.t +++ b/t/050_metaclasses/003_moose_w_metaclass.t @@ -3,12 +3,10 @@ use strict; use warnings; -use Test::More tests => 5; +use Test::More tests => 4; use Test::Exception; -BEGIN { - use_ok('Moose'); -} + =pod diff --git a/t/050_metaclasses/004_moose_for_meta.t b/t/050_metaclasses/004_moose_for_meta.t index dc966cd..d355dbc 100644 --- a/t/050_metaclasses/004_moose_for_meta.t +++ b/t/050_metaclasses/004_moose_for_meta.t @@ -3,12 +3,10 @@ use strict; use warnings; -use Test::More tests => 17; +use Test::More tests => 16; use Test::Exception; -BEGIN { - use_ok('Moose'); -} + =pod diff --git a/t/050_metaclasses/010_extending_and_embedding.t b/t/050_metaclasses/010_extending_and_embedding.t index 3fce149..9771a73 100644 --- a/t/050_metaclasses/010_extending_and_embedding.t +++ b/t/050_metaclasses/010_extending_and_embedding.t @@ -3,12 +3,10 @@ use strict; use warnings; -use Test::More tests => 8; +use Test::More tests => 7; use Test::Exception; -BEGIN { - use_ok('Moose'); -} + BEGIN { package MyFramework::Base; diff --git a/t/050_metaclasses/011_init_meta.t b/t/050_metaclasses/011_init_meta.t index 0f83849..96290dd 100644 --- a/t/050_metaclasses/011_init_meta.t +++ b/t/050_metaclasses/011_init_meta.t @@ -3,11 +3,10 @@ use strict; use warnings; -use Test::More tests => 5; +use Test::More tests => 4; + +use Moose (); -BEGIN { - use_ok('Moose'); -} { package Foo; } diff --git a/t/060_compat/002_moose_respects_base.t b/t/060_compat/002_moose_respects_base.t index c967c22..e146561 100644 --- a/t/060_compat/002_moose_respects_base.t +++ b/t/060_compat/002_moose_respects_base.t @@ -3,12 +3,10 @@ use strict; use warnings; -use Test::More tests => 7; +use Test::More tests => 6; use Test::Exception; -BEGIN { - use_ok('Moose'); -} + =pod diff --git a/t/060_compat/003_foreign_inheritence.t b/t/060_compat/003_foreign_inheritence.t index 8fcb324..323b97e 100644 --- a/t/060_compat/003_foreign_inheritence.t +++ b/t/060_compat/003_foreign_inheritence.t @@ -3,12 +3,10 @@ use strict; use warnings; -use Test::More tests => 7; +use Test::More tests => 6; use Test::Exception; -BEGIN { - use_ok('Moose'); -} + { package Elk; diff --git a/t/100_bugs/001_subtype_quote_bug.t b/t/100_bugs/001_subtype_quote_bug.t index f01d168..a97e2d1 100644 --- a/t/100_bugs/001_subtype_quote_bug.t +++ b/t/100_bugs/001_subtype_quote_bug.t @@ -28,4 +28,5 @@ be well from now on. { package Object::Test; } -use_ok('Moose'); +package Foo; +::use_ok('Moose'); diff --git a/t/100_bugs/002_subtype_conflict_bug.t b/t/100_bugs/002_subtype_conflict_bug.t index 095213c..1dabe6c 100644 --- a/t/100_bugs/002_subtype_conflict_bug.t +++ b/t/100_bugs/002_subtype_conflict_bug.t @@ -5,11 +5,9 @@ use warnings; use lib 't/lib', 'lib'; -use Test::More tests => 3; +use Test::More tests => 2; + -BEGIN { - use_ok('Moose'); -} use_ok('MyMooseA'); use_ok('MyMooseB'); \ No newline at end of file diff --git a/t/100_bugs/004_subclass_use_base_bug.t b/t/100_bugs/004_subclass_use_base_bug.t index 6052f83..689cc21 100644 --- a/t/100_bugs/004_subclass_use_base_bug.t +++ b/t/100_bugs/004_subclass_use_base_bug.t @@ -3,11 +3,9 @@ use strict; use warnings; -use Test::More tests => 3; +use Test::More tests => 2; + -BEGIN { - use_ok('Moose'); -} =pod diff --git a/t/100_bugs/005_inline_reader_bug.t b/t/100_bugs/005_inline_reader_bug.t index 7321764..2e67750 100644 --- a/t/100_bugs/005_inline_reader_bug.t +++ b/t/100_bugs/005_inline_reader_bug.t @@ -3,12 +3,10 @@ use strict; use warnings; -use Test::More tests => 2; +use Test::More tests => 1; use Test::Exception; -BEGIN { - use_ok('Moose'); -} + =pod diff --git a/t/100_bugs/007_reader_precedence_bug.t b/t/100_bugs/007_reader_precedence_bug.t index b4c18cc..c36721f 100644 --- a/t/100_bugs/007_reader_precedence_bug.t +++ b/t/100_bugs/007_reader_precedence_bug.t @@ -2,7 +2,6 @@ use strict; use warnings; -use Moose; use Test::More tests => 3; diff --git a/t/100_bugs/008_new_w_undef.t b/t/100_bugs/008_new_w_undef.t index 58d7074..4001dc3 100644 --- a/t/100_bugs/008_new_w_undef.t +++ b/t/100_bugs/008_new_w_undef.t @@ -2,7 +2,6 @@ use strict; use warnings; -use Moose; use Test::More tests => 1; use Test::Exception; diff --git a/t/100_bugs/009_augment_recursion_bug.t b/t/100_bugs/009_augment_recursion_bug.t index df985e7..3e41104 100644 --- a/t/100_bugs/009_augment_recursion_bug.t +++ b/t/100_bugs/009_augment_recursion_bug.t @@ -3,11 +3,9 @@ use strict; use warnings; -use Test::More tests => 4; +use Test::More tests => 3; + -BEGIN { - use_ok('Moose'); -} { package Foo; diff --git a/t/100_bugs/010_immutable_n_default_x2.t b/t/100_bugs/010_immutable_n_default_x2.t index e5d3b19..5cc2fb0 100644 --- a/t/100_bugs/010_immutable_n_default_x2.t +++ b/t/100_bugs/010_immutable_n_default_x2.t @@ -3,11 +3,9 @@ use strict; use warnings; -use Test::More tests => 3; +use Test::More tests => 2; + -BEGIN { - use_ok('Moose'); -} { package Foo; diff --git a/t/100_bugs/011_DEMOLISH_eats_exceptions.t b/t/100_bugs/011_DEMOLISH_eats_exceptions.t index 10262f6..7574db7 100644 --- a/t/100_bugs/011_DEMOLISH_eats_exceptions.t +++ b/t/100_bugs/011_DEMOLISH_eats_exceptions.t @@ -4,13 +4,10 @@ use strict; use warnings; use FindBin; -use Test::More tests => 146; +use Test::More tests => 144; use Test::Exception; -BEGIN { - use_ok('Moose'); - use_ok('Moose::Util::TypeConstraints'); -} +use Moose::Util::TypeConstraints; subtype 'FilePath' => as 'Str' diff --git a/t/100_bugs/012_DEMOLISH_eats_mini.t b/t/100_bugs/012_DEMOLISH_eats_mini.t index 130e2c0..5773a60 100644 --- a/t/100_bugs/012_DEMOLISH_eats_mini.t +++ b/t/100_bugs/012_DEMOLISH_eats_mini.t @@ -3,12 +3,10 @@ use strict; use warnings; -use Test::More tests => 5; +use Test::More tests => 4; use Test::Exception; -BEGIN { - use_ok('Moose'); -} + { package Foo; diff --git a/t/100_bugs/016_inheriting_from_roles.t b/t/100_bugs/016_inheriting_from_roles.t index 4d423be..2fa0357 100644 --- a/t/100_bugs/016_inheriting_from_roles.t +++ b/t/100_bugs/016_inheriting_from_roles.t @@ -3,12 +3,10 @@ use strict; use warnings; -use Test::More tests => 2; +use Test::More tests => 1; use Test::Exception; -BEGIN { - use_ok('Moose'); -} + { package My::Role; diff --git a/t/100_bugs/017_type_constraint_messages.t b/t/100_bugs/017_type_constraint_messages.t index d425787..6740e81 100644 --- a/t/100_bugs/017_type_constraint_messages.t +++ b/t/100_bugs/017_type_constraint_messages.t @@ -6,9 +6,7 @@ use warnings; use Test::More no_plan => 1; use Test::Exception; -BEGIN { - use_ok('Moose'); -} + # RT #37569 diff --git a/t/100_bugs/018_immutable_metaclass_does_role.t b/t/100_bugs/018_immutable_metaclass_does_role.t index a245079..be4f016 100644 --- a/t/100_bugs/018_immutable_metaclass_does_role.t +++ b/t/100_bugs/018_immutable_metaclass_does_role.t @@ -3,12 +3,10 @@ use strict; use warnings; -use Test::More tests => 37; +use Test::More tests => 36; use Test::Exception; -BEGIN { - use_ok('Moose'); -} + BEGIN { package MyRole; diff --git a/t/200_examples/001_example.t b/t/200_examples/001_example.t index 33f9058..473da12 100644 --- a/t/200_examples/001_example.t +++ b/t/200_examples/001_example.t @@ -3,12 +3,10 @@ use strict; use warnings; -use Test::More tests => 21; +use Test::More tests => 20; use Test::Exception; -BEGIN { - use_ok('Moose'); -} + ## Roles diff --git a/t/200_examples/002_example_Moose_POOP.t b/t/200_examples/002_example_Moose_POOP.t index 0298123..9e5d472 100644 --- a/t/200_examples/002_example_Moose_POOP.t +++ b/t/200_examples/002_example_Moose_POOP.t @@ -10,7 +10,7 @@ BEGIN { plan skip_all => "DBM::Deep 1.0003 (or greater) is required for this test" if $@; eval "use DateTime::Format::MySQL;"; plan skip_all => "DateTime::Format::MySQL is required for this test" if $@; - plan tests => 89; + plan tests => 88; } use Test::Exception; @@ -24,9 +24,7 @@ END { unlink('newswriter.db') if -e 'newswriter.db'; } -BEGIN { - use_ok('Moose'); -} + =pod diff --git a/t/200_examples/003_example.t b/t/200_examples/003_example.t index 3c3e463..9e1c530 100644 --- a/t/200_examples/003_example.t +++ b/t/200_examples/003_example.t @@ -3,14 +3,9 @@ use strict; use warnings; -use Test::More tests => 32; +use Test::More tests => 30; use Test::Exception; -BEGIN { - use_ok('Moose'); - use_ok('Moose::Role'); -} - sub U { my $f = shift; sub { $f->($f, @_) }; diff --git a/t/200_examples/004_example_w_DCS.t b/t/200_examples/004_example_w_DCS.t index e8d1d25..3dd0e6a 100644 --- a/t/200_examples/004_example_w_DCS.t +++ b/t/200_examples/004_example_w_DCS.t @@ -17,16 +17,11 @@ Pretty well if I do say so myself :) BEGIN { eval "use Declare::Constraints::Simple;"; plan skip_all => "Declare::Constraints::Simple is required for this test" if $@; - plan tests => 11; + plan tests => 9; } use Test::Exception; -BEGIN { - use_ok('Moose'); - use_ok('Moose::Util::TypeConstraints'); -} - { package Foo; use Moose; diff --git a/t/200_examples/005_example_w_TestDeep.t b/t/200_examples/005_example_w_TestDeep.t index 53daaa8..cd33fa9 100644 --- a/t/200_examples/005_example_w_TestDeep.t +++ b/t/200_examples/005_example_w_TestDeep.t @@ -18,16 +18,11 @@ but it is not completely horrid either. BEGIN { eval "use Test::Deep;"; plan skip_all => "Test::Deep is required for this test" if $@; - plan tests => 7; + plan tests => 5; } use Test::Exception; -BEGIN { - use_ok('Moose'); - use_ok('Moose::Util::TypeConstraints'); -} - { package Foo; use Moose; diff --git a/t/200_examples/008_record_set_iterator.t b/t/200_examples/008_record_set_iterator.t index 990f2a8..00eac6b 100644 --- a/t/200_examples/008_record_set_iterator.t +++ b/t/200_examples/008_record_set_iterator.t @@ -3,12 +3,10 @@ use strict; use warnings; -use Test::More tests => 9; +use Test::More tests => 8; use Test::Exception; -BEGIN { - use_ok('Moose'); -} + { package Record; diff --git a/t/300_immutable/001_immutable_moose.t b/t/300_immutable/001_immutable_moose.t index 026d516..9d4e089 100644 --- a/t/300_immutable/001_immutable_moose.t +++ b/t/300_immutable/001_immutable_moose.t @@ -3,13 +3,11 @@ use strict; use warnings; -use Test::More tests => 17; +use Test::More tests => 15; use Test::Exception; -BEGIN { - use_ok('Moose'); - use_ok('Moose::Meta::Role'); -} +use Moose::Meta::Role; + { package FooRole; diff --git a/t/300_immutable/002_apply_roles_to_immutable.t b/t/300_immutable/002_apply_roles_to_immutable.t index c1ba765..e373311 100644 --- a/t/300_immutable/002_apply_roles_to_immutable.t +++ b/t/300_immutable/002_apply_roles_to_immutable.t @@ -3,12 +3,10 @@ use strict; use warnings; -use Test::More tests => 5; +use Test::More tests => 4; use Test::Exception; -BEGIN { - use_ok('Moose'); -} + { package My::Role; diff --git a/t/300_immutable/003_immutable_meta_class.t b/t/300_immutable/003_immutable_meta_class.t index a4214e9..d8b1c75 100644 --- a/t/300_immutable/003_immutable_meta_class.t +++ b/t/300_immutable/003_immutable_meta_class.t @@ -3,12 +3,10 @@ use strict; use warnings; -use Test::More tests => 2; +use Test::More tests => 1; use Test::Exception; -BEGIN { - use_ok('Moose'); -} + { package My::Meta; diff --git a/t/300_immutable/004_inlined_constructors_n_types.t b/t/300_immutable/004_inlined_constructors_n_types.t index 7830752..7e21b27 100644 --- a/t/300_immutable/004_inlined_constructors_n_types.t +++ b/t/300_immutable/004_inlined_constructors_n_types.t @@ -3,12 +3,10 @@ use strict; use warnings; -use Test::More tests => 4; +use Test::More tests => 3; use Test::Exception; -BEGIN { - use_ok('Moose'); -} + =pod diff --git a/t/300_immutable/005_multiple_demolish_inline.t b/t/300_immutable/005_multiple_demolish_inline.t index 4f543ce..53b31a0 100644 --- a/t/300_immutable/005_multiple_demolish_inline.t +++ b/t/300_immutable/005_multiple_demolish_inline.t @@ -3,12 +3,10 @@ use strict; use warnings; -use Test::More tests => 3; +use Test::More tests => 2; use Test::Exception; -BEGIN { - use_ok('Moose'); -} + { package Foo; diff --git a/t/300_immutable/006_immutable_nonmoose_subclass.t b/t/300_immutable/006_immutable_nonmoose_subclass.t index c04a44b..c3787e4 100644 --- a/t/300_immutable/006_immutable_nonmoose_subclass.t +++ b/t/300_immutable/006_immutable_nonmoose_subclass.t @@ -3,15 +3,10 @@ use strict; use warnings; -use Test::More tests => 10; +use Test::More tests => 8; use Test::Exception; use Scalar::Util 'blessed'; -BEGIN { - use_ok('Moose'); - use_ok('Moose::Meta::Role'); -} - =pod This test it kind of odd, it tests diff --git a/t/300_immutable/007_immutable_trigger_from_constructor.t b/t/300_immutable/007_immutable_trigger_from_constructor.t index 6a42b73..cab557f 100644 --- a/t/300_immutable/007_immutable_trigger_from_constructor.t +++ b/t/300_immutable/007_immutable_trigger_from_constructor.t @@ -3,12 +3,10 @@ use strict; use warnings; -use Test::More tests => 4; +use Test::More tests => 3; use Test::Exception; -BEGIN { - use_ok('Moose'); -} + { package AClass; diff --git a/t/300_immutable/008_immutable_constructor_error.t b/t/300_immutable/008_immutable_constructor_error.t index 1c235f4..62d6d3c 100644 --- a/t/300_immutable/008_immutable_constructor_error.t +++ b/t/300_immutable/008_immutable_constructor_error.t @@ -3,12 +3,10 @@ use strict; use warnings; -use Test::More tests => 3; +use Test::More tests => 2; use Test::Exception; -BEGIN { - use_ok('Moose'); -} + =pod diff --git a/t/600_todo_tests/005_moose_and_threads.t b/t/600_todo_tests/005_moose_and_threads.t index 4c77671..112e7bd 100644 --- a/t/600_todo_tests/005_moose_and_threads.t +++ b/t/600_todo_tests/005_moose_and_threads.t @@ -6,9 +6,7 @@ use warnings; use Test::More no_plan => 1; use Test::Exception; -BEGIN { - use_ok('Moose'); -} + =pod