Author: dagolden
Date: Sun Aug 30 19:58:47 2009
New Revision: 13238
Modified:
Module-Build/trunk/Changes
Module-Build/trunk/t/PL_files.t
Module-Build/trunk/t/README.pod
Module-Build/trunk/t/add_property.t
Module-Build/trunk/t/basic.t
Module-Build/trunk/t/compat.t
Module-Build/trunk/t/compat/exit.t
Module-Build/trunk/t/debug.t
Module-Build/trunk/t/destinations.t
Module-Build/trunk/t/ext.t
Module-Build/trunk/t/extend.t
Module-Build/trunk/t/files.t
Module-Build/trunk/t/help.t
Module-Build/trunk/t/install.t
Module-Build/trunk/t/install_extra_target.t
Module-Build/trunk/t/lib/MBTest.pm
Module-Build/trunk/t/manifypods.t
Module-Build/trunk/t/mbyaml.t
Module-Build/trunk/t/metadata.t
Module-Build/trunk/t/metadata2.t
Module-Build/trunk/t/moduleinfo.t
Module-Build/trunk/t/mymeta.t
Module-Build/trunk/t/new_from_context.t
Module-Build/trunk/t/notes.t
Module-Build/trunk/t/par.t
Module-Build/trunk/t/parents.t
Module-Build/trunk/t/pod_parser.t
Module-Build/trunk/t/ppm.t
Module-Build/trunk/t/runthrough.t
Module-Build/trunk/t/sample.t
Module-Build/trunk/t/script_dist.t
Module-Build/trunk/t/share_dir.t
Module-Build/trunk/t/signature.t
Module-Build/trunk/t/test_file_exts.t
Module-Build/trunk/t/test_type.t
Module-Build/trunk/t/test_types.t
Module-Build/trunk/t/tilde.t
Module-Build/trunk/t/use_tap_harness.t
Module-Build/trunk/t/versions.t
Module-Build/trunk/t/write_default_maniskip.t
Module-Build/trunk/t/xs.t
Log:
Standardize how tests load M::B from blib
Some tests used ensure_blib, others didn't. Some did require_ok
or use_ok and others just did "use Module::Build".
Replaced require_ok/ensure_blib with a single function: blib_load().
Applied blib_load consistently throughout test files and updated
t/README.pod to match.
Thank you, Eric Wilhelm, for the suggested approach and some code
Modified: Module-Build/trunk/Changes
==============================================================================
--- Module-Build/trunk/Changes (original)
+++ Module-Build/trunk/Changes Sun Aug 30 19:58:47 2009
@@ -18,6 +18,10 @@
option and tests fail, matching the behavior under Test::Harness.
(RT#49080) [initial patch from David Wheeler; revised by David Golden]
+ Other:
+ - Added t/README.pod and t/sample.t to guide developers writing new tests
+ [David Golden, with some code from Eric Wilhelm]
+
0.35 - Thu Aug 27 09:12:02 EDT 2009
Bug fixes:
Modified: Module-Build/trunk/t/PL_files.t
==============================================================================
--- Module-Build/trunk/t/PL_files.t (original)
+++ Module-Build/trunk/t/PL_files.t Sun Aug 30 19:58:47 2009
@@ -4,7 +4,7 @@
use lib $ENV{PERL_CORE} ? '../lib/Module/Build/t/lib' : 't/lib';
use MBTest tests => 8;
use DistGen;
-use Module::Build;
+blib_load('Module::Build');
my $dist;
Modified: Module-Build/trunk/t/README.pod
==============================================================================
--- Module-Build/trunk/t/README.pod (original)
+++ Module-Build/trunk/t/README.pod Sun Aug 30 19:58:47 2009
@@ -2,8 +2,8 @@
This document provides tips on writing new tests for Module::Build. Please
note that many existing tests were written prior to these guidelines and
-have many different styles. Please don't copy/paste old tests by rote without
-considering better ways to test. See C<sample.t> for a starter test file.
+have many different styles. Please don't copy/paste old tests by rote without
+considering better ways to test. See C<sample.t> for a starter test file.
=head1 TEST FILE PREAMBLE
@@ -15,31 +15,28 @@
use lib $ENV{PERL_CORE} ? '../lib/Module/Build/t/lib' : 't/lib';
use MBTest tests => 2; # or 'no_plan'
- # TESTS BEGIN HERE
-
- require_ok('Module::Build');
- ensure_blib('Module::Build');
+ blib_load('Module::Build');
The C<MBTest> module is in C<t/lib/> and subclasses Test::More. When loaded
-it cleans up several environment variables that could cause problems,
+it cleans up several environment variables that could cause problems,
tweaks C<@INC> and exports several helper functions. See that module for
details.
=head1 CREATING A TEST DISTRIBUTION
-The C<DistGen> module in C<t/lib/> should be used to create sample
-distributions for testing. It provides numerous helpful methods to
-create a skeleton distribution, add files, change files, and so on.
+The C<DistGen> module in C<t/lib/> should be used to create sample
+distributions for testing. It provides numerous helpful methods to
+create a skeleton distribution, add files, change files, and so on.
Run C<perldoc> on C<t/lib/DistGen.pm> to see the documentation.
# CREATE A TEST DISTRIBUTION
-
+
use DistGen;
# create dist object in a temp directory
- # MBTest uses different dirs for Perl core vs CPAN testing
+ # MBTest uses different dirs for Perl core vs CPAN testing
my $dist = DistGen->new( dir => MBTest->tmpdir );
-
+
# generate the skeleton files and also schedule cleanup
$dist->regen;
END{ $dist->remove }
Modified: Module-Build/trunk/t/add_property.t
==============================================================================
--- Module-Build/trunk/t/add_property.t (original)
+++ Module-Build/trunk/t/add_property.t Sun Aug 30 19:58:47 2009
@@ -2,12 +2,11 @@
use strict;
use lib $ENV{PERL_CORE} ? '../lib/Module/Build/t/lib' : 't/lib';
-use MBTest tests => 29;
+use MBTest tests => 27;
#use MBTest 'no_plan';
use DistGen;
-BEGIN { use_ok 'Module::Build' or die; }
-ensure_blib 'Module::Build';
+blib_load 'Module::Build';
my $tmp = MBTest->tmpdir;
my $dist = DistGen->new( dir => $tmp );
Modified: Module-Build/trunk/t/basic.t
==============================================================================
--- Module-Build/trunk/t/basic.t (original)
+++ Module-Build/trunk/t/basic.t Sun Aug 30 19:58:47 2009
@@ -2,10 +2,9 @@
use strict;
use lib $ENV{PERL_CORE} ? '../lib/Module/Build/t/lib' : 't/lib';
-use MBTest tests => 60;
+use MBTest tests => 58;
-use_ok 'Module::Build';
-ensure_blib('Module::Build');
+blib_load('Module::Build');
my $tmp = MBTest->tmpdir;
Modified: Module-Build/trunk/t/compat.t
==============================================================================
--- Module-Build/trunk/t/compat.t (original)
+++ Module-Build/trunk/t/compat.t Sun Aug 30 19:58:47 2009
@@ -25,8 +25,7 @@
my $is_vms_mms = ($^O eq 'VMS') && ($Config{make} =~ /MM[SK]/i);
-use_ok 'Module::Build';
-ensure_blib('Module::Build');
+blib_load('Module::Build');
#########################
@@ -43,8 +42,8 @@
#########################
-use Module::Build;
-use Module::Build::Compat;
+blib_load('Module::Build');
+blib_load('Module::Build::Compat');
use Carp; $SIG{__WARN__} = \&Carp::cluck;
Modified: Module-Build/trunk/t/compat/exit.t
==============================================================================
--- Module-Build/trunk/t/compat/exit.t (original)
+++ Module-Build/trunk/t/compat/exit.t Sun Aug 30 19:58:47 2009
@@ -3,10 +3,9 @@
use strict;
use lib $ENV{PERL_CORE} ? '../lib/Module/Build/t/lib' : 't/lib';
-use MBTest tests => 5;
+use MBTest tests => 3;
-use_ok 'Module::Build';
-ensure_blib('Module::Build');
+blib_load('Module::Build');
#########################
@@ -24,7 +23,7 @@
my $mb; stdout_of(sub{ $mb = Module::Build->new_from_context});
-use Module::Build::Compat;
+blib_load('Module::Build::Compat');
$dist->regen;
Modified: Module-Build/trunk/t/debug.t
==============================================================================
--- Module-Build/trunk/t/debug.t (original)
+++ Module-Build/trunk/t/debug.t Sun Aug 30 19:58:47 2009
@@ -2,10 +2,9 @@
use strict;
use lib $ENV{PERL_CORE} ? '../lib/Module/Build/t/lib' : 't/lib';
-use MBTest tests => 3;
+use MBTest tests => 1;
-require_ok('Module::Build');
-ensure_blib('Module::Build');
+blib_load('Module::Build');
my $tmp = MBTest->tmpdir;
Modified: Module-Build/trunk/t/destinations.t
==============================================================================
--- Module-Build/trunk/t/destinations.t (original)
+++ Module-Build/trunk/t/destinations.t Sun Aug 30 19:58:47 2009
@@ -2,10 +2,9 @@
use strict;
use lib $ENV{PERL_CORE} ? '../lib/Module/Build/t/lib' : 't/lib';
-use MBTest tests => 115;
+use MBTest tests => 113;
-use_ok 'Module::Build';
-ensure_blib('Module::Build');
+blib_load('Module::Build');
my $tmp = MBTest->tmpdir;
Modified: Module-Build/trunk/t/ext.t
==============================================================================
--- Module-Build/trunk/t/ext.t (original)
+++ Module-Build/trunk/t/ext.t Sun Aug 30 19:58:47 2009
@@ -4,8 +4,6 @@
use lib $ENV{PERL_CORE} ? '../lib/Module/Build/t/lib' : 't/lib';
use MBTest;
-use Module::Build;
-
my @unix_splits =
(
{ q{one t'wo th'ree f"o\"ur " "five" } => [ 'one', 'two three', 'fo"ur ',
'five' ] },
@@ -58,9 +56,11 @@
{ 'a " b " c' => [ 'a', ' b ', 'c' ] },
);
-plan tests => 10 + 4...@unix_splits + 4...@win_splits;
+plan tests => 9 + 4...@unix_splits + 4...@win_splits;
-ensure_blib('Module::Build');
+blib_load('Module::Build');
+blib_load('Module::Build::Platform::Unix');
+blib_load('Module::Build::Platform::Windows');
#########################
@@ -74,7 +74,6 @@
# I think 3.24 isn't actually the majik version, my 3.23 seems to pass...
my $low_TPW_version = Text::ParseWords->VERSION < 3.24;
-use Module::Build::Platform::Unix;
foreach my $test (@unix_splits) {
# Text::ParseWords bug:
local $TODO = $low_TPW_version && ((keys %$test)[0] =~ m{\\\n});
@@ -82,7 +81,6 @@
do_split_tests('Module::Build::Platform::Unix', $test);
}
-use Module::Build::Platform::Windows;
foreach my $test (@win_splits) {
do_split_tests('Module::Build::Platform::Windows', $test);
}
Modified: Module-Build/trunk/t/extend.t
==============================================================================
--- Module-Build/trunk/t/extend.t (original)
+++ Module-Build/trunk/t/extend.t Sun Aug 30 19:58:47 2009
@@ -2,10 +2,9 @@
use strict;
use lib $ENV{PERL_CORE} ? '../lib/Module/Build/t/lib' : 't/lib';
-use MBTest tests => 66;
+use MBTest tests => 64;
-use_ok 'Module::Build';
-ensure_blib('Module::Build');
+blib_load('Module::Build');
my $tmp = MBTest->tmpdir;
Modified: Module-Build/trunk/t/files.t
==============================================================================
--- Module-Build/trunk/t/files.t (original)
+++ Module-Build/trunk/t/files.t Sun Aug 30 19:58:47 2009
@@ -2,10 +2,9 @@
use strict;
use lib $ENV{PERL_CORE} ? '../lib/Module/Build/t/lib' : 't/lib';
-use MBTest tests => 6;
+use MBTest tests => 4;
-use_ok 'Module::Build';
-ensure_blib('Module::Build');
+blib_load('Module::Build');
use IO::File;
my $tmp = MBTest->tmpdir;
Modified: Module-Build/trunk/t/help.t
==============================================================================
--- Module-Build/trunk/t/help.t (original)
+++ Module-Build/trunk/t/help.t Sun Aug 30 19:58:47 2009
@@ -2,10 +2,9 @@
use strict;
use lib $ENV{PERL_CORE} ? '../lib/Module/Build/t/lib' : 't/lib';
-use MBTest tests => 25;
+use MBTest tests => 23;
-use_ok 'Module::Build';
-ensure_blib('Module::Build');
+blib_load('Module::Build');
use Cwd ();
use File::Path ();
Modified: Module-Build/trunk/t/install.t
==============================================================================
--- Module-Build/trunk/t/install.t (original)
+++ Module-Build/trunk/t/install.t Sun Aug 30 19:58:47 2009
@@ -2,10 +2,9 @@
use strict;
use lib $ENV{PERL_CORE} ? '../lib/Module/Build/t/lib' : 't/lib';
-use MBTest tests => 36;
+use MBTest tests => 34;
-use_ok 'Module::Build';
-ensure_blib('Module::Build');
+blib_load('Module::Build');
use Config;
use Cwd ();
Modified: Module-Build/trunk/t/install_extra_target.t
==============================================================================
--- Module-Build/trunk/t/install_extra_target.t (original)
+++ Module-Build/trunk/t/install_extra_target.t Sun Aug 30 19:58:47 2009
@@ -3,10 +3,9 @@
use strict;
use lib $ENV{PERL_CORE} ? '../lib/Module/Build/t/lib' : 't/lib';
-use MBTest tests => 8;
+use MBTest tests => 6;
-require_ok 'Module::Build';
-ensure_blib('Module::Build');
+blib_load('Module::Build');
use File::Spec::Functions qw( catdir );
Modified: Module-Build/trunk/t/lib/MBTest.pm
==============================================================================
--- Module-Build/trunk/t/lib/MBTest.pm (original)
+++ Module-Build/trunk/t/lib/MBTest.pm Sun Aug 30 19:58:47 2009
@@ -92,7 +92,7 @@
find_in_path
check_compiler
have_module
- ensure_blib
+ blib_load
);
push @EXPORT, @extra_exports;
__PACKAGE__->export(scalar caller, @extra_exports);
@@ -196,6 +196,7 @@
local $SIG{__WARN__} = sub {};
+ blib_load('Module::Build');
my $mb = Module::Build->current;
$mb->verbose( 0 );
@@ -220,21 +221,23 @@
sub have_module {
my $module = shift;
- return eval "use $module; 1";
+ return eval "require $module; 1";
}
-sub ensure_blib {
- # Make sure the given module was loaded from blib/, not the larger system
+sub blib_load {
+ # Load the given module and ensure it came from blib/, not the larger system
my $mod = shift;
+ have_module($mod) or die "Error loading $mod\: $...@\n";
+
(my $path = $mod) =~ s{::}{/}g;
-
- local $Test::Builder::Level = $Test::Builder::Level + 1;
- SKIP: {
- skip "no blib in core", 1 if $ENV{PERL_CORE};
- like $INC{"$path.pm"}, qr/\bblib\b/, "Make sure $mod was loaded from blib/"
- or diag "PERL5LIB: " . ($ENV{PERL5LIB} || '') . "\n" .
- "PERL5OPT: " . ($ENV{PERL5OPT} || '') . "\n" .
- "\...@inc contains:\n " . join("\n ", @INC) . "\n";
+ $path .= ".pm";
+ my ($pkg, $file, $line) = caller;
+ unless($ENV{PERL_CORE}) {
+ unless($INC{$path} =~ m/\bblib\b/) {
+ (my $load_from = $INC{$path}) =~ s{$path$}{};
+ die "$mod loaded from '$load_from'\nIt should have been loaded from
blib. \...@inc contains:\n ",
+ join("\n ", @INC) . "\nFatal error occured in blib_load() at $file,
line $line.\n";
+ }
}
}
Modified: Module-Build/trunk/t/manifypods.t
==============================================================================
--- Module-Build/trunk/t/manifypods.t (original)
+++ Module-Build/trunk/t/manifypods.t Sun Aug 30 19:58:47 2009
@@ -3,15 +3,14 @@
use strict;
use lib $ENV{PERL_CORE} ? '../lib/Module/Build/t/lib' : 't/lib';
use MBTest;
-use Module::Build;
-use Module::Build::ConfigData;
+blib_load('Module::Build');
+blib_load('Module::Build::ConfigData');
if ( Module::Build::ConfigData->feature('manpage_support') ) {
- plan tests => 22;
+ plan tests => 21;
} else {
plan skip_all => 'manpage_support feature is not enabled';
}
-ensure_blib('Module::Build');
#########################
Modified: Module-Build/trunk/t/mbyaml.t
==============================================================================
--- Module-Build/trunk/t/mbyaml.t (original)
+++ Module-Build/trunk/t/mbyaml.t Sun Aug 30 19:58:47 2009
@@ -4,8 +4,7 @@
use lib $ENV{PERL_CORE} ? '../lib/Module/Build/t/lib' : 't/lib';
use MBTest 'no_plan';
-use_ok 'Module::Build::YAML';
-ensure_blib('Module::Build::YAML');
+blib_load('Module::Build::YAML');
my ($dir);
$dir = ".";
Modified: Module-Build/trunk/t/metadata.t
==============================================================================
--- Module-Build/trunk/t/metadata.t (original)
+++ Module-Build/trunk/t/metadata.t Sun Aug 30 19:58:47 2009
@@ -2,15 +2,13 @@
use strict;
use lib $ENV{PERL_CORE} ? '../lib/Module/Build/t/lib' : 't/lib';
-use MBTest tests => 53;
+use MBTest tests => 51;
-use_ok 'Module::Build';
-ensure_blib('Module::Build');
+blib_load('Module::Build');
+blib_load('Module::Build::ConfigData');
my $tmp = MBTest->tmpdir;
-use Module::Build::ConfigData;
-
my %metadata =
(
module_name => 'Simple',
@@ -56,7 +54,6 @@
$dist->chdir_in;
-use Module::Build;
my $mb = Module::Build->new_from_context;
##################################################
Modified: Module-Build/trunk/t/metadata2.t
==============================================================================
--- Module-Build/trunk/t/metadata2.t (original)
+++ Module-Build/trunk/t/metadata2.t Sun Aug 30 19:58:47 2009
@@ -2,14 +2,12 @@
use strict;
use lib $ENV{PERL_CORE} ? '../lib/Module/Build/t/lib' : 't/lib';
-use MBTest tests => 20;
+use MBTest tests => 18;
-use_ok 'Module::Build';
-ensure_blib('Module::Build');
+blib_load('Module::Build');
+blib_load('Module::Build::ConfigData');
my $tmp = MBTest->tmpdir;
-
-use Module::Build::ConfigData;
use DistGen;
Modified: Module-Build/trunk/t/moduleinfo.t
==============================================================================
--- Module-Build/trunk/t/moduleinfo.t (original)
+++ Module-Build/trunk/t/moduleinfo.t Sun Aug 30 19:58:47 2009
@@ -4,10 +4,9 @@
use strict;
use lib $ENV{PERL_CORE} ? '../lib/Module/Build/t/lib' : 't/lib';
-use MBTest tests => 82;
+use MBTest tests => 80;
-use_ok 'Module::Build::ModuleInfo';
-ensure_blib('Module::Build::ModuleInfo');
+blib_load('Module::Build::ModuleInfo');
my $tmp = MBTest->tmpdir;
Modified: Module-Build/trunk/t/mymeta.t
==============================================================================
--- Module-Build/trunk/t/mymeta.t (original)
+++ Module-Build/trunk/t/mymeta.t Sun Aug 30 19:58:47 2009
@@ -2,10 +2,9 @@
use strict;
use lib $ENV{PERL_CORE} ? '../lib/Module/Build/t/lib' : 't/lib';
-use MBTest tests => 5;
+use MBTest tests => 3;
-require_ok('Module::Build');
-ensure_blib('Module::Build');
+blib_load('Module::Build');
my $tmp = MBTest->tmpdir;
Modified: Module-Build/trunk/t/new_from_context.t
==============================================================================
--- Module-Build/trunk/t/new_from_context.t (original)
+++ Module-Build/trunk/t/new_from_context.t Sun Aug 30 19:58:47 2009
@@ -2,10 +2,9 @@
use strict;
use lib $ENV{PERL_CORE} ? '../lib/Module/Build/t/lib' : 't/lib';
-use MBTest tests => 4;
+use MBTest tests => 2;
-use_ok 'Module::Build';
-ensure_blib('Module::Build');
+blib_load('Module::Build');
use IO::File;
my $tmp = MBTest->tmpdir;
Modified: Module-Build/trunk/t/notes.t
==============================================================================
--- Module-Build/trunk/t/notes.t (original)
+++ Module-Build/trunk/t/notes.t Sun Aug 30 19:58:47 2009
@@ -2,10 +2,9 @@
use strict;
use lib $ENV{PERL_CORE} ? '../lib/Module/Build/t/lib' : 't/lib';
-use MBTest tests => 13;
+use MBTest tests => 11;
-use_ok 'Module::Build';
-ensure_blib('Module::Build');
+blib_load('Module::Build');
my $tmp = MBTest->tmpdir;
Modified: Module-Build/trunk/t/par.t
==============================================================================
--- Module-Build/trunk/t/par.t (original)
+++ Module-Build/trunk/t/par.t Sun Aug 30 19:58:47 2009
@@ -3,8 +3,8 @@
use strict;
use lib $ENV{PERL_CORE} ? '../lib/Module/Build/t/lib' : 't/lib';
use MBTest;
-use Module::Build;
-use Module::Build::ConfigData;
+blib_load('Module::Build');
+blib_load('Module::Build::ConfigData');
{
my ($have_c_compiler, $C_support_feature) = check_compiler();
@@ -17,10 +17,9 @@
} elsif ( ! eval {require Archive::Zip} ) {
plan skip_all => "Archive::Zip required.";
} else {
- plan tests => 4;
+ plan tests => 3;
}
}
-ensure_blib('Module::Build');
my $tmp = MBTest->tmpdir;
@@ -58,7 +57,6 @@
use File::Spec::Functions qw(catdir);
-use Module::Build;
my @installstyle = qw(lib perl5);
my $mb = Module::Build->new_from_context(
verbose => 0,
Modified: Module-Build/trunk/t/parents.t
==============================================================================
--- Module-Build/trunk/t/parents.t (original)
+++ Module-Build/trunk/t/parents.t Sun Aug 30 19:58:47 2009
@@ -2,10 +2,9 @@
use strict;
use lib $ENV{PERL_CORE} ? '../lib/Module/Build/t/lib' : 't/lib';
-use MBTest tests => 28;
+use MBTest tests => 26;
-use_ok 'Module::Build';
-ensure_blib('Module::Build');
+blib_load('Module::Build');
#########################
Modified: Module-Build/trunk/t/pod_parser.t
==============================================================================
--- Module-Build/trunk/t/pod_parser.t (original)
+++ Module-Build/trunk/t/pod_parser.t Sun Aug 30 19:58:47 2009
@@ -2,10 +2,9 @@
use strict;
use lib $ENV{PERL_CORE} ? '../lib/Module/Build/t/lib' : 't/lib';
-use MBTest tests => 8;
+use MBTest tests => 6;
-use_ok 'Module::Build::PodParser';
-ensure_blib('Module::Build::PodParser');
+blib_load('Module::Build::PodParser');
#########################
Modified: Module-Build/trunk/t/ppm.t
==============================================================================
--- Module-Build/trunk/t/ppm.t (original)
+++ Module-Build/trunk/t/ppm.t Sun Aug 30 19:58:47 2009
@@ -3,11 +3,10 @@
use strict;
use lib $ENV{PERL_CORE} ? '../lib/Module/Build/t/lib' : 't/lib';
use MBTest;
-
-use Module::Build;
-use Module::Build::ConfigData;
use Config;
+blib_load('Module::Build');
+blib_load('Module::Build::ConfigData');
my $manpage_support = Module::Build::ConfigData->feature('manpage_support');
my $HTML_support = Module::Build::ConfigData->feature('HTML_support');
@@ -26,15 +25,13 @@
} elsif ( $^O eq 'VMS' ) {
plan skip_all => "Needs porting work on VMS";
} else {
- plan tests => 13;
+ plan tests => 12;
}
}
-ensure_blib('Module::Build');
my $tmp = MBTest->tmpdir;
-
use DistGen;
my $dist = DistGen->new( dir => $tmp, xs => 1 );
$dist->add_file( 'hello', <<'---' );
@@ -66,7 +63,6 @@
use File::Spec::Functions qw(catdir);
-use Module::Build;
my @installstyle = qw(lib perl5);
my $mb = Module::Build->new_from_context(
verbose => 0,
Modified: Module-Build/trunk/t/runthrough.t
==============================================================================
--- Module-Build/trunk/t/runthrough.t (original)
+++ Module-Build/trunk/t/runthrough.t Sun Aug 30 19:58:47 2009
@@ -2,12 +2,10 @@
use strict;
use lib $ENV{PERL_CORE} ? '../lib/Module/Build/t/lib' : 't/lib';
-use MBTest tests => 32;
+use MBTest tests => 30;
-use_ok 'Module::Build';
-ensure_blib('Module::Build');
-
-use Module::Build::ConfigData;
+blib_load('Module::Build');
+blib_load('Module::Build::ConfigData');
my $have_yaml = Module::Build::ConfigData->feature('YAML_support');
#########################
Modified: Module-Build/trunk/t/sample.t
==============================================================================
--- Module-Build/trunk/t/sample.t (original)
+++ Module-Build/trunk/t/sample.t Sun Aug 30 19:58:47 2009
@@ -2,17 +2,15 @@
use strict;
use lib $ENV{PERL_CORE} ? '../lib/Module/Build/t/lib' : 't/lib';
-use MBTest tests => 4; # or 'no_plan'
+use MBTest tests => 2; # or 'no_plan'
use DistGen;
-# TESTS BEGIN HERE
-
-require_ok('Module::Build');
-ensure_blib('Module::Build');
+# Ensure any Module::Build modules are loaded from correct directory
+blib_load('Module::Build');
# create dist object in a temp directory
# MBTest uses different dirs for Perl core vs CPAN testing
-my $dist = DistGen->new( dir => MBTest->tmpdir );
+my $dist = DistGen->new;
# generate the skeleton files and also schedule cleanup
$dist->regen;
@@ -26,3 +24,4 @@
isa_ok( $mb, "Module::Build" );
is( $mb->dist_name, "Simple", "dist_name is 'Simple'" );
+# vim:ts=2:sw=2:et:sta:sts=2
Modified: Module-Build/trunk/t/script_dist.t
==============================================================================
--- Module-Build/trunk/t/script_dist.t (original)
+++ Module-Build/trunk/t/script_dist.t Sun Aug 30 19:58:47 2009
@@ -8,7 +8,8 @@
use DistGen qw(undent);
-use Module::Build;
+blib_load('Module::Build');
+blib_load('Module::Build::ConfigData');
# XXX DistGen shouldn't be assuming module-ness?
my $dist = DistGen->new(dir => MBTest->tmpdir);
@@ -69,7 +70,6 @@
['A. U. Thor, [email protected]']);
ok $mb->dispatch('distmeta');
-use Module::Build::ConfigData;
SKIP: {
skip( 'YAML_support feature is not enabled', 1 )
unless Module::Build::ConfigData->feature('YAML_support');
Modified: Module-Build/trunk/t/share_dir.t
==============================================================================
--- Module-Build/trunk/t/share_dir.t (original)
+++ Module-Build/trunk/t/share_dir.t Sun Aug 30 19:58:47 2009
@@ -9,10 +9,9 @@
# Begin testing
#--------------------------------------------------------------------------#
-plan tests => 21;
+plan tests => 19;
-require_ok('Module::Build');
-ensure_blib('Module::Build');
+blib_load('Module::Build');
#--------------------------------------------------------------------------#
# Create test distribution
Modified: Module-Build/trunk/t/signature.t
==============================================================================
--- Module-Build/trunk/t/signature.t (original)
+++ Module-Build/trunk/t/signature.t Sun Aug 30 19:58:47 2009
@@ -6,7 +6,7 @@
if ( $ENV{TEST_SIGNATURE} ) {
if ( have_module( 'Module::Signature' ) ) {
- plan tests => 15;
+ plan tests => 14;
} else {
plan skip_all => '$ENV{TEST_SIGNATURE} is set, but Module::Signature not
found';
}
@@ -14,8 +14,7 @@
plan skip_all => '$ENV{TEST_SIGNATURE} is not set';
}
-use_ok 'Module::Build';
-ensure_blib('Module::Build');
+blib_load('Module::Build');
#########################
Modified: Module-Build/trunk/t/test_file_exts.t
==============================================================================
--- Module-Build/trunk/t/test_file_exts.t (original)
+++ Module-Build/trunk/t/test_file_exts.t Sun Aug 30 19:58:47 2009
@@ -2,11 +2,10 @@
use strict;
use lib $ENV{PERL_CORE} ? '../lib/Module/Build/t/lib' : 't/lib';
-use MBTest tests => 5;
+use MBTest tests => 3;
use DistGen;
-use_ok 'Module::Build';
-ensure_blib('Module::Build');
+blib_load('Module::Build');
my $tmp = MBTest->tmpdir;
my $dist = DistGen->new( dir => $tmp );
Modified: Module-Build/trunk/t/test_type.t
==============================================================================
--- Module-Build/trunk/t/test_type.t (original)
+++ Module-Build/trunk/t/test_type.t Sun Aug 30 19:58:47 2009
@@ -9,10 +9,9 @@
use strict;
use lib $ENV{PERL_CORE} ? '../lib/Module/Build/t/lib' : 't/lib';
-use MBTest tests => 9;
+use MBTest tests => 7;
-use_ok 'Module::Build';
-ensure_blib('Module::Build');
+blib_load('Module::Build');
my $tmp = MBTest->tmpdir;
Modified: Module-Build/trunk/t/test_types.t
==============================================================================
--- Module-Build/trunk/t/test_types.t (original)
+++ Module-Build/trunk/t/test_types.t Sun Aug 30 19:58:47 2009
@@ -2,10 +2,9 @@
use strict;
use lib $ENV{PERL_CORE} ? '../lib/Module/Build/t/lib' : 't/lib';
-use MBTest tests => 15 + 12;
+use MBTest tests => 25;
-use_ok 'Module::Build';
-ensure_blib('Module::Build');
+blib_load('Module::Build');
my $tmp = MBTest->tmpdir;
Modified: Module-Build/trunk/t/tilde.t
==============================================================================
--- Module-Build/trunk/t/tilde.t (original)
+++ Module-Build/trunk/t/tilde.t Sun Aug 30 19:58:47 2009
@@ -4,10 +4,9 @@
use strict;
use lib $ENV{PERL_CORE} ? '../lib/Module/Build/t/lib' : 't/lib';
-use MBTest tests => 18;
+use MBTest tests => 16;
-use_ok 'Module::Build';
-ensure_blib('Module::Build');
+blib_load('Module::Build');
my $tmp = MBTest->tmpdir;
Modified: Module-Build/trunk/t/use_tap_harness.t
==============================================================================
--- Module-Build/trunk/t/use_tap_harness.t (original)
+++ Module-Build/trunk/t/use_tap_harness.t Sun Aug 30 19:58:47 2009
@@ -4,7 +4,7 @@
use Test::More;
use lib $ENV{PERL_CORE} ? '../lib/Module/Build/t/lib' : 't/lib';
if (eval { require TAP::Harness } && TAP::Harness->VERSION >= 3) {
- plan tests => 11;
+ plan tests => 9;
} else {
plan skip_all => 'TAP::Harness 3+ not installed'
}
@@ -12,8 +12,7 @@
use MBTest;
use DistGen;
-use_ok 'Module::Build';
-ensure_blib('Module::Build');
+blib_load('Module::Build');
my $tmp = MBTest->tmpdir;
my $dist = DistGen->new( dir => $tmp );
$dist->regen;
@@ -86,7 +85,7 @@
ok $mb = $dist->new_from_context,
'Construct build object after setting tests to fail';
# Use uc() so we don't confuse the current test output
-my $out = stdout_stderr_of( sub { $dist->run_build('test')} );
+$out = stdout_stderr_of( sub { $dist->run_build('test')} );
ok( $?, "'Build test' had non-zero exit code" );
like( $out, qr{Failed 1/1 test programs. 1/1 subtests failed\.},
"Saw emulated Test::Harness die() message"
Modified: Module-Build/trunk/t/versions.t
==============================================================================
--- Module-Build/trunk/t/versions.t (original)
+++ Module-Build/trunk/t/versions.t Sun Aug 30 19:58:47 2009
@@ -2,10 +2,9 @@
use strict;
use lib $ENV{PERL_CORE} ? '../lib/Module/Build/t/lib' : 't/lib';
-use MBTest tests => 4;
+use MBTest tests => 2;
-use_ok 'Module::Build';
-ensure_blib('Module::Build');
+blib_load('Module::Build');
my $tmp = MBTest->tmpdir;
Modified: Module-Build/trunk/t/write_default_maniskip.t
==============================================================================
--- Module-Build/trunk/t/write_default_maniskip.t (original)
+++ Module-Build/trunk/t/write_default_maniskip.t Sun Aug 30 19:58:47 2009
@@ -8,8 +8,7 @@
use DistGen;
use Cwd;
-use_ok 'Module::Build';
-ensure_blib 'Module::Build';
+blib_load('Module::Build');
{
my $cwd = Cwd::cwd;
Modified: Module-Build/trunk/t/xs.t
==============================================================================
--- Module-Build/trunk/t/xs.t (original)
+++ Module-Build/trunk/t/xs.t Sun Aug 30 19:58:47 2009
@@ -3,11 +3,12 @@
use strict;
use lib $ENV{PERL_CORE} ? '../lib/Module/Build/t/lib' : 't/lib';
use MBTest;
-use Module::Build;
use Config;
my $tmp;
+blib_load('Module::Build');
+
{
my ($have_c_compiler, $C_support_feature, $tmp_exec) = check_compiler();
@@ -20,13 +21,12 @@
} elsif ( !$Config{usedl} ) {
plan skip_all => 'Perl not compiled for dynamic loading'
} else {
- plan tests => 23;
+ plan tests => 22;
}
require Cwd;
$tmp = MBTest->tmpdir( $tmp_exec ? undef : Cwd::cwd );
}
-ensure_blib('Module::Build');
#########################