[Module-build-checkins] Module-Build/t basic.t,1.42,1.43 compat.t,1.30,1.31 destinations.t,1.21,1.22
Status: Beta
Brought to you by:
kwilliams
|
From: Randy W. S. <si...@us...> - 2005-06-29 08:27:20
|
Update of /cvsroot/module-build/Module-Build/t In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13337/t Modified Files: basic.t compat.t destinations.t extend.t files.t install.t manifypods.t notes.t runthrough.t signature.t xs.t Log Message: Use consistent variable names across all test modules. Index: files.t =================================================================== RCS file: /cvsroot/module-build/Module-Build/t/files.t,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- files.t 29 Jun 2005 07:50:40 -0000 1.7 +++ files.t 29 Jun 2005 08:27:06 -0000 1.8 @@ -22,7 +22,7 @@ use Module::Build; -my $m = Module::Build->new_from_context; +my $mb = Module::Build->new_from_context; my @files; { @@ -31,7 +31,7 @@ my @tmp; foreach (1..2) { my $tmp = File::Spec->catdir('t', "tmp$_"); - $m->add_to_cleanup($tmp); + $mb->add_to_cleanup($tmp); push @files, $tmp; unless (-d $tmp) { mkdir($tmp, 0777) or die "Can't create $tmp: $!"; @@ -49,7 +49,7 @@ ok -e $file; - my $file2 = $m->copy_if_modified(from => $file, to_dir => $tmp[2]); + my $file2 = $mb->copy_if_modified(from => $file, to_dir => $tmp[2]); ok $file2; ok -e $file2; } Index: signature.t =================================================================== RCS file: /cvsroot/module-build/Module-Build/t/signature.t,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- signature.t 29 Jun 2005 07:50:41 -0000 1.11 +++ signature.t 29 Jun 2005 08:27:06 -0000 1.12 @@ -47,13 +47,13 @@ use Module::Build; -my $build = Module::Build->new_from_context; +my $mb = Module::Build->new_from_context; { - eval {$build->dispatch('distdir')}; + eval {$mb->dispatch('distdir')}; ok ! $@; - chdir( $build->dist_dir ) or die "Can't chdir to '@{[$build->dist_dir]}': $!"; + chdir( $mb->dist_dir ) or die "Can't chdir to '@{[$mb->dist_dir]}': $!"; ok -e 'SIGNATURE'; # Make sure the signature actually verifies @@ -69,14 +69,14 @@ local $^W; # Skip 'redefined' warnings local *Module::Signature::sign = sub { push @run_order, 'sign' }; local *Module::Build::Base::ACTION_distmeta = sub { push @run_order, 'distmeta' }; - eval { $build->dispatch('distdir') }; + eval { $mb->dispatch('distdir') }; } ok ! $@; is $run_order[0], 'distmeta'; is $run_order[1], 'sign'; } -eval { $build->dispatch('realclean') }; +eval { $mb->dispatch('realclean') }; ok ! $@; Index: compat.t =================================================================== RCS file: /cvsroot/module-build/Module-Build/t/compat.t,v retrieving revision 1.30 retrieving revision 1.31 diff -u -d -r1.30 -r1.31 --- compat.t 29 Jun 2005 07:50:40 -0000 1.30 +++ compat.t 29 Jun 2005 08:27:06 -0000 1.31 @@ -53,27 +53,27 @@ ######################### -my $build = Module::Build->new_from_context; -ok $build; +my $mb = Module::Build->new_from_context; +ok $mb; foreach my $type (@makefile_types) { - Module::Build::Compat->create_makefile_pl($type, $build); - test_makefile_creation($build); + Module::Build::Compat->create_makefile_pl($type, $mb); + test_makefile_creation($mb); - ok $build->do_system(@make); + ok $mb->do_system(@make); # Can't let 'test' STDOUT go to our STDOUT, or it'll confuse Test::Harness. my $success; my $output = stdout_of( sub { - $success = $build->do_system(@make, 'test'); + $success = $mb->do_system(@make, 'test'); } ); ok $success; like uc $output, qr{DONE\.|SUCCESS}; - ok $build->do_system(@make, 'realclean'); + ok $mb->do_system(@make, 'realclean'); # Try again with some Makefile.PL arguments - test_makefile_creation($build, [], 'INSTALLDIRS=vendor', 1); + test_makefile_creation($mb, [], 'INSTALLDIRS=vendor', 1); 1 while unlink 'Makefile.PL'; ok ! -e 'Makefile.PL'; @@ -102,7 +102,7 @@ # Should fail with "can't find Foo/Builder.pm" my $warning = stderr_of (sub { - my $result = $build->run_perl_script('Makefile.PL'); + my $result = $mb->run_perl_script('Makefile.PL'); ok ! $result; }); like $warning, qr{Foo/Builder.pm}; @@ -113,24 +113,24 @@ foreach my $style ('passthrough', 'small') { Module::Build::Compat->create_makefile_pl($style, $bar_builder); ok -e 'Makefile.PL'; - ok $build->run_perl_script('Makefile.PL'); + ok $mb->run_perl_script('Makefile.PL'); } } { # Make sure various Makefile.PL arguments are supported - Module::Build::Compat->create_makefile_pl('passthrough', $build); + Module::Build::Compat->create_makefile_pl('passthrough', $mb); my $libdir = File::Spec->catdir( $cwd, 't', 'libdir' ); - my $result = $build->run_perl_script('Makefile.PL', [], - [ - 'SKIP_RCFILE=1', - "LIB=$libdir", - 'TEST_VERBOSE=1', - 'INSTALLDIRS=perl', - 'POLLUTE=1', - ] - ); + my $result = $mb->run_perl_script('Makefile.PL', [], + [ + 'SKIP_RCFILE=1', + "LIB=$libdir", + 'TEST_VERBOSE=1', + 'INSTALLDIRS=perl', + 'POLLUTE=1', + ] + ); ok $result; ok -e 'Build.PL'; @@ -148,16 +148,16 @@ like $output, qr/(?:# ok \d+\s+)+/, 'Should be verbose'; # Make sure various Makefile arguments are supported - $output = stdout_of( sub { $ran_ok = $build->do_system(@make, 'test', 'TEST_VERBOSE=0') } ); + $output = stdout_of( sub { $ran_ok = $mb->do_system(@make, 'test', 'TEST_VERBOSE=0') } ); ok $ran_ok; $output =~ s/^/# /gm; # Don't confuse our own test output like $output, qr/(?:# .+basic\.+ok\s+(?:[\d.]s\s*)?)+# All tests/, 'Should be non-verbose'; - $build->delete_filetree($libdir); + $mb->delete_filetree($libdir); ok ! -e $libdir, "Sample installation directory should be cleaned up"; - $build->do_system(@make, 'realclean'); + $mb->do_system(@make, 'realclean'); ok ! -e 'Makefile', "Makefile shouldn't exist"; 1 while unlink 'Makefile.PL'; @@ -169,14 +169,14 @@ # C<glob> on MSWin32 uses $ENV{HOME} if defined to do tilde-expansion local $ENV{HOME} = 'C:/' if $^O =~ /MSWin/ && !exists( $ENV{HOME} ); - Module::Build::Compat->create_makefile_pl('passthrough', $build); + Module::Build::Compat->create_makefile_pl('passthrough', $mb); - $build->run_perl_script('Makefile.PL', [], ['INSTALL_BASE=~/foo']); + $mb->run_perl_script('Makefile.PL', [], ['INSTALL_BASE=~/foo']); my $b2 = Module::Build->current; ok $b2->install_base; unlike $b2->install_base, qr/^~/, "Tildes should be expanded"; - $build->do_system(@make, 'realclean'); + $mb->do_system(@make, 'realclean'); 1 while unlink 'Makefile.PL'; } ######################################################### Index: install.t =================================================================== RCS file: /cvsroot/module-build/Module-Build/t/install.t,v retrieving revision 1.21 retrieving revision 1.22 diff -u -d -r1.21 -r1.22 --- install.t 29 Jun 2005 07:50:40 -0000 1.21 +++ install.t 29 Jun 2005 08:27:06 -0000 1.22 @@ -44,18 +44,18 @@ --- $dist->regen; -my $build = Module::Build->new_from_context; -ok $build; +my $mb = Module::Build->new_from_context; +ok $mb; my $destdir = File::Spec->catdir($cwd, 't', 'install_test'); -$build->add_to_cleanup($destdir); +$mb->add_to_cleanup($destdir); { - eval {$build->dispatch('install', destdir => $destdir)}; + eval {$mb->dispatch('install', destdir => $destdir)}; ok ! $@; - my $libdir = strip_volume( $build->install_destination('lib') ); + my $libdir = strip_volume( $mb->install_destination('lib') ); my $install_to = File::Spec->catfile($destdir, $libdir, $dist->name ) . '.pm'; print "Should have installed module as $install_to\n"; ok -e $install_to; @@ -65,14 +65,14 @@ ok ! $@; # Make sure there's a packlist installed - my $archdir = $build->install_destination('arch'); + my $archdir = $mb->install_destination('arch'); my ($v, $d) = File::Spec->splitpath($archdir, 1); my $packlist = File::Spec->catdir($destdir, $d, 'auto', $dist->name, '.packlist'); is -e $packlist, 1, "$packlist should be written"; } { - eval {$build->dispatch('install', installdirs => 'core', destdir => $destdir)}; + eval {$mb->dispatch('install', installdirs => 'core', destdir => $destdir)}; ok ! $@; my $libdir = strip_volume( $Config{installprivlib} ); my $install_to = File::Spec->catfile($destdir, $libdir, $dist->name ) . '.pm'; @@ -82,7 +82,7 @@ { my $libdir = File::Spec->catdir(File::Spec->rootdir, 'foo', 'bar'); - eval {$build->dispatch('install', install_path => {lib => $libdir}, destdir => $destdir)}; + eval {$mb->dispatch('install', install_path => {lib => $libdir}, destdir => $destdir)}; is $@, ''; my $install_to = File::Spec->catfile($destdir, $libdir, $dist->name ) . '.pm'; print "Should have installed module as $install_to\n"; @@ -91,7 +91,7 @@ { my $libdir = File::Spec->catdir(File::Spec->rootdir, 'foo', 'base'); - eval {$build->dispatch('install', install_base => $libdir, destdir => $destdir)}; + eval {$mb->dispatch('install', install_base => $libdir, destdir => $destdir)}; is $@, ''; my $install_to = File::Spec->catfile($destdir, $libdir, 'lib', 'perl5', $dist->name ) . '.pm'; print "Should have installed module as $install_to\n"; @@ -101,17 +101,17 @@ { # Test the ConfigData stuff - $build->config_data(foo => 'bar'); - $build->features(baz => 1); - $build->auto_features(auto_foo => {requires => {'File::Spec' => 0}}); - eval {$build->dispatch('install', destdir => $destdir)}; + $mb->config_data(foo => 'bar'); + $mb->features(baz => 1); + $mb->auto_features(auto_foo => {requires => {'File::Spec' => 0}}); + eval {$mb->dispatch('install', destdir => $destdir)}; is $@, ''; - my $libdir = strip_volume( $build->install_destination('lib') ); + my $libdir = strip_volume( $mb->install_destination('lib') ); local @INC = (@INC, File::Spec->catdir($destdir, $libdir)); eval "require @{[$dist->name]}::ConfigData"; - is $build->feature('auto_foo'), 1; + is $mb->feature('auto_foo'), 1; SKIP: { skip $@, 5 if @_; @@ -139,40 +139,40 @@ } -eval {$build->dispatch('realclean')}; +eval {$mb->dispatch('realclean')}; is $@, ''; { # Try again by running the script rather than with programmatic interface my $libdir = File::Spec->catdir('', 'foo', 'lib'); - eval {$build->run_perl_script('Build.PL', [], ['--install_path', "lib=$libdir"])}; + eval {$mb->run_perl_script('Build.PL', [], ['--install_path', "lib=$libdir"])}; is $@, ''; - eval {$build->run_perl_script('Build', [], ['install', '--destdir', $destdir])}; + eval {$mb->run_perl_script('Build', [], ['install', '--destdir', $destdir])}; is $@, ''; my $install_to = File::Spec->catfile($destdir, $libdir, $dist->name ) . '.pm'; print "# Should have installed module as $install_to\n"; ok -e $install_to; my $basedir = File::Spec->catdir('', 'bar'); - eval {$build->run_perl_script('Build', [], ['install', '--destdir', $destdir, + eval {$mb->run_perl_script('Build', [], ['install', '--destdir', $destdir, '--install_base', $basedir])}; is $@, ''; $install_to = File::Spec->catfile($destdir, $libdir, $dist->name ) . '.pm'; is -e $install_to, 1, "Look for file at $install_to"; - eval {$build->dispatch('realclean')}; + eval {$mb->dispatch('realclean')}; is $@, ''; } { # Make sure 'install_path' overrides 'install_base' - my $build = Module::Build->new( module_name => $dist->name, + my $mb = Module::Build->new( module_name => $dist->name, install_base => File::Spec->catdir('', 'foo'), install_path => {lib => File::Spec->catdir('', 'bar')}); - ok $build; - is $build->install_destination('lib'), File::Spec->catdir('', 'bar'); + ok $mb; + is $mb->install_destination('lib'), File::Spec->catdir('', 'bar'); } { @@ -191,16 +191,16 @@ # _find_file_by_type() isn't a public method, but this is currently # the only easy way to test that it works properly. - my $pods = $build->_find_file_by_type('pod', 'lib'); + my $pods = $mb->_find_file_by_type('pod', 'lib'); is keys %$pods, 1; - my $expect = $build->localize_file_path('lib/Simple/Docs.pod'); + my $expect = $mb->localize_file_path('lib/Simple/Docs.pod'); is $pods->{$expect}, $expect; - my $pms = $build->_find_file_by_type('awefawef', 'lib'); + my $pms = $mb->_find_file_by_type('awefawef', 'lib'); ok $pms; is keys %$pms, 0; - $pms = $build->_find_file_by_type('pod', 'awefawef'); + $pms = $mb->_find_file_by_type('pod', 'awefawef'); ok $pms; is keys %$pms, 0; Index: xs.t =================================================================== RCS file: /cvsroot/module-build/Module-Build/t/xs.t,v retrieving revision 1.24 retrieving revision 1.25 diff -u -d -r1.24 -r1.25 --- xs.t 29 Jun 2005 07:55:57 -0000 1.24 +++ xs.t 29 Jun 2005 08:27:07 -0000 1.25 @@ -15,13 +15,13 @@ { local $SIG{__WARN__} = sub {}; - my $m = Module::Build->current; - $m->verbose( 0 ); + my $mb = Module::Build->current; + $mb->verbose( 0 ); my $have_c_compiler; - stderr_of( sub {$have_c_compiler = $m->have_c_compiler} ); + stderr_of( sub {$have_c_compiler = $mb->have_c_compiler} ); - if ( ! $m->feature('C_support') ) { + if ( ! $mb->feature('C_support') ) { plan skip_all => 'C_support not enabled'; } elsif ( !$have_c_compiler ) { plan skip_all => 'C_support enabled, but no compiler found'; @@ -42,40 +42,40 @@ $dist->regen; chdir( $dist->dirname ) or die "Can't chdir to '@{[$dist->dirname]}': $!"; -my $m = Module::Build->new_from_context( skip_rcfile => 1 ); +my $mb = Module::Build->new_from_context( skip_rcfile => 1 ); -eval {$m->dispatch('clean')}; +eval {$mb->dispatch('clean')}; ok ! $@; -eval {$m->dispatch('build')}; +eval {$mb->dispatch('build')}; ok ! $@; { # Try again in a subprocess - eval {$m->dispatch('clean')}; + eval {$mb->dispatch('clean')}; ok ! $@; - $m->create_build_script; + $mb->create_build_script; ok -e 'Build'; - eval {$m->run_perl_script('Build')}; + eval {$mb->run_perl_script('Build')}; ok ! $@; } # We can't be verbose in the sub-test, because Test::Harness will # think that the output is for the top-level test. -eval {$m->dispatch('test')}; +eval {$mb->dispatch('test')}; ok ! $@; { - $m->dispatch('ppd', args => {codebase => '/path/to/codebase-xs'}); + $mb->dispatch('ppd', args => {codebase => '/path/to/codebase-xs'}); (my $dist_filename = $dist->name) =~ s/::/-/g; my $ppd = slurp($dist_filename . '.ppd'); - my $perl_version = Module::Build::PPMMaker->_ppd_version($m->perl_version); - my $varchname = Module::Build::PPMMaker->_varchname($m->config); + my $perl_version = Module::Build::PPMMaker->_ppd_version($mb->perl_version); + my $varchname = Module::Build::PPMMaker->_varchname($mb->config); # This test is quite a hack since with XML you don't really want to # do a strict string comparison, but absent an XML parser it's the @@ -97,17 +97,17 @@ SKIP: { skip( "skipping a couple Unixish-only tests", 2 ) - unless $m->os_type eq 'Unix'; + unless $mb->os_type eq 'Unix'; - eval {$m->dispatch('clean')}; + eval {$mb->dispatch('clean')}; ok ! $@; - local $m->{config}{ld} = "FOO=BAR $m->{config}{ld}"; - eval {$m->dispatch('build')}; + local $mb->{config}{ld} = "FOO=BAR $mb->{config}{ld}"; + eval {$mb->dispatch('build')}; ok ! $@; } -eval {$m->dispatch('realclean')}; +eval {$mb->dispatch('realclean')}; ok ! $@; # Make sure blib/ is gone after 'realclean' Index: manifypods.t =================================================================== RCS file: /cvsroot/module-build/Module-Build/t/manifypods.t,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- manifypods.t 29 Jun 2005 07:50:40 -0000 1.13 +++ manifypods.t 29 Jun 2005 08:27:06 -0000 1.14 @@ -68,25 +68,25 @@ my $destdir = File::Spec->catdir($cwd, 't', 'install_test'); -my $m = Module::Build->new( +my $mb = Module::Build->new( install_base => $destdir, module_name => $dist->name, scripts => [ File::Spec->catfile( 'bin', 'nopod.pl' ), File::Spec->catfile( 'bin', 'haspod.pl' ) ], ); -$m->add_to_cleanup($destdir); +$mb->add_to_cleanup($destdir); -is( ref $m->{properties}->{bindoc_dirs}, 'ARRAY', 'bindoc_dirs' ); -is( ref $m->{properties}->{libdoc_dirs}, 'ARRAY', 'libdoc_dirs' ); +is( ref $mb->{properties}->{bindoc_dirs}, 'ARRAY', 'bindoc_dirs' ); +is( ref $mb->{properties}->{libdoc_dirs}, 'ARRAY', 'libdoc_dirs' ); my %man = ( - sep => $m->manpage_separator, + sep => $mb->manpage_separator, dir1 => 'man1', dir3 => 'man3', - ext1 => $m->{config}{man1ext}, - ext3 => $m->{config}{man3ext}, + ext1 => $mb->{config}{man1ext}, + ext3 => $mb->{config}{man3ext}, ); my %distro = ( @@ -97,26 +97,26 @@ 'lib/Simple/AllPod.pod' => "Simple$man{sep}AllPod.$man{ext3}", ); -%distro = map {$m->localize_file_path($_), $distro{$_}} keys %distro; +%distro = map {$mb->localize_file_path($_), $distro{$_}} keys %distro; -$m->dispatch('build'); +$mb->dispatch('build'); -eval {$m->dispatch('docs')}; +eval {$mb->dispatch('docs')}; ok ! $@; while (my ($from, $v) = each %distro) { if (!$v) { - ok ! $m->contains_pod($from), "$from should not contain POD"; + ok ! $mb->contains_pod($from), "$from should not contain POD"; next; } my $to = File::Spec->catfile('blib', ($from =~ /^lib/ ? 'libdoc' : 'bindoc'), $v); - ok $m->contains_pod($from), "$from should contain POD"; + ok $mb->contains_pod($from), "$from should contain POD"; ok -e $to, "Created $to manpage"; } -$m->dispatch('install'); +$mb->dispatch('install'); while (my ($from, $v) = each %distro) { next unless $v; @@ -124,7 +124,7 @@ ok -e $to, "Created $to manpage"; } -$m->dispatch('realclean'); +$mb->dispatch('realclean'); # revert to a pristine state @@ -135,20 +135,20 @@ chdir( $dist->dirname ) or die "Can't chdir to '@{[$dist->dirname]}': $!"; -my $m2 = Module::Build->new( +my $mb2 = Module::Build->new( module_name => $dist->name, libdoc_dirs => [qw( foo bar baz )], ); -is( $m2->{properties}->{libdoc_dirs}->[0], 'foo', 'override libdoc_dirs' ); +is( $mb2->{properties}->{libdoc_dirs}->[0], 'foo', 'override libdoc_dirs' ); # Make sure we can find our own action documentation -ok $m2->get_action_docs('build'); -ok !$m2->get_action_docs('foo'); +ok $mb2->get_action_docs('build'); +ok !$mb2->get_action_docs('foo'); # Make sure those docs are the correct ones foreach ('ppd', 'disttest') { - my $docs = $m2->get_action_docs($_); + my $docs = $mb2->get_action_docs($_); like $docs, qr/=item $_/; unlike $docs, qr/\n=/, $docs; } Index: runthrough.t =================================================================== RCS file: /cvsroot/module-build/Module-Build/t/runthrough.t,v retrieving revision 1.56 retrieving revision 1.57 diff -u -d -r1.56 -r1.57 --- runthrough.t 29 Jun 2005 07:50:40 -0000 1.56 +++ runthrough.t 29 Jun 2005 08:27:06 -0000 1.57 @@ -72,36 +72,36 @@ ######################### -my $build = Module::Build->new_from_context; -ok $build; -is $build->license, 'perl'; +my $mb = Module::Build->new_from_context; +ok $mb; +is $mb->license, 'perl'; # Make sure cleanup files added before create_build_script() get respected -$build->add_to_cleanup('before_script'); +$mb->add_to_cleanup('before_script'); -eval {$build->create_build_script}; +eval {$mb->create_build_script}; ok ! $@; -ok -e $build->build_script; +ok -e $mb->build_script; -is $build->dist_dir, 'Simple-0.01'; +is $mb->dist_dir, 'Simple-0.01'; # The 'cleanup' file doesn't exist yet -ok grep {$_ eq 'before_script'} $build->cleanup; +ok grep {$_ eq 'before_script'} $mb->cleanup; -$build->add_to_cleanup('save_out'); +$mb->add_to_cleanup('save_out'); # The 'cleanup' file now exists -ok grep {$_ eq 'before_script'} $build->cleanup; -ok grep {$_ eq 'save_out' } $build->cleanup; +ok grep {$_ eq 'before_script'} $mb->cleanup; +ok grep {$_ eq 'save_out' } $mb->cleanup; my $output = eval { - stdout_of( sub { $build->dispatch('test', verbose => 1) } ) + stdout_of( sub { $mb->dispatch('test', verbose => 1) } ) }; ok ! $@; like $output, qr/all tests successful/i; # This is the output of lib/Simple/Script.PL -ok -e $build->localize_file_path('lib/Simple/Script'); +ok -e $mb->localize_file_path('lib/Simple/Script'); # We prefix all lines with "| " so Test::Harness doesn't get confused. @@ -113,13 +113,13 @@ SKIP: { skip( 'YAML_support feature is not enabled', 7 ) unless $have_yaml; - eval {$build->dispatch('disttest')}; + eval {$mb->dispatch('disttest')}; ok ! $@; # After a test, the distdir should contain a blib/ directory ok -e File::Spec->catdir('Simple-0.01', 'blib'); - eval {$build->dispatch('distdir')}; + eval {$mb->dispatch('distdir')}; ok ! $@; # The 'distdir' should contain a lib/ directory @@ -133,15 +133,15 @@ my $fh = IO::File->new(File::Spec->catfile($dist->dirname, 'META.yml')); my $contents = do {local $/; <$fh>}; $contents =~ /Module::Build version ([0-9_.]+)/m; - is $1, $build->VERSION, "Check version used to create META.yml: $1 == " . $build->VERSION; + is $1, $mb->VERSION, "Check version used to create META.yml: $1 == " . $mb->VERSION; SKIP: { skip( "not sure if we can create a tarball on this platform", 1 ) - unless $build->check_installed_status('Archive::Tar', 0) || - $build->isa('Module::Build::Platform::Unix'); + unless $mb->check_installed_status('Archive::Tar', 0) || + $mb->isa('Module::Build::Platform::Unix'); - $build->add_to_cleanup($build->dist_dir . ".tar.gz"); - eval {$build->dispatch('dist')}; + $mb->add_to_cleanup($mb->dist_dir . ".tar.gz"); + eval {$mb->dispatch('dist')}; ok ! $@; } @@ -149,7 +149,7 @@ { # Make sure the 'script' file was recognized as a script. - my $scripts = $build->script_files; + my $scripts = $mb->script_files; ok $scripts->{script}; # Check that a shebang line is rewritten @@ -165,7 +165,7 @@ { # Check PPD - $build->dispatch('ppd', args => {codebase => '/path/to/codebase'}); + $mb->dispatch('ppd', args => {codebase => '/path/to/codebase'}); my $ppd = slurp('Simple.ppd'); @@ -186,12 +186,12 @@ } -eval {$build->dispatch('realclean')}; +eval {$mb->dispatch('realclean')}; ok ! $@; -ok ! -e $build->build_script; -ok ! -e $build->config_dir; -ok ! -e $build->dist_dir; +ok ! -e $mb->build_script; +ok ! -e $mb->config_dir; +ok ! -e $mb->dist_dir; # cleanup Index: extend.t =================================================================== RCS file: /cvsroot/module-build/Module-Build/t/extend.t,v retrieving revision 1.17 retrieving revision 1.18 diff -u -d -r1.17 -r1.18 --- extend.t 29 Jun 2005 07:50:40 -0000 1.17 +++ extend.t 29 Jun 2005 08:27:06 -0000 1.18 @@ -28,19 +28,19 @@ # Here we make sure actions are only called once per dispatch() $::x = 0; -my $m = Module::Build->subclass +my $mb = Module::Build->subclass ( code => "sub ACTION_loop { die 'recursed' if \$::x++; shift->depends_on('loop'); }" )->new( module_name => $dist->name ); -ok $m; +ok $mb; -$m->dispatch('loop'); +$mb->dispatch('loop'); ok $::x; -$m->dispatch('realclean'); +$mb->dispatch('realclean'); # Make sure the subclass can be subclassed -my $build2class = ref($m)->subclass +my $build2class = ref($mb)->subclass ( code => "sub ACTION_loop2 {}", class => 'MBB', @@ -56,15 +56,15 @@ --- $dist->regen; - $m->test_files('*t*'); - my $files = $m->test_files; + $mb->test_files('*t*'); + my $files = $mb->test_files; ok grep {$_ eq 'script'} @$files; ok grep {$_ eq File::Spec->catfile('t', 'basic.t')} @$files; ok !grep {$_ eq 'Build.PL' } @$files; # Make sure order is preserved - $m->test_files('foo', 'bar'); - $files = $m->test_files; + $mb->test_files('foo', 'bar'); + $files = $mb->test_files; is @$files, 2; is $files->[0], 'foo'; is $files->[1], 'bar'; @@ -80,15 +80,15 @@ $dist->add_file( 'test.foo', "content\n" ); $dist->regen; - my $m = Module::Build->new( module_name => $dist->name, - foo_files => {'test.foo', 'lib/test.foo'} ); - ok $m; + my $mb = Module::Build->new( module_name => $dist->name, + foo_files => {'test.foo', 'lib/test.foo'} ); + ok $mb; - $m->add_build_element('foo'); - $m->dispatch('build'); - ok -e File::Spec->catfile($m->blib, 'lib', 'test.foo'); + $mb->add_build_element('foo'); + $mb->dispatch('build'); + ok -e File::Spec->catfile($mb->blib, 'lib', 'test.foo'); - $m->dispatch('realclean'); + $mb->dispatch('realclean'); # revert distribution to a pristine state $dist->remove_file( 'test.foo' ); @@ -129,34 +129,34 @@ { - ok my $m = MBSub->new( module_name => $dist->name ); - isa_ok $m, 'Module::Build'; - isa_ok $m, 'MBSub'; - ok $m->valid_property('foo'); - can_ok $m, 'module_name'; + ok my $mb = MBSub->new( module_name => $dist->name ); + isa_ok $mb, 'Module::Build'; + isa_ok $mb, 'MBSub'; + ok $mb->valid_property('foo'); + can_ok $mb, 'module_name'; # Check foo property. - can_ok $m, 'foo'; - ok ! $m->foo; - ok $m->foo(1); - ok $m->foo; + can_ok $mb, 'foo'; + ok ! $mb->foo; + ok $mb->foo(1); + ok $mb->foo; # Check bar property. - can_ok $m, 'bar'; - is $m->bar, 'hey'; - ok $m->bar('you'); - is $m->bar, 'you'; + can_ok $mb, 'bar'; + is $mb->bar, 'hey'; + ok $mb->bar('you'); + is $mb->bar, 'you'; # Check hash property. - ok $m = MBSub->new( - module_name => $dist->name, - hash => { foo => 'bar', bin => 'foo'} - ); + ok $mb = MBSub->new( + module_name => $dist->name, + hash => { foo => 'bar', bin => 'foo'} + ); - can_ok $m, 'hash'; - isa_ok $m->hash, 'HASH'; - is $m->hash->{foo}, 'bar'; - is $m->hash->{bin}, 'foo'; + can_ok $mb, 'hash'; + isa_ok $mb->hash, 'HASH'; + is $mb->hash->{foo}, 'bar'; + is $mb->hash->{bin}, 'foo'; # Check hash property passed via the command-line. { @@ -164,47 +164,45 @@ '--hash', 'foo=bar', '--hash', 'bin=foo', ); - ok $m = MBSub->new( - module_name => $dist->name, - ); + ok $mb = MBSub->new( module_name => $dist->name ); } - can_ok $m, 'hash'; - isa_ok $m->hash, 'HASH'; - is $m->hash->{foo}, 'bar'; - is $m->hash->{bin}, 'foo'; + can_ok $mb, 'hash'; + isa_ok $mb->hash, 'HASH'; + is $mb->hash->{foo}, 'bar'; + is $mb->hash->{bin}, 'foo'; # Make sure that a different subclass with the same named property has a # different default. - ok $m = MBSub2->new( module_name => $dist->name ); - isa_ok $m, 'Module::Build'; - isa_ok $m, 'MBSub2'; - ok $m->valid_property('bar'); - can_ok $m, 'bar'; - is $m->bar, 'yow'; + ok $mb = MBSub2->new( module_name => $dist->name ); + isa_ok $mb, 'Module::Build'; + isa_ok $mb, 'MBSub2'; + ok $mb->valid_property('bar'); + can_ok $mb, 'bar'; + is $mb->bar, 'yow'; } { # Test the meta_add and meta_merge stuff - ok my $m = Module::Build->new( - module_name => $dist->name, - meta_add => {foo => 'bar'}, - conflicts => {'Foo::Barxx' => 0}, - ); + ok my $mb = Module::Build->new( + module_name => $dist->name, + meta_add => {foo => 'bar'}, + conflicts => {'Foo::Barxx' => 0}, + ); my %data; - $m->prepare_metadata( \%data ); + $mb->prepare_metadata( \%data ); is $data{foo}, 'bar'; - $m->meta_merge(foo => 'baz'); - $m->prepare_metadata( \%data ); + $mb->meta_merge(foo => 'baz'); + $mb->prepare_metadata( \%data ); is $data{foo}, 'baz'; - $m->meta_merge(conflicts => {'Foo::Fooxx' => 0}); - $m->prepare_metadata( \%data ); + $mb->meta_merge(conflicts => {'Foo::Fooxx' => 0}); + $mb->prepare_metadata( \%data ); is_deeply $data{conflicts}, {'Foo::Barxx' => 0, 'Foo::Fooxx' => 0}; - $m->meta_add(conflicts => {'Foo::Bazxx' => 0}); - $m->prepare_metadata( \%data ); + $mb->meta_add(conflicts => {'Foo::Bazxx' => 0}); + $mb->prepare_metadata( \%data ); is_deeply $data{conflicts}, {'Foo::Bazxx' => 0, 'Foo::Fooxx' => 0}; } Index: notes.t =================================================================== RCS file: /cvsroot/module-build/Module-Build/t/notes.t,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- notes.t 29 Jun 2005 07:50:40 -0000 1.13 +++ notes.t 29 Jun 2005 08:27:06 -0000 1.14 @@ -32,34 +32,34 @@ $dist->regen; -my $m = Module::Build->new_from_context; +my $mb = Module::Build->new_from_context; -is $m->notes('foo'), 'bar'; +is $mb->notes('foo'), 'bar'; # Try setting & checking a new value -$m->notes(argh => 'new'); -is $m->notes('argh'), 'new'; +$mb->notes(argh => 'new'); +is $mb->notes('argh'), 'new'; # Change existing value -$m->notes(foo => 'foo'); -is $m->notes('foo'), 'foo'; +$mb->notes(foo => 'foo'); +is $mb->notes('foo'), 'foo'; # Change back so we can run this test again successfully -$m->notes(foo => 'bar'); -is $m->notes('foo'), 'bar'; +$mb->notes(foo => 'bar'); +is $mb->notes('foo'), 'bar'; ################################### # Make sure notes set before create_build_script() get preserved -$m = Module::Build->new(module_name => $dist->name); -ok $m; -$m->notes(foo => 'bar'); -is $m->notes('foo'), 'bar'; +$mb = Module::Build->new(module_name => $dist->name); +ok $mb; +$mb->notes(foo => 'bar'); +is $mb->notes('foo'), 'bar'; -$m->create_build_script; +$mb->create_build_script; -$m = Module::Build->resume; -ok $m; -is $m->notes('foo'), 'bar'; +$mb = Module::Build->resume; +ok $mb; +is $mb->notes('foo'), 'bar'; # cleanup Index: basic.t =================================================================== RCS file: /cvsroot/module-build/Module-Build/t/basic.t,v retrieving revision 1.42 retrieving revision 1.43 diff -u -d -r1.42 -r1.43 --- basic.t 29 Jun 2005 07:50:40 -0000 1.42 +++ basic.t 29 Jun 2005 08:27:06 -0000 1.43 @@ -31,16 +31,16 @@ # Test object creation { - my $m = Module::Build->new( module_name => $dist->name ); - ok $m; - is $m->module_name, $dist->name; - is $m->build_class, 'Module::Build'; - is $m->dist_name, $dist->name; + my $mb = Module::Build->new( module_name => $dist->name ); + ok $mb; + is $mb->module_name, $dist->name; + is $mb->build_class, 'Module::Build'; + is $mb->dist_name, $dist->name; - $m = Module::Build->new( dist_name => $dist->name, dist_version => 7 ); - ok $m; - ok ! $m->module_name; # Make sure it's defined - is $m->dist_name, $dist->name; + $mb = Module::Build->new( dist_name => $dist->name, dist_version => 7 ); + ok $mb; + ok ! $mb->module_name; # Make sure it's defined + is $mb->dist_name, $dist->name; } # Make sure actions are defined, and known_actions works as class method @@ -55,27 +55,27 @@ local @INC = (File::Spec->catdir( $dist->dirname, 'lib' ), @INC); my $flagged = 0; local $SIG{__WARN__} = sub { $flagged = 1 if $_[0] =~ /@{[$dist->name]}/}; - my $m = Module::Build->new( + my $mb = Module::Build->new( module_name => $dist->name, requires => {$dist->name => 0}, ); ok ! $flagged; - ok ! $m->prereq_failures; - $m->dispatch('realclean'); + ok ! $mb->prereq_failures; + $mb->dispatch('realclean'); $dist->clean; $flagged = 0; - $m = Module::Build->new( + $mb = Module::Build->new( module_name => $dist->name, requires => {$dist->name => 3.14159265}, ); ok $flagged; - ok $m->prereq_failures; - ok $m->prereq_failures->{requires}{$dist->name}; - is $m->prereq_failures->{requires}{$dist->name}{have}, 0.01; - is $m->prereq_failures->{requires}{$dist->name}{need}, 3.14159265; + ok $mb->prereq_failures; + ok $mb->prereq_failures->{requires}{$dist->name}; + is $mb->prereq_failures->{requires}{$dist->name}{have}, 0.01; + is $mb->prereq_failures->{requires}{$dist->name}{need}, 3.14159265; - $m->dispatch('realclean'); + $mb->dispatch('realclean'); $dist->clean; # Make sure check_installed_status() works as a class method @@ -102,7 +102,7 @@ my $flagged = 0; local $SIG{__WARN__} = sub { $flagged = 1 if $_[0] =~ /ModuleBuildNonExistent isn't installed/}; - my $m = Module::Build->new( + my $mb = Module::Build->new( module_name => $dist->name, recommends => {ModuleBuildNonExistent => 3}, ); @@ -112,14 +112,14 @@ # Test verbosity { - my $m = Module::Build->new(module_name => $dist->name); + my $mb = Module::Build->new(module_name => $dist->name); - $m->add_to_cleanup('save_out'); + $mb->add_to_cleanup('save_out'); # Use uc() so we don't confuse the current test output - like uc(stdout_of( sub {$m->dispatch('test', verbose => 1)} )), qr/^OK \d/m; - like uc(stdout_of( sub {$m->dispatch('test', verbose => 0)} )), qr/\.\.OK/; + like uc(stdout_of( sub {$mb->dispatch('test', verbose => 1)} )), qr/^OK \d/m; + like uc(stdout_of( sub {$mb->dispatch('test', verbose => 0)} )), qr/\.\.OK/; - $m->dispatch('realclean'); + $mb->dispatch('realclean'); $dist->clean; } @@ -149,32 +149,32 @@ eval {Module::Build->run_perl_script('Build.PL', [], ['skip_rcfile=1', '--config', "foocakes=barcakes", '--foo', '--bar', '--bar', '-bat=hello', 'gee=whiz', '--any', 'hey', '--destdir', 'yo', '--verbose', '1'])}; ok ! $@; - my $m = Module::Build->resume; - is $m->config->{cc}, $Config{cc}; - is $m->config->{foocakes}, 'barcakes'; + my $mb = Module::Build->resume; + is $mb->config->{cc}, $Config{cc}; + is $mb->config->{foocakes}, 'barcakes'; # Test args(). - is $m->args('foo'), 1; - is $m->args('bar'), 2, 'bar'; - is $m->args('bat'), 'hello', 'bat'; - is $m->args('gee'), 'whiz'; - is $m->args('any'), 'hey'; - is $m->args('dee'), 'goo'; - is $m->destdir, 'yo'; - is $m->runtime_params('destdir'), 'yo'; - is $m->runtime_params('verbose'), '1'; - ok ! $m->runtime_params('license'); - ok my %runtime = $m->runtime_params; + is $mb->args('foo'), 1; + is $mb->args('bar'), 2, 'bar'; + is $mb->args('bat'), 'hello', 'bat'; + is $mb->args('gee'), 'whiz'; + is $mb->args('any'), 'hey'; + is $mb->args('dee'), 'goo'; + is $mb->destdir, 'yo'; + is $mb->runtime_params('destdir'), 'yo'; + is $mb->runtime_params('verbose'), '1'; + ok ! $mb->runtime_params('license'); + ok my %runtime = $mb->runtime_params; is scalar keys %runtime, 4; is $runtime{destdir}, 'yo'; is $runtime{verbose}, '1'; ok $runtime{config}; - ok my $argsref = $m->args; + ok my $argsref = $mb->args; is $argsref->{foo}, 1; $argsref->{doo} = 'hee'; - is $m->args('doo'), 'hee'; - ok my %args = $m->args; + is $mb->args('doo'), 'hee'; + ok my %args = $mb->args; is $args{foo}, 1; # revert test distribution to pristine state because we modified a file @@ -187,15 +187,15 @@ # Test author stuff { - my $m = Module::Build->new( + my $mb = Module::Build->new( module_name => $dist->name, dist_author => 'Foo Meister <fo...@ex...>', build_class => 'My::Big::Fat::Builder', ); - ok $m; - ok ref($m->dist_author), 'dist_author converted to array if simple string'; - is $m->dist_author->[0], 'Foo Meister <fo...@ex...>'; - is $m->build_class, 'My::Big::Fat::Builder'; + ok $mb; + ok ref($mb->dist_author), 'dist_author converted to array if simple string'; + is $mb->dist_author->[0], 'Foo Meister <fo...@ex...>'; + is $mb->build_class, 'My::Big::Fat::Builder'; } Index: destinations.t =================================================================== RCS file: /cvsroot/module-build/Module-Build/t/destinations.t,v retrieving revision 1.21 retrieving revision 1.22 diff -u -d -r1.21 -r1.22 --- destinations.t 29 Jun 2005 07:50:40 -0000 1.21 +++ destinations.t 29 Jun 2005 08:27:06 -0000 1.22 @@ -33,25 +33,25 @@ } use Module::Build; -my $M = Module::Build->new_from_context; -isa_ok( $M, 'Module::Build::Base' ); +my $mb = Module::Build->new_from_context; +isa_ok( $mb, 'Module::Build::Base' ); -my $Install_Sets = $M->install_sets; +my $install_sets = $mb->install_sets; # Get us into a known state. -$M->installdirs('site'); -$M->install_base(undef); -$M->prefix(undef); +$mb->installdirs('site'); +$mb->install_base(undef); +$mb->prefix(undef); # Check that we install into the proper default locations. { - is( $M->installdirs, 'site' ); - is( $M->install_base, undef ); - is( $M->prefix, undef ); + is( $mb->installdirs, 'site' ); + is( $mb->install_base, undef ); + is( $mb->prefix, undef ); - test_install_destinations( $M, { + test_install_destinations( $mb, { lib => $Config{installsitelib}, arch => $Config{installsitearch}, bin => $Config{installsitebin} || $Config{installbin}, @@ -65,10 +65,10 @@ # Is installdirs honored? { - $M->installdirs('core'); - is( $M->installdirs, 'core' ); + $mb->installdirs('core'); + is( $mb->installdirs, 'core' ); - test_install_destinations( $M, { + test_install_destinations( $mb, { lib => $Config{installprivlib}, arch => $Config{installarchlib}, bin => $Config{installbin}, @@ -77,21 +77,21 @@ libdoc => $Config{installman3dir}, }); - $M->installdirs('site'); - is( $M->installdirs, 'site' ); + $mb->installdirs('site'); + is( $mb->installdirs, 'site' ); } # Check install_base() { my $install_base = catdir( 'foo', 'bar' ); - $M->install_base( $install_base ); + $mb->install_base( $install_base ); - is( $M->prefix, undef ); - is( $M->install_base, $install_base ); + is( $mb->prefix, undef ); + is( $mb->install_base, $install_base ); - test_install_destinations( $M, { + test_install_destinations( $mb, { lib => catdir( $install_base, 'lib', 'perl5' ), arch => catdir( $install_base, 'lib', 'perl5', $Config{archname} ), bin => catdir( $install_base, 'bin' ), @@ -104,27 +104,27 @@ # Basic prefix test. Ensure everything is under the prefix. { - $M->install_base( undef ); - ok( !defined $M->install_base ); + $mb->install_base( undef ); + ok( !defined $mb->install_base ); my $prefix = catdir( qw( some prefix ) ); - $M->prefix( $prefix ); - is( $M->{properties}{prefix}, $prefix ); + $mb->prefix( $prefix ); + is( $mb->{properties}{prefix}, $prefix ); - test_prefix($prefix, $Install_Sets->{site}); + test_prefix($prefix, $install_sets->{site}); } # And now that prefix honors installdirs. { - $M->installdirs('core'); - is( $M->installdirs, 'core' ); + $mb->installdirs('core'); + is( $mb->installdirs, 'core' ); my $prefix = catdir( qw( some prefix ) ); test_prefix($prefix); - $M->installdirs('site'); - is( $M->installdirs, 'site' ); + $mb->installdirs('site'); + is( $mb->installdirs, 'site' ); } @@ -132,7 +132,7 @@ # the prefix. Ensure it doesn't. { # Get the prefix defaults - my $defaults = $M->prefix_relpaths('site'); + my $defaults = $mb->prefix_relpaths('site'); # Create a configuration involving weird paths that are outside of # the configured prefix. @@ -151,14 +151,14 @@ # Poke at the innards of MB to change the default install locations. while( my($key, $path) = each %test_config ) { - $M->{properties}{install_sets}{site}{$key} = $path; + $mb->{properties}{install_sets}{site}{$key} = $path; } - $M->{config}{siteprefixexp} = catdir(File::Spec->rootdir, + $mb->{config}{siteprefixexp} = catdir(File::Spec->rootdir, 'wierd', 'prefix'); my $prefix = catdir('another', 'prefix'); - $M->prefix($prefix); + $mb->prefix($prefix); test_prefix($prefix, \%test_config); } @@ -166,9 +166,9 @@ # Check that we can use install_base after setting prefix. { my $install_base = catdir( 'foo', 'bar' ); - $M->install_base( $install_base ); + $mb->install_base( $install_base ); - test_install_destinations( $M, { + test_install_destinations( $mb, { lib => catdir( $install_base, 'lib', 'perl5' ), arch => catdir( $install_base, 'lib', 'perl5', $Config{archname} ), bin => catdir( $install_base, 'bin' ), @@ -190,7 +190,7 @@ local $Test::Builder::Level = $Test::Builder::Level + 1; foreach my $type (qw(lib arch bin script bindoc libdoc)) { - my $dest = $M->install_destination( $type ); + my $dest = $mb->install_destination( $type ); like( $dest, "/^\Q$prefix\E/", "$type prefixed"); if( $test_config ) { @@ -199,18 +199,17 @@ is( $dest_dirs[-1], $test_dirs[-1], ' suffix correctish' ); } - } } sub test_install_destinations { - my($mb, $expect) = @_; + my($build, $expect) = @_; local $Test::Builder::Level = $Test::Builder::Level + 1; while( my($type, $expect) = each %$expect ) { - is( $mb->install_destination($type), $expect, "$type destination" ); + is( $build->install_destination($type), $expect, "$type destination" ); } } |