diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2010-09-24 14:49:07 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2010-09-24 14:49:07 +0000 |
commit | 38b9480a88793314fc621bfec3da592ab7cc1b67 (patch) | |
tree | 376a0f8b8ceb06f5a35dd4092e2142d144446f37 /gnu/usr.bin/perl/cpan/CPANPLUS/t | |
parent | 9cbab6bbe32ea5284843bc86df049948f57cfeec (diff) |
Perl 5.12.2 from CPAN
Diffstat (limited to 'gnu/usr.bin/perl/cpan/CPANPLUS/t')
19 files changed, 605 insertions, 624 deletions
diff --git a/gnu/usr.bin/perl/cpan/CPANPLUS/t/00_CPANPLUS-Internals-Utils.t b/gnu/usr.bin/perl/cpan/CPANPLUS/t/00_CPANPLUS-Internals-Utils.t index e15dcb2fc06..8e372fe0fdc 100755 --- a/gnu/usr.bin/perl/cpan/CPANPLUS/t/00_CPANPLUS-Internals-Utils.t +++ b/gnu/usr.bin/perl/cpan/CPANPLUS/t/00_CPANPLUS-Internals-Utils.t @@ -1,6 +1,6 @@ ### make sure we can find our conf.pl file -BEGIN { - use FindBin; +BEGIN { + use FindBin; require "$FindBin::Bin/inc/conf.pl"; } @@ -8,7 +8,7 @@ use strict; ### make sure to keep the plan -- this is the only test ### supported for 'older' T::H (pre 2.28) -- see Makefile.PL for details -use Test::More tests => 48; +use Test::More tests => 40; use Cwd; use Data::Dumper; @@ -67,11 +67,11 @@ rmdir $Dir if -d $Dir; } ### test _chdir ### -{ ok( $Class->_chdir( dir => $Dir), "Chdir to '$Dir'" ); +{ ok( $Class->_chdir( dir => $Dir), "Chdir to '$Dir'" ); my $abs = File::Spec->rel2abs(File::Spec->catdir($Cwd,$Dir)); paths_are_same( File::Spec->rel2abs(cwd()), $abs, - " Cwd() is '$Dir'"); + " Cwd() is '$Dir'"); ok( $Class->_chdir( dir => $Cwd), "Chdir back to '$Cwd'" ); paths_are_same( File::Spec->rel2abs(cwd()), $Cwd, @@ -83,18 +83,18 @@ rmdir $Dir if -d $Dir; "Move from '$Dir' to '$Move'" ); ok( -d $Move, " Dir '$Move' exists" ); ok( !-d $Dir, " Dir '$Dir' no longer exists" ); - - + + { local $CPANPLUS::Error::ERROR_FH = output_handle(); - + ### now try to move it somewhere it can't ### ok( !$Class->_move( file => $Move, to => 'inc' ), " Impossible move detected" ); like( CPANPLUS::Error->stack_as_string, qr/Failed to move/, " Expected error found" ); } -} - +} + ### test _rmdir ### { ok( -d $Move, "Dir '$Move' exists" ); ok( $Class->_rmdir( dir => $Move ), " Deleted dir '$Move'" ); @@ -107,75 +107,71 @@ rmdir $Dir if -d $Dir; like( $contents, qr/BEGIN/, " Proper contents found" ); like( $contents, qr/CPANPLUS/, " Proper contents found" ); } - + ### _perl_version tests ### { my $version = $Class->_perl_version( perl => $^X ); ok( $version, "Perl version found" ); like( $version, qr/\d.\d+.\d+/, " Looks like a proper version" ); -} - +} + ### _version_to_number tests ### { my $map = { - '1' => '1', - '1.2' => '1.2', - '.2' => '.2', - 'foo' => '0.0', - 'a.1' => '0.0', - '1.2.3' => '1.002003', - 'v1.2.3' => '1.002003', - 'v1.5' => '1.005000', - '1.5-a' => '1.500', - }; + '1' => '1', + '1.2' => '1.2', + '.2' => '.2', + 'foo' => '0.0', + 'a.1' => '0.0', + }; while( my($try,$expect) = each %$map ) { my $ver = $Class->_version_to_number( version => $try ); ok( $ver, "Version returned" ); is( $ver, $expect, " Value as expected" ); - } + } } ### _whoami tests ### -{ sub foo { - my $me = $Class->_whoami; +{ sub foo { + my $me = $Class->_whoami; ok( $me, "_whoami returned a result" ); - is( $me, 'foo', " Value as expected" ); - } + is( $me, 'foo', " Value as expected" ); + } foo(); } - + ### _mode_plus_w tests ### { open my $fh, ">$File" or die "Could not open $File for writing: $!"; close $fh; - + ### remove perms ok( -e $File, "File '$File' created" ); ok( chmod( 000, $File ), " File permissions set to 000" ); - + ok( $Class->_mode_plus_w( file => $File ), " File permissions set to +w" ); ok( -w $File, " File is writable" ); 1 while unlink $File; - + ok( !-e $File, " File removed" ); } -### uri encode/decode tests +### uri encode/decode tests { my $org = 'file://foo/bar'; my $enc = $Class->_uri_encode( uri => $org ); - + ok( $enc, "String '$org' encoded" ); like( $enc, qr/%/, " Contents as expected" ); - + my $dec = $Class->_uri_decode( uri => $enc ); ok( $dec, "String '$enc' decoded" ); is( $dec, $org, " Decoded properly" ); -} - - +} + + # Local variables: # c-indentation-style: bsd # c-basic-offset: 4 diff --git a/gnu/usr.bin/perl/cpan/CPANPLUS/t/01_CPANPLUS-Configure.t b/gnu/usr.bin/perl/cpan/CPANPLUS/t/01_CPANPLUS-Configure.t index 152a9ac632f..fc02640c7aa 100755 --- a/gnu/usr.bin/perl/cpan/CPANPLUS/t/01_CPANPLUS-Configure.t +++ b/gnu/usr.bin/perl/cpan/CPANPLUS/t/01_CPANPLUS-Configure.t @@ -1,6 +1,6 @@ ### make sure we can find our conf.pl file -BEGIN { - use FindBin; +BEGIN { + use FindBin; require "$FindBin::Bin/inc/conf.pl"; } @@ -15,7 +15,7 @@ my $Config_pm = 'CPANPLUS/Config.pm'; for my $mod (qw[CPANPLUS::Configure]) { use_ok($mod) or diag qq[Can't load $mod]; -} +} my $c = CPANPLUS::Configure->new(); isa_ok($c, 'CPANPLUS::Configure'); @@ -38,33 +38,33 @@ for my $cat ( $r->ls_accessors ) { ### copy for use on the config object itself my $accessor = $cat; my $prepend = ($cat =~ s/^_//) ? '_' : ''; - + my $getmeth = $prepend . 'get_'. $cat; my $setmeth = $prepend . 'set_'. $cat; my $addmeth = $prepend . 'add_'. $cat; - + ok( scalar(@options), "Possible options obtained" ); - + ### test adding keys too ### { my $add_key = 'test_key'; my $add_val = [1..3]; - + my $found = grep { $add_key eq $_ } @options; ok( !$found, "Key '$add_key' not yet defined" ); ok( $c->$addmeth( $add_key => $add_val ), - " $addmeth('$add_key' => VAL)" ); + " $addmeth('$add_key' => VAL)" ); ### this one now also exists ### push @options, $add_key } - ### poke in the object, get the actual hashref out ### + ### poke in the object, get the actual hashref out ### my %hash = map { - $_ => $r->$accessor->$_ + $_ => $r->$accessor->$_ } $r->$accessor->ls_accessors; - + while( my ($key,$val) = each %hash ) { - my $is = $c->$getmeth($key); + my $is = $c->$getmeth($key); is_deeply( $val, $is, "deep check for '$key'" ); ok( $c->$setmeth($key => 1 ), " $setmeth('$key' => 1)" ); is( $c->$getmeth($key), 1, " $getmeth('$key')" ); @@ -74,15 +74,15 @@ for my $cat ( $r->ls_accessors ) { ### now check if we found all the keys with options or not ### delete $hash{$_} for @options; ok( !(scalar keys %hash), "All possible keys found" ); - -} + +} ### see if we can save the config ### { my $dir = File::Spec->rel2abs('dummy-cpanplus'); my $pm = 'CPANPLUS::Config::Test' . $$; my $file = $c->save( $pm, $dir ); - + ok( $file, "Config $pm saved" ); ok( -e $file, " File exists" ); ok( -s $file, " File has size" ); @@ -92,23 +92,23 @@ for my $cat ( $r->ls_accessors ) { ok( $c->init( rescan => 1 ), "Reran ->init()" ); } - + ### make sure this file is now loaded - ### XXX can't trust bloody dir separators on Win32 in %INC, + ### XXX can't trust bloody dir seperators on Win32 in %INC, ### so rather than an exact match, do a grep... - my ($found) = grep /\bTest$$/, values %INC; + my ($found) = grep /\bTest$$/, values %INC; ok( $found, " Found $file in \%INC" ); ok( -e $file, " File exists" ); 1 while unlink $file; ok(!-e $file, " File removed" ); - + } { my $env = ENV_CPANPLUS_CONFIG; local $ENV{$env} = $$; my $ok = $c->init; my $stack = CPANPLUS::Error->stack_as_string; - + ok( $ok, "Reran init again" ); like( $stack, qr/Specifying a config file in your environment/, " Warning logged" ); @@ -116,16 +116,16 @@ for my $cat ( $r->ls_accessors ) { { CPANPLUS::Error->flush; - - { ### try a bogus method call + + { ### try a bogus method call my $x = $c->flubber('foo'); my $err = CPANPLUS::Error->stack_as_string; is ($x, undef, "Bogus method call returns undef"); like($err, "/flubber/", " Bogus method call recognized"); } - + CPANPLUS::Error->flush; -} +} # Local variables: diff --git a/gnu/usr.bin/perl/cpan/CPANPLUS/t/02_CPANPLUS-Internals.t b/gnu/usr.bin/perl/cpan/CPANPLUS/t/02_CPANPLUS-Internals.t index 46a7cb6e208..84b78f3ade3 100755 --- a/gnu/usr.bin/perl/cpan/CPANPLUS/t/02_CPANPLUS-Internals.t +++ b/gnu/usr.bin/perl/cpan/CPANPLUS/t/02_CPANPLUS-Internals.t @@ -1,6 +1,6 @@ ### make sure we can find our conf.pl file -BEGIN { - use FindBin; +BEGIN { + use FindBin; require "$FindBin::Bin/inc/conf.pl"; } @@ -23,21 +23,21 @@ is($cb->_id, $cb->_last_id, "Comparing ID's"); ok( $del, "ID deleted" ); isa_ok( $del, "CPANPLUS::Internals" ); is( $del, $cb, " Deleted ID matches last object" ); - + my $id = $cb->_store_id( $del ); ok( $id, "ID stored" ); is( $id, $cb->_id, " Stored proper ID" ); - + my $obj = $cb->_retrieve_id( $id ); ok( $obj, "Object retrieved from ID" ); isa_ok( $obj, 'CPANPLUS::Internals' ); is( $obj->_id, $id, " Retrieved ID properly" ); - + my @obs = $cb->_return_all_objects(); ok( scalar(@obs), "Returned objects" ); is( scalar(@obs), 1, " Proper amount of objects found" ); is( $obs[0]->_id, $id, " Proper ID found on object" ); - + my $lid = $cb->_last_id; ok( $lid, "Found last registered ID" ); is( $lid, $id, " ID matches last object" ); @@ -45,29 +45,29 @@ is($cb->_id, $cb->_last_id, "Comparing ID's"); my $iid = $cb->_inc_id; ok( $iid, "Incremented ID" ); is( $iid, $id+1, " ID matched last ID + 1" ); -} +} ### host ok test ### { my $host = $cb->configure_object->get_conf('hosts')->[0]; - + is( $cb->_host_ok( host => $host ), 1, "Host ok" ); is( $cb->_add_fail_host(host => $host), 1, " Host now marked as bad" ); is( $cb->_host_ok( host => $host ), 0, " Host still bad" ); ok( $cb->_flush( list => ['hosts'] ), " Hosts flushed" ); is( $cb->_host_ok( host => $host ), 1, " Host now ok again" ); -} +} ### flush loads test { my $mod = 'Benchmark'; my $file = $mod . '.pm'; - + ### XXX whitebox test -- mark this module as unloadable $Module::Load::Conditional::CACHE->{$mod}->{usable} = 0; ok( !can_load( modules => { $mod => 0 }, verbose => 0 ), "'$mod' not loaded" ); - + ok( $cb->flush('load'), " 'load' cache flushed" ); ok( can_load( modules => { $mod => 0 }, verbose => 0 ), " '$mod' loaded" ); @@ -76,30 +76,30 @@ is($cb->_id, $cb->_last_id, "Comparing ID's"); ### add to inc path tests { my $meth = '_add_to_includepath'; can_ok( $cb, $meth ); - + my $p5lib = $ENV{PERL5LIB} || ''; - my $inc = "@INC"; - ok( $cb->$meth( directories => [$$] ), + my $inc = "@INC"; + ok( $cb->$meth( directories => [$$] ), " CB->$meth( $$ )" ); - + my $new_p5lib = $ENV{PERL5LIB}; - my $new_inc = "@INC"; + my $new_inc = "@INC"; isnt( $p5lib, $new_p5lib, " PERL5LIB is now: $new_p5lib" ); like( $new_p5lib, qr/$$/, " Matches $$" ); isnt( $inc, $new_inc, ' @INC is expanded with: ' . $$ ); like( $new_inc, qr/$$/, " Matches $$" ); - - ok( $cb->$meth( directories => [$$] ), + + ok( $cb->$meth( directories => [$$] ), " CB->$meth( $$ ) again" ); is( "@INC", $new_inc, ' @INC unchanged' ); is( $new_p5lib, $ENV{PERL5LIB}, " PERL5LIB unchanged" ); -} +} ### callback registering tests ### { my $callback_map = { - ### name default value + ### name default value install_prerequisite => 1, # install prereqs when 'ask' is set? edit_test_report => 0, # edit the prepared test report? send_test_report => 1, # send the test report? @@ -110,32 +110,32 @@ is($cb->_id, $cb->_last_id, "Comparing ID's"); }; for my $callback ( keys %$callback_map ) { - + { my $rv = $callback_map->{$callback}; is( $rv, $cb->_callbacks->$callback->( $0, $$ ), "Default callback '$callback' called" ); - like( CPANPLUS::Error->stack_as_string, qr/DEFAULT '\S+' HANDLER/s, - " Default handler warning recorded" ); + like( CPANPLUS::Error->stack_as_string, qr/DEFAULT '\S+' HANDLER/s, + " Default handler warning recorded" ); CPANPLUS::Error->flush; } - + ### try to register the callback my $ok = $cb->_register_callback( name => $callback, code => sub { return $callback } ); - + ok( $ok, "Registered callback '$callback' ok" ); - + my $sub = $cb->_callbacks->$callback; ok( $sub, " Retrieved callback" ); ok( IS_CODEREF->($sub), " Callback is a sub" ); - + my $rv = $sub->(); ok( $rv, " Callback called ok" ); is( $rv, $callback, " Got expected return value" ); - } + } } diff --git a/gnu/usr.bin/perl/cpan/CPANPLUS/t/03_CPANPLUS-Internals-Source.t b/gnu/usr.bin/perl/cpan/CPANPLUS/t/03_CPANPLUS-Internals-Source.t index d6ad2ea94f6..65f1e54c352 100755 --- a/gnu/usr.bin/perl/cpan/CPANPLUS/t/03_CPANPLUS-Internals-Source.t +++ b/gnu/usr.bin/perl/cpan/CPANPLUS/t/03_CPANPLUS-Internals-Source.t @@ -1,14 +1,14 @@ ### make sure we can find our conf.pl file -BEGIN { - use FindBin; +BEGIN { + use FindBin; require "$FindBin::Bin/inc/conf.pl"; } use strict; use Module::Load; -use Test::More eval { - load $ENV{CPANPLUS_SOURCE_ENGINE} if $ENV{CPANPLUS_SOURCE_ENGINE}; 1 +use Test::More eval { + load $ENV{CPANPLUS_SOURCE_ENGINE} if $ENV{CPANPLUS_SOURCE_ENGINE}; 1 } ? 'no_plan' : (skip_all => "SQLite engine not available"); @@ -20,7 +20,6 @@ use Data::Dumper; use File::Basename qw[dirname]; my $conf = gimme_conf(); -$conf->set_conf( enable_custom_sources => 1 ); my $cb = CPANPLUS::Backend->new( $conf ); ### XXX temp @@ -36,12 +35,12 @@ my $modname = TEST_CONF_MODULE; ### source files should be copied from the 'server' now for my $name (qw[auth mod dslip] ) { - my $file = File::Spec->catfile( + my $file = File::Spec->catfile( $conf->get_conf('base'), $conf->_get_source($name) - ); + ); ok( (-e $file && -f _ && -s _), "$file exists" ); - } + } ok( $at, "Authortree loaded successfully" ); ok( scalar keys %$at, " Authortree has items in it" ); @@ -56,7 +55,7 @@ my $modname = TEST_CONF_MODULE; } ### save state tests -SKIP: { +SKIP: { skip "Save state tests for custom engine $ENV{CPANPLUS_SOURCE_ENGINE}", 7 if $ENV{CPANPLUS_SOURCE_ENGINE}; @@ -74,44 +73,44 @@ SKIP: { my $rv = $cb->save_state; ok( $rv, " State information saved" ); - - like( CPANPLUS::Error->stack_as_string, qr/Writing compiled source/, + + like( CPANPLUS::Error->stack_as_string, qr/Writing compiled source/, " Diagnostics confirmed" ); } - + ### now we rebuild the trees from disk and ### check if the module object has a status saved with it { CPANPLUS::Error->flush; ok( $cb->_build_trees( uptodate => 1, use_stored => 1), " Trees are rebuilt" ); - like( CPANPLUS::Error->stack_as_string, qr/Retrieving/, + like( CPANPLUS::Error->stack_as_string, qr/Retrieving/, " Diagnostics confirmed" ); - + my $mod = $cb->_module_tree->{$modname}; ok( $mod->status, " Status now set in module object" ); - } + } } ### check custom sources ### XXX whitebox test -SKIP: { +SKIP: { ### first, find a file to serve as a source my $mod = $cb->_module_tree->{$modname}; my $package = File::Spec->rel2abs( - File::Spec->catfile( + File::Spec->catfile( $FindBin::Bin, TEST_CONF_CPAN_DIR, $mod->path, $mod->package, ) - ); - + ); + ok( $package, "Found file for custom source" ); ok( -e $package, " File '$package' exists" ); - ### remote uri + ### remote uri my $uri = $cb->_host_to_uri( scheme => 'file', host => '', @@ -119,25 +118,25 @@ SKIP: { ); my $expected_file = $cb->__custom_module_source_index_file( uri => $uri ); - + ok( $expected_file, "Sources should be written to '$uri'" ); - + skip( "Index file size too long (>260 chars). Can't write to disk", 28 ) if length $expected_file > 260 and ON_WIN32; + - - ### local file + ### local file ### 2 tests my $src_file = $cb->_add_custom_module_source( uri => $uri ); - ok( $src_file, "Sources written to '$src_file'" ); - ok( -e $src_file, " File exists" ); - - ### and write the file + ok( $src_file, "Sources written to '$src_file'" ); + ok( -e $src_file, " File exists" ); + + ### and write the file ### 5 tests { my $meth = '__write_custom_module_index'; can_ok( $cb, $meth ); - my $rv = $cb->$meth( + my $rv = $cb->$meth( path => dirname( $package ), to => $src_file ); @@ -146,26 +145,26 @@ SKIP: { is( $rv, $src_file, " Written to expected file" ); ok( -e $src_file, " Source file exists" ); ok( -s $src_file, " File has non-zero size" ); - } - + } + ### let's see if we can find our custom files ### 3 tests { my $meth = '__list_custom_module_sources'; can_ok( $cb, $meth ); - + my %files = $cb->$meth; ok( scalar(keys(%files)), " Got list of sources" ); - + ### on VMS, we can't predict the case unfortunately ### so grep for it instead; - my $found = map { + my $found = map { my $src_re = quotemeta($src_file); $_ =~ /$src_re/i; } keys %files; ok( $found, " Found proper entry for $src_file" ); - } + } ### now we can have it be loaded in ### 6 tests @@ -179,7 +178,7 @@ SKIP: { my $add = $cb->_module_tree->{$add_name}; ok( $add, " Found added module" ); - ok( $add->status->_fetch_from, + ok( $add->status->_fetch_from, " Full download path set" ); is( $add->author->cpanid, CUSTOM_AUTHOR_ID, " Attributed to custom author" ); @@ -194,60 +193,60 @@ SKIP: { ### 3 tests { my $meth = '__update_custom_module_sources'; can_ok( $cb, $meth ); - + ### mark what time it is now, sleep 1 second for better measuring - my $now = time; + my $now = time; sleep 1; - + my $ok = $cb->$meth; ok( $ok, "Custom sources updated" ); cmp_ok( [stat $src_file]->[9], '>=', $now, - " Timestamp on sourcefile updated" ); + " Timestamp on sourcefile updated" ); } - + ### now update it individually - ### 3 tests + ### 3 tests { my $meth = '__update_custom_module_source'; can_ok( $cb, $meth ); - + ### mark what time it is now, sleep 1 second for better measuring - my $now = time; + my $now = time; sleep 1; - + my $ok = $cb->$meth( remote => $uri ); ok( $ok, "Custom source for '$uri' updated" ); cmp_ok( [stat $src_file]->[9], '>=', $now, - " Timestamp on sourcefile updated" ); + " Timestamp on sourcefile updated" ); } ### now update using the higher level API, see if it's part of the update - ### 3 tests + ### 3 tests { CPANPLUS::Error->flush; ### mark what time it is now, sleep 1 second for better measuring - my $now = time; + my $now = time; sleep 1; - + my $ok = $cb->_build_trees( uptodate => 0, use_stored => 0, ); - + ok( $ok, "All sources updated" ); cmp_ok( [stat $src_file]->[9], '>=', $now, - " Timestamp on sourcefile updated" ); + " Timestamp on sourcefile updated" ); like( CPANPLUS::Error->stack_as_string, qr/Updating sources from/, " Update recorded in the log" ); } - + ### now remove the index file; - ### 3 tests + ### 3 tests { my $meth = '_remove_custom_module_source'; can_ok( $cb, $meth ); - + my $file = $cb->$meth( uri => $uri ); ok( $file, "Index file removed" ); ok( ! -e $file, " File '$file' no longer on disk" ); diff --git a/gnu/usr.bin/perl/cpan/CPANPLUS/t/04_CPANPLUS-Module.t b/gnu/usr.bin/perl/cpan/CPANPLUS/t/04_CPANPLUS-Module.t index 1014e62bdab..f45755143b5 100755 --- a/gnu/usr.bin/perl/cpan/CPANPLUS/t/04_CPANPLUS-Module.t +++ b/gnu/usr.bin/perl/cpan/CPANPLUS/t/04_CPANPLUS-Module.t @@ -1,6 +1,6 @@ ### make sure we can find our conf.pl file -BEGIN { - use FindBin; +BEGIN { + use FindBin; require "$FindBin::Bin/inc/conf.pl"; } @@ -21,7 +21,7 @@ my $Conf = gimme_conf(); my $CB = CPANPLUS::Backend->new( $Conf ); ### start with fresh sources ### -ok( $CB->reload_indices( update_source => 0 ), "Rebuilding trees" ); +ok( $CB->reload_indices( update_source => 0 ), "Rebuilding trees" ); my $AuthName = TEST_CONF_AUTHOR; my $Auth = $CB->author_tree( $AuthName ); @@ -48,17 +48,17 @@ isa_ok( $Auth->parent, 'CPANPLUS::Backend' ); name => $ModName, comment => undef, package => 'Foo-Bar-0.01.tar.gz', - path => 'authors/id/EUNOXS', + path => 'authors/id/EUNOXS', version => '0.01', dslip => 'cdpO ', - description => 'CPANPLUS Test Package', + description => 'CPANPLUS Test Package', mtime => '', author => $Auth, - ); + ); my @acc = $Mod->accessors; ok( scalar(@acc), "Retrieved module accessors" ); - + ### remove private accessors is_deeply( [ sort keys %map ], [ sort grep { $_ !~ /^_/ } @acc ], " About to test all accessors" ); @@ -71,7 +71,7 @@ isa_ok( $Auth->parent, 'CPANPLUS::Backend' ); ### check accessor objects ### isa_ok( $Mod->parent, 'CPANPLUS::Backend' ); isa_ok( $Mod->author, 'CPANPLUS::Module::Author' ); - is( $Mod->author->author, $Auth->author, + is( $Mod->author->author, $Auth->author, "Module eq Author" ); } @@ -89,18 +89,18 @@ isa_ok( $Auth->parent, 'CPANPLUS::Backend' ); { my $clone = $Mod->clone; ok( $clone, "Module cloned" ); isa_ok( $clone, 'CPANPLUS::Module' ); - + for my $acc ( $Mod->accessors ) { is( $clone->$acc, $Mod->$acc, " Clone->$acc matches Mod->$acc " ); } - - ### XXX whitebox test + + ### XXX whitebox test ok( !$clone->_status, "Status object empty on start" ); - + my $status = $clone->status; ok( $status, " Status object defined after query" ); - is( $status, $clone->_status, + is( $status, $clone->_status, " Object stored as expected" ); isa_ok( $status, 'Object::Accessor' ); } @@ -109,18 +109,18 @@ isa_ok( $Auth->parent, 'CPANPLUS::Backend' ); ok( !$Mod->extract(), "Cannot extract unfetched file" ); like( CPANPLUS::Error->stack_as_string, qr/You have not fetched/, " Error properly logged" ); -} +} { ### fetch tests ### ### enable signature checks for checksums ### my $old = $Conf->get_conf('signature'); - $Conf->set_conf(signature => 1); - + $Conf->set_conf(signature => 1); + my $where = $Mod->fetch( force => 1 ); ok( $where, "Module fetched" ); ok( -f $where, " Module is a file" ); ok( -s $where, " Module has size" ); - + $Conf->set_conf( signature => $old ); } @@ -142,26 +142,26 @@ isa_ok( $Auth->parent, 'CPANPLUS::Backend' ); SKIP: { skip(q[You chose not to enable checksum verification], 5) unless $Conf->get_conf('md5'); - + my $cksum_file = $Mod->checksums; ok( $cksum_file, "Checksum file found" ); is( $cksum_file, $Mod->status->checksums, " File stored in module object" ); ok( -e $cksum_file, " File exists" ); ok( -s $cksum_file, " File has size" ); - + ### XXX test checksum_value if there's digest::md5 + config wants it ok( $Mod->status->checksum_ok, " Checksum is ok" ); - - ### check ttl code for checksums; fetching it now means the cache + + ### check ttl code for checksums; fetching it now means the cache ### should kick in { CPANPLUS::Error->flush; - ok( $Mod->checksums, + ok( $Mod->checksums, " Checksums re-fetched" ); like( CPANPLUS::Error->stack_as_string, qr/Using cached file/, " Cached file used" ); - } + } } } @@ -177,14 +177,14 @@ isa_ok( $Auth->parent, 'CPANPLUS::Backend' ); SKIP: { skip(q[You chose not to enable signature checks], 1) unless $Conf->get_conf('signature'); - + ok( $Mod->check_signature, "Signature check OK" ); } } ### dslip & related -{ my $dslip = $Mod->dslip; +{ my $dslip = $Mod->dslip; ok( $dslip, "Got dslip information from $ModName ($dslip)" ); ### now find it for a submodule @@ -193,33 +193,33 @@ isa_ok( $Auth->parent, 'CPANPLUS::Backend' ); ok( $submod->dslip, " Got dslip info (".$submod->dslip.")" ); is( $submod->dslip, $dslip, " It's identical to $ModName" ); - } + } } -{ ### details() test ### +{ ### details() test ### my $href = { 'Support Level' => 'Developer', 'Package' => $Mod->package, 'Description' => $Mod->description, - 'Development Stage' => + 'Development Stage' => 'under construction but pre-alpha (not yet released)', 'Author' => sprintf("%s (%s)", $Auth->author, $Auth->email), 'Version on CPAN' => $Mod->version, - 'Language Used' => + 'Language Used' => 'Perl-only, no compiler needed, should be platform independent', - 'Interface Style' => + 'Interface Style' => 'Object oriented using blessed references and/or inheritance', - 'Public License' => 'Unknown', + 'Public License' => 'Unknown', ### XXX we can't really know what you have installed ### #'Version Installed' => '0.06', - }; + }; my $res = $Mod->details; - + ### delete they key of which we don't know the value ### delete $res->{'Version Installed'}; - - is_deeply( $res, $href, "Details OK" ); + + is_deeply( $res, $href, "Details OK" ); } { ### contians() test ### @@ -227,9 +227,9 @@ isa_ok( $Auth->parent, 'CPANPLUS::Backend' ); ### we use 4x the same package name for different modules. So use ### the only unique package name here, which is the one for the core mod my @list = $CoreMod->contains; - + ok( scalar(@list), "Found modules contained in this one" ); - is_deeply( \@list, [$CoreMod], + is_deeply( \@list, [$CoreMod], " Found all modules expected" ); } @@ -263,9 +263,9 @@ isa_ok( $Auth->parent, 'CPANPLUS::Backend' ); my @objs = $bundle->bundle_modules; is( scalar(@objs), 5, " Found all prerequisites" ); - + for( @objs ) { - isa_ok( $_, 'CPANPLUS::Module', + isa_ok( $_, 'CPANPLUS::Module', " Prereq " . $_->module ); ok( defined $bundle->status->prereqs->{$_->module}, " Prereq was registered" ); @@ -273,21 +273,21 @@ isa_ok( $Auth->parent, 'CPANPLUS::Backend' ); } { ### testing autobundles - my $file = File::Spec->catfile( - dummy_cpan_dir(), + my $file = File::Spec->catfile( + dummy_cpan_dir(), $Conf->_get_build('autobundle'), - 'Snapshot.pm' + 'Snapshot.pm' ); my $uri = $CB->_host_to_uri( scheme => 'file', path => $file ); my $bundle = $CB->parse_module( module => $uri ); - + ok( -e $file, "Creating bundle from '$file'" ); ok( $bundle, " Object created" ); isa_ok( $bundle, 'CPANPLUS::Module', " Object" ); ok( $bundle->is_bundle, " Recognized as bundle" ); ok( $bundle->is_autobundle, " Recognized as autobundle" ); - + my $type = $bundle->get_installer_type; ok( $type, " Found installer type" ); is( $type, INSTALLER_AUTOBUNDLE, @@ -303,7 +303,7 @@ isa_ok( $Auth->parent, 'CPANPLUS::Backend' ); is( scalar(@list), 1, " Right number of prereqs" ); isa_ok( $list[0], 'CPANPLUS::Module', " Object" ); - + ### skiptests to make sure we don't get any test header mismatches my $rv = $bundle->create( prereq_target => 'create', skiptest => 1 ); ok( $rv, " Tested prereqs" ); @@ -313,28 +313,28 @@ isa_ok( $Auth->parent, 'CPANPLUS::Backend' ); ### test module from perl core ### { isa_ok( $CoreMod, 'CPANPLUS::Module', "Core module " . $CoreName ); - ok( $CoreMod->package_is_perl_core, + ok( $CoreMod->package_is_perl_core, " Package found in perl core" ); - + ### check if it's core with 5.6.1 { local $] = '5.006001'; ok( $CoreMod->module_is_supplied_with_perl_core, " Module also found in perl core"); } - + ok( !$CoreMod->install, " Package not installed" ); like( CPANPLUS::Error->stack_as_string, qr/core Perl/, " Error properly logged" ); -} +} ### test third-party modules SKIP: { - skip "Module::ThirdParty not installed", 10 + skip "Module::ThirdParty not installed", 10 unless eval { require Module::ThirdParty; 1 }; - ok( !$Mod->is_third_party, + ok( !$Mod->is_third_party, "Not a 3rd party module: ". $Mod->name ); - + my $fake = $CB->parse_module( module => 'LOCAL/SVN-Core-1.0' ); ok( $fake, "Created module object for ". $fake->name ); ok( $fake->is_third_party, @@ -343,11 +343,11 @@ SKIP: { my $info = $fake->third_party_information; ok( $info, "Got 3rd party package information" ); isa_ok( $info, 'HASH' ); - + for my $item ( qw[name url author author_url] ) { ok( length($info->{$item}), " $item field is filled" ); - } + } } ### testing EU::Installed methods in Dist::MM tests ### diff --git a/gnu/usr.bin/perl/cpan/CPANPLUS/t/05_CPANPLUS-Internals-Fetch.t b/gnu/usr.bin/perl/cpan/CPANPLUS/t/05_CPANPLUS-Internals-Fetch.t index 7a6b1acb86f..9d648fc38f7 100755 --- a/gnu/usr.bin/perl/cpan/CPANPLUS/t/05_CPANPLUS-Internals-Fetch.t +++ b/gnu/usr.bin/perl/cpan/CPANPLUS/t/05_CPANPLUS-Internals-Fetch.t @@ -1,6 +1,6 @@ ### make sure we can find our conf.pl file -BEGIN { - use FindBin; +BEGIN { + use FindBin; require "$FindBin::Bin/inc/conf.pl"; } @@ -26,11 +26,11 @@ isa_ok( $mod, 'CPANPLUS::Module' ); ### fail host tests ### { my $host = {}; my $rv = $cb->_add_fail_host( host => $host ); - + ok( $rv, "Failed host added " ); - ok(!$cb->_host_ok( host => $host), + ok(!$cb->_host_ok( host => $host), " Host registered as failed" ); - ok( $cb->_host_ok( host => {} ), + ok( $cb->_host_ok( host => {} ), " Fresh host unregistered" ); } @@ -38,7 +38,7 @@ isa_ok( $mod, 'CPANPLUS::Module' ); { my $where = $cb->_fetch( module => $mod, force => 1 ); ok( $where, "File downloaded to '$where'" ); - ok( -s $where, " File exists" ); + ok( -s $where, " File exists" ); unlink $where; ok(!-e $where, " File removed" ); } @@ -46,24 +46,24 @@ isa_ok( $mod, 'CPANPLUS::Module' ); ### try to fetch something that doesn't exist ### { ### set up a bogus host first ### my $hosts = $conf->get_conf('hosts'); - my $fail = { scheme => 'file', + my $fail = { scheme => 'file', path => "$0/$0" }; - + unshift @$hosts, $fail; $conf->set_conf( hosts => $hosts ); - + ### the fallback host will get it ### my $where = $cb->_fetch( module => $mod, force => 1, verbose => 0 ); ok($where, "File downloaded to '$where'" ); - ok( -s $where, " File exists" ); - + ok( -s $where, " File exists" ); + ### but the error should be recorded ### like( CPANPLUS::Error->stack_as_string, qr/Fetching of .*? failed/s, - " Error recorded appropriately" ); + " Error recorded appropriately" ); ### host marked as bad? ### - ok(!$cb->_host_ok( host => $fail ), - " Failed host logged properly" ); + ok(!$cb->_host_ok( host => $fail ), + " Failed host logged properly" ); ### restore the hosts ### shift @$hosts; $conf->set_conf( hosts => $hosts ); @@ -82,23 +82,23 @@ isa_ok( $mod, 'CPANPLUS::Module' ); : File::Spec::Unix->catfile( File::Spec::Unix->catdir( File::Spec->splitdir( $cwd ) ), $base - ); - + ); + my $target = CREATE_FILE_URI->($in_file); my $fake = $cb->parse_module( module => $target ); - - ok( IS_FAKE_MODOBJ->(mod => $fake), + + ok( IS_FAKE_MODOBJ->(mod => $fake), "Fake module created from $0" ); is( $fake->status->_fetch_from, $target, - " Fetch from set ok" ); - + " Fetch from set ok" ); + my $where = $fake->fetch; ok( $where, " $target fetched ok" ); ok( -s $where, " $where exists" ); like( $where, '/'. UNKNOWN_DL_LOCATION .'/', " Saved to proper location" ); - like( $where, qr/$base$/, " Saved with proper name" ); + like( $where, qr/$base$/, " Saved with proper name" ); } diff --git a/gnu/usr.bin/perl/cpan/CPANPLUS/t/06_CPANPLUS-Internals-Constants.t b/gnu/usr.bin/perl/cpan/CPANPLUS/t/06_CPANPLUS-Internals-Constants.t index 993b2dc4ac0..65bde1181ab 100755 --- a/gnu/usr.bin/perl/cpan/CPANPLUS/t/06_CPANPLUS-Internals-Constants.t +++ b/gnu/usr.bin/perl/cpan/CPANPLUS/t/06_CPANPLUS-Internals-Constants.t @@ -1,6 +1,6 @@ ### make sure we can find our conf.pl file -BEGIN { - use FindBin; +BEGIN { + use FindBin; require "$FindBin::Bin/inc/conf.pl"; } @@ -40,7 +40,7 @@ ok( IS_CONFOBJ->( conf => $conf ), "IS_CONFOBJ recognizes conf object" ); ok( FILE_EXISTS->( file => basename($0) ), "FILE_EXISTS finds file" ); ok( FILE_READABLE->( file => basename($0) ), "FILE_READABLE finds file" ); ok( DIR_EXISTS->( dir => cwd() ), "DIR_EXISTS finds dir" ); - + { no strict 'refs'; @@ -56,18 +56,18 @@ ok( DIR_EXISTS->( dir => cwd() ), "DIR_EXISTS finds dir" ); : 'Makefile' }, }; - + while ( my($sub,$res) = each %$tmpl ) { is( &{$sub}->(), $res, "$sub returns proper result without args" ); - + my $long = File::Spec->catfile( cwd(), $res ); is( &{$sub}->( cwd() ), $long, "$sub returns proper result with args" ); - } -} - + } +} + # Local variables: # c-indentation-style: bsd # c-basic-offset: 4 # indent-tabs-mode: nil # End: -# vim: expandtab shiftwidth=4: +# vim: expandtab shiftwidth=4: diff --git a/gnu/usr.bin/perl/cpan/CPANPLUS/t/07_CPANPLUS-Internals-Extract.t b/gnu/usr.bin/perl/cpan/CPANPLUS/t/07_CPANPLUS-Internals-Extract.t index 3c18a3b9443..b03befa8ac7 100755 --- a/gnu/usr.bin/perl/cpan/CPANPLUS/t/07_CPANPLUS-Internals-Extract.t +++ b/gnu/usr.bin/perl/cpan/CPANPLUS/t/07_CPANPLUS-Internals-Extract.t @@ -1,6 +1,6 @@ ### make sure we can find our conf.pl file -BEGIN { - use FindBin; +BEGIN { + use FindBin; require "$FindBin::Bin/inc/conf.pl"; } diff --git a/gnu/usr.bin/perl/cpan/CPANPLUS/t/08_CPANPLUS-Backend.t b/gnu/usr.bin/perl/cpan/CPANPLUS/t/08_CPANPLUS-Backend.t index aba3a475f77..73611e872bf 100755 --- a/gnu/usr.bin/perl/cpan/CPANPLUS/t/08_CPANPLUS-Backend.t +++ b/gnu/usr.bin/perl/cpan/CPANPLUS/t/08_CPANPLUS-Backend.t @@ -1,6 +1,6 @@ ### make sure we can find our conf.pl file -BEGIN { - use FindBin; +BEGIN { + use FindBin; require "$FindBin::Bin/inc/conf.pl"; } @@ -25,8 +25,8 @@ isa_ok( $cb, $Class ); my $mt = $cb->module_tree; my $at = $cb->author_tree; -ok( scalar keys %$mt, "Module tree has entries" ); -ok( scalar keys %$at, "Author tree has entries" ); +ok( scalar keys %$mt, "Module tree has entries" ); +ok( scalar keys %$at, "Author tree has entries" ); ### module_tree tests ### my $Name = TEST_CONF_MODULE; @@ -35,7 +35,7 @@ my $mod = $cb->module_tree($Name); ### XXX SOURCEFILES FIX { my @mods = $cb->module_tree($Name,$Name); my $none = $cb->module_tree( TEST_CONF_INVALID_MODULE ); - + ok( IS_MODOBJ->(mod => $mod), "Module object found" ); is( scalar(@mods), 2, " Module list found" ); ok( IS_MODOBJ->(mod => $mods[0]), " ISA module object" ); @@ -46,7 +46,7 @@ my $mod = $cb->module_tree($Name); { my @auths = $cb->author_tree( $mod->author->cpanid, $mod->author->cpanid ); my $none = $cb->author_tree( 'fnurk' ); - + ok( IS_AUTHOBJ->(auth => $mod->author), "Author object found" ); is( scalar(@auths), 2, " Author list found" ); ok( IS_AUTHOBJ->( author => $auths[0] )," ISA author object" ); @@ -59,122 +59,122 @@ ok( IS_CONFOBJ->(conf => $conf_obj), "Configure object found" ); ### parse_module tests ### -{ my @map = ( - $Name => [ +{ my @map = ( + $Name => [ $mod->author->cpanid, # author $mod->package_name, # package name $mod->version, # version ], - $mod => [ - $mod->author->cpanid, - $mod->package_name, - $mod->version, + $mod => [ + $mod->author->cpanid, + $mod->package_name, + $mod->version, ], - 'Foo-Bar-EU-NOXS' => [ - $mod->author->cpanid, - $mod->package_name, + 'Foo-Bar-EU-NOXS' => [ + $mod->author->cpanid, + $mod->package_name, $mod->version, ], - 'Foo-Bar-EU-NOXS-0.01' => [ - $mod->author->cpanid, - $mod->package_name, + 'Foo-Bar-EU-NOXS-0.01' => [ + $mod->author->cpanid, + $mod->package_name, '0.01', ], - 'EUNOXS/Foo-Bar-EU-NOXS' => [ + 'EUNOXS/Foo-Bar-EU-NOXS' => [ 'EUNOXS', - $mod->package_name, + $mod->package_name, $mod->version, ], - 'EUNOXS/Foo-Bar-EU-NOXS-0.01' => [ - 'EUNOXS', - $mod->package_name, + 'EUNOXS/Foo-Bar-EU-NOXS-0.01' => [ + 'EUNOXS', + $mod->package_name, '0.01', ], ### existing module, no extension given ### this used to create a modobj with no package extension - 'EUNOXS/Foo-Bar-0.02' => [ - 'EUNOXS', + 'EUNOXS/Foo-Bar-0.02' => [ + 'EUNOXS', 'Foo-Bar', '0.02', ], - 'Foo-Bar-EU-NOXS-0.09' => [ - $mod->author->cpanid, - $mod->package_name, + 'Foo-Bar-EU-NOXS-0.09' => [ + $mod->author->cpanid, + $mod->package_name, '0.09', ], - 'MBXS/Foo-Bar-EU-NOXS-0.01' => [ - 'MBXS', - $mod->package_name, + 'MBXS/Foo-Bar-EU-NOXS-0.01' => [ + 'MBXS', + $mod->package_name, '0.01', ], - 'EUNOXS/Foo-Bar-EU-NOXS-0.09' => [ + 'EUNOXS/Foo-Bar-EU-NOXS-0.09' => [ 'EUNOXS', - $mod->package_name, + $mod->package_name, '0.09', ], - 'EUNOXS/Foo-Bar-EU-NOXS-0.09.zip' => [ + 'EUNOXS/Foo-Bar-EU-NOXS-0.09.zip' => [ 'EUNOXS', - $mod->package_name, + $mod->package_name, '0.09', ], - 'FROO/Flub-Flob-1.1.zip' => [ - 'FROO', - 'Flub-Flob', - '1.1', + 'FROO/Flub-Flob-1.1.zip' => [ + 'FROO', + 'Flub-Flob', + '1.1', ], - 'G/GO/GOYALI/SMS_API_3_01.tar.gz' => [ - 'GOYALI', - 'SMS_API', - '3_01', + 'G/GO/GOYALI/SMS_API_3_01.tar.gz' => [ + 'GOYALI', + 'SMS_API', + '3_01', ], - 'E/EY/EYCK/Net/Lite/Net-Lite-FTP-0.091' => [ - 'EYCK', - 'Net-Lite-FTP', + 'E/EY/EYCK/Net/Lite/Net-Lite-FTP-0.091' => [ + 'EYCK', + 'Net-Lite-FTP', '0.091', ], - 'EYCK/Net/Lite/Net-Lite-FTP-0.091' => [ + 'EYCK/Net/Lite/Net-Lite-FTP-0.091' => [ 'EYCK', - 'Net-Lite-FTP', + 'Net-Lite-FTP', '0.091', ], - 'M/MA/MAXDB/DBD-MaxDB-7.5.0.24a' => [ + 'M/MA/MAXDB/DBD-MaxDB-7.5.0.24a' => [ 'MAXDB', 'DBD-MaxDB', - '7.5.0.24a', + '7.5.0.24a', ], - 'EUNOXS/perl5.005_03.tar.gz' => [ - 'EUNOXS', + 'EUNOXS/perl5.005_03.tar.gz' => [ + 'EUNOXS', 'perl', '5.005_03', ], - 'FROO/Flub-Flub-v1.1.0.tbz' => [ - 'FROO', - 'Flub-Flub', - 'v1.1.0', + 'FROO/Flub-Flub-v1.1.0.tbz' => [ + 'FROO', + 'Flub-Flub', + 'v1.1.0', ], - 'FROO/Flub-Flub-1.1_2.tbz' => [ - 'FROO', - 'Flub-Flub', + 'FROO/Flub-Flub-1.1_2.tbz' => [ + 'FROO', + 'Flub-Flub', '1.1_2', - ], - 'LDS/CGI.pm-3.27.tar.gz' => [ + ], + 'LDS/CGI.pm-3.27.tar.gz' => [ 'LDS', 'CGI', - '3.27', + '3.27', ], - 'FROO/Text-Tabs+Wrap-2006.1117.tar.gz' => [ - 'FROO', + 'FROO/Text-Tabs+Wrap-2006.1117.tar.gz' => [ + 'FROO', 'Text-Tabs+Wrap', - '2006.1117', - ], - 'JETTERO/Crypt-PBC-0.7.20.0-0.4.9' => [ + '2006.1117', + ], + 'JETTERO/Crypt-PBC-0.7.20.0-0.4.9' => [ 'JETTERO', 'Crypt-PBC', '0.7.20.0-0.4.9' , ], - 'GRICHTER/HTML-Embperl-1.2.1.tar.gz' => [ - 'GRICHTER', - 'HTML-Embperl', + 'GRICHTER/HTML-Embperl-1.2.1.tar.gz' => [ + 'GRICHTER', + 'HTML-Embperl', '1.2.1', ], 'KANE/File-Fetch-0.15_03' => [ @@ -186,18 +186,13 @@ ok( IS_CONFOBJ->(conf => $conf_obj), "Configure object found" ); 'AUSCHUTZ', 'IO-Stty', '.02', - ], + ], '.' => [ 'CPANPLUS', 't', '', - ], - 'Foo/Bar.pm' => [ - $mod->author->cpanid, # author - $mod->package_name, # package name - $mod->version, # version - ], - ); + ], + ); while ( my($guess, $attr) = splice @map, 0, 2 ) { my( $author, $pkg_name, $version ) = @$attr; @@ -205,11 +200,11 @@ ok( IS_CONFOBJ->(conf => $conf_obj), "Configure object found" ); ok( $guess, "Attempting to parse $guess" ); my $obj = $cb->parse_module( module => $guess ); - + ok( $obj, " Result returned" ); - ok( IS_MODOBJ->( mod => $obj ), - " parse_module success by '$guess'" ); - + ok( IS_MODOBJ->( mod => $obj ), + " parse_module success by '$guess'" ); + is( $obj->version, $version, " Proper version found: $version" ); is( $obj->package_version, $version, @@ -223,10 +218,10 @@ ok( IS_CONFOBJ->(conf => $conf_obj), "Configure object found" ); { my $ext = $obj->package_extension; ok( $ext, " Has extension as well: $ext" ); } - - like( $obj->author->cpanid, "/$author/i", + + like( $obj->author->cpanid, "/$author/i", " Proper author found: $author"); - like( $obj->path, "/$author/i", + like( $obj->path, "/$author/i", " Proper path found: " . $obj->path ); } @@ -238,49 +233,49 @@ ok( IS_CONFOBJ->(conf => $conf_obj), "Configure object found" ); [qr/Cannot find .+? in the module tree/,"Unable to find module"] ] ], [ {}, => [ - [ qr/module string from reference/,"Unable to parse ref"] + [ qr/module string from reference/,"Unable to parse ref"] ] ], ); for my $entry ( @map ) { my($mod,$aref) = @$entry; - + my $none = $cb->parse_module( module => $mod ); - ok( !IS_MODOBJ->(mod => $none), - "Non-existent module detected" ); + ok( !IS_MODOBJ->(mod => $none), + "Non-existant module detected" ); ok( !IS_FAKE_MODOBJ->(mod => $none), - "Non-existent fake module detected" ); - + "Non-existant fake module detected" ); + my $str = CPANPLUS::Error->stack_as_string; for my $pair (@$aref) { my($re,$diag) = @$pair; like( $str, $re," $diag" ); } - } + } } - + ### test parsing of arbitrary URI for my $guess ( qw[ http://foo/bar.gz http://a/b/c/d/e/f/g/h/i/j flub://floo ] ) { my $obj = $cb->parse_module( module => $guess ); - ok( IS_FAKE_MODOBJ->(mod => $obj), + ok( IS_FAKE_MODOBJ->(mod => $obj), "parse_module success by '$guess'" ); is( $obj->status->_fetch_from, $guess, " Fetch from set ok" ); - } -} + } +} ### RV tests ### { my $method = 'readme'; - my %args = ( modules => [$Name] ); - + my %args = ( modules => [$Name] ); + my $rv = $cb->$method( %args ); ok( IS_RVOBJ->( $rv ), "Got an RV object" ); ok( $rv->ok, " Overall OK" ); cmp_ok( $rv, '==', 1, " Overload OK" ); - is( $rv->function, $method, " Function stored OK" ); + is( $rv->function, $method, " Function stored OK" ); is_deeply( $rv->args, \%args, " Arguments stored OK" ); is( $rv->rv->{$Name}, $mod->readme, " RV as expected" ); } @@ -290,18 +285,18 @@ ok( IS_CONFOBJ->(conf => $conf_obj), "Configure object found" ); my $file = File::Spec->catfile( $conf->get_conf('base'), $conf->_get_source('mod'), ); - - ok( $cb->reload_indices( update_source => 0 ), "Rebuilding trees" ); + + ok( $cb->reload_indices( update_source => 0 ), "Rebuilding trees" ); my $age = -M $file; - + ### make sure we are 'newer' on faster machines with a sleep.. ### apparently Win32's FAT isn't granual enough on intervals ### < 2 seconds, so it may give the same answer before and after ### the sleep, causing the test to fail. so sleep atleast 2 seconds. sleep 2; - ok( $cb->reload_indices( update_source => 1 ), + ok( $cb->reload_indices( update_source => 1 ), "Rebuilding and refetching trees" ); - cmp_ok( $age, '>', -M $file, " Source file '$file' updated" ); + cmp_ok( $age, '>', -M $file, " Source file '$file' updated" ); } ### flush tests ### @@ -313,8 +308,8 @@ ok( IS_CONFOBJ->(conf => $conf_obj), "Configure object found" ); ### installed tests ### { ok( scalar($cb->installed), "Found list of installed modules" ); -} - +} + ### autobudle tests ### { my $where = $cb->autobundle; @@ -323,17 +318,17 @@ ok( IS_CONFOBJ->(conf => $conf_obj), "Configure object found" ); } ### local_mirror tests ### -{ ### turn off md5 checks for the 'fake' packages we have +{ ### turn off md5 checks for the 'fake' packages we have my $old_md5 = $conf->get_conf('md5'); $conf->set_conf( md5 => 0 ); ### otherwise 'status->fetch' might be undef! ### my $rv = $cb->local_mirror( path => 'dummy-localmirror' ); ok( $rv, "Local mirror created" ); - + for my $mod ( values %{ $cb->module_tree } ) { my $name = $mod->module; - + my $cksum = File::Spec->catfile( dirname($mod->status->fetch), CHECKSUMS ); @@ -341,10 +336,10 @@ ok( IS_CONFOBJ->(conf => $conf_obj), "Configure object found" ); ok( -s _, " Module '$name' has size" ); ok( -e $cksum, " Checksum fetched for '$name'" ); ok( -s _, " Checksum for '$name' has size" ); - } + } $conf->set_conf( md5 => $old_md5 ); -} +} ### check ENV variable { ### process id @@ -353,23 +348,23 @@ ok( IS_CONFOBJ->(conf => $conf_obj), "Configure object found" ); is( $ENV{$name}, $$, " Set to current process id" ); } - ### Version + ### Version { my $name = 'PERL5_CPANPLUS_IS_VERSION'; ok( $ENV{$name}, "Env var '$name' set" ); ### version.pm formats ->VERSION output... *sigh* - is( $ENV{$name}, $Class->VERSION, + is( $ENV{$name}, $Class->VERSION, " Set to current process version" ); } - + } -__END__ - +__END__ + # Local variables: # c-indentation-style: bsd # c-basic-offset: 4 # indent-tabs-mode: nil # End: -# vim: expandtab shiftwidth=4: - +# vim: expandtab shiftwidth=4: + diff --git a/gnu/usr.bin/perl/cpan/CPANPLUS/t/09_CPANPLUS-Internals-Search.t b/gnu/usr.bin/perl/cpan/CPANPLUS/t/09_CPANPLUS-Internals-Search.t index e5ef37cb686..c00437d09a7 100755 --- a/gnu/usr.bin/perl/cpan/CPANPLUS/t/09_CPANPLUS-Internals-Search.t +++ b/gnu/usr.bin/perl/cpan/CPANPLUS/t/09_CPANPLUS-Internals-Search.t @@ -1,6 +1,6 @@ ### make sure we can find our conf.pl file -BEGIN { - use FindBin; +BEGIN { + use FindBin; require "$FindBin::Bin/inc/conf.pl"; } @@ -37,7 +37,7 @@ for my $type ( CPANPLUS::Module->accessors() ) { ### search for authors ### my $auth = $Mod->author; for my $type ( CPANPLUS::Module::Author->accessors() ) { - + ### don't muck around with references/objects ### or private identifiers next if ref $auth->$type() or $type =~/^_/; diff --git a/gnu/usr.bin/perl/cpan/CPANPLUS/t/10_CPANPLUS-Error.t b/gnu/usr.bin/perl/cpan/CPANPLUS/t/10_CPANPLUS-Error.t index 355ca7aad49..800a126c0d2 100755 --- a/gnu/usr.bin/perl/cpan/CPANPLUS/t/10_CPANPLUS-Error.t +++ b/gnu/usr.bin/perl/cpan/CPANPLUS/t/10_CPANPLUS-Error.t @@ -1,6 +1,6 @@ ### make sure we can find our conf.pl file -BEGIN { - use FindBin; +BEGIN { + use FindBin; require "$FindBin::Bin/inc/conf.pl"; } @@ -19,7 +19,7 @@ my $map = { error => ["This is just a test error"], }; -### check if CPANPLUS::Error can do what we expect +### check if CPANPLUS::Error can do what we expect { for my $name ( keys %$map ) { can_ok('CPANPLUS::Error', $name); can_ok('main', $name); # did it get exported? @@ -28,8 +28,8 @@ my $map = { ### make sure we start with an empty stack { CPANPLUS::Error->flush; - is( scalar(()=CPANPLUS::Error->stack), 0, - "Starting with empty stack" ); + is( scalar(()=CPANPLUS::Error->stack), 0, + "Starting with empty stack" ); } ### global variables test ### @@ -37,9 +37,9 @@ my $map = { ### this *has* to be set, as we're testing the contents of the file ### to see if it matches what's stored in the buffer. - local $CPANPLUS::Error::MSG_FH = output_handle(); + local $CPANPLUS::Error::MSG_FH = output_handle(); local $CPANPLUS::Error::ERROR_FH = output_handle(); - + ok( -e $file, "Output redirect file exists" ); ok( !-s $file, " Output file is empty" ); @@ -51,40 +51,40 @@ my $map = { } ### must close it for Win32 tests! - close output_handle; + close output_handle; ok( -s $file, " Output file now has size" ); - + my $fh = FileHandle->new( $file ); ok( $fh, "Opened output file for reading " ); - + my $contents = do { local $/; <$fh> }; my $string = CPANPLUS::Error->stack_as_string; my $trace = CPANPLUS::Error->stack_as_string(1); - + ok( $contents, " Got the file contents" ); ok( $string, "Got the error stack as string" ); - - + + for my $type ( keys %$map ) { my $tag = $type; $tag =~ s/.+?_//g; - + for my $str (@{ $map->{$type} } ) { like( $contents, qr/\U\Q$tag/, - " Contents matches for '$type'" ); + " Contents matches for '$type'" ); like( $contents, qr/\Q$str/, - " Contents matches for '$type'" ); - + " Contents matches for '$type'" ); + like( $string, qr/\U\Q$tag/, - " String matches for '$type'" ); + " String matches for '$type'" ); like( $string, qr/\Q$str/, " String matches for '$type'" ); like( $trace, qr/\U\Q$tag/, - " Trace matches for '$type'" ); + " Trace matches for '$type'" ); like( $trace, qr/\Q$str/, " Trace matches for '$type'" ); - + ### extra trace tests ### like( $trace, qr/\Q$str\E.*?\Q$str/s, " Trace holds proper traceback" ); @@ -92,17 +92,17 @@ my $map = { " Trace holds program name" ); like( $trace, qr/line/, " Trace holds line number information" ); - } + } } ### check the stack, flush it, check again ### - is( scalar(()=CPANPLUS::Error->stack), scalar(keys(%$map)), + is( scalar(()=CPANPLUS::Error->stack), scalar(keys(%$map)), "All items on stack" ); is( scalar(()=CPANPLUS::Error->flush), scalar(keys(%$map)), "All items flushed" ); - is( scalar(()=CPANPLUS::Error->stack), 0, - "No items on stack" ); - + is( scalar(()=CPANPLUS::Error->stack), 0, + "No items on stack" ); + } diff --git a/gnu/usr.bin/perl/cpan/CPANPLUS/t/15_CPANPLUS-Shell.t b/gnu/usr.bin/perl/cpan/CPANPLUS/t/15_CPANPLUS-Shell.t index 51283c67275..2a7e8c6b87f 100755 --- a/gnu/usr.bin/perl/cpan/CPANPLUS/t/15_CPANPLUS-Shell.t +++ b/gnu/usr.bin/perl/cpan/CPANPLUS/t/15_CPANPLUS-Shell.t @@ -1,8 +1,8 @@ ### the shell prints to STDOUT, so capture that here ### and we can check the output ### make sure we can find our conf.pl file -BEGIN { - use FindBin; +BEGIN { + use FindBin; require "$FindBin::Bin/inc/conf.pl"; } @@ -17,7 +17,7 @@ BEGIN { sub _out { $out } sub _reset_out { $out = '' } -} +} use strict; use Test::More 'no_plan'; @@ -37,25 +37,22 @@ my $Default = SHELL_DEFAULT; my $TestMod = TEST_CONF_MODULE; my $TestAuth= TEST_CONF_AUTHOR; -unless ( -t ) { - ok('We are not on a terminal'); - exit 0; -} - + ### basic load tests use_ok( $Class, 'Default' ); is( $Class->which, SHELL_DEFAULT, "Default shell loaded" ); + ### create an object my $Shell = $Class->new( $Conf ); ok( $Shell, " New object created" ); isa_ok( $Shell, $Default, " Object" ); ### method tests -{ +{ ### uri to use for /cs tests my $cs_path = File::Spec->rel2abs( - File::Spec->catfile( + File::Spec->catfile( $FindBin::Bin, TEST_CONF_CPAN_DIR, ) @@ -65,10 +62,10 @@ isa_ok( $Shell, $Default, " Object" ); host => '', path => $cs_path, ); + + my $base = $Conf->get_conf('base'); - my $base = $Conf->get_conf('base'); - - ### XXX have to keep the list ordered, as some methods only work as + ### XXX have to keep the list ordered, as some methods only work as ### expected *after* others have run my @map = ( 'v' => qr/CPANPLUS/, @@ -95,7 +92,7 @@ isa_ok( $Shell, $Default, " Object" ); '! die $$; p' => qr/$$/, '/plugins' => qr/Available plugins:/i, '/? ?' => qr/usage/i, - + ### custom source plugin tests ### lower case path matching, as on VMS we can't predict case "/? cs" => qr|/cs|, @@ -113,21 +110,21 @@ isa_ok( $Shell, $Default, " Object" ); my $meth = 'dispatch_on_input'; can_ok( $Shell, $meth ); - + while( my($input,$out_re) = splice(@map, 0, 2) ) { ### empty output cache __PACKAGE__->_reset_out; CPANPLUS::Error->flush; - + ok( 1, "Testing '$input'" ); $Shell->$meth( input => $input ); - + my $out = __PACKAGE__->_out; - + ### XXX remove me #diag( $out ); - + ok( $out, " Output received" ); like( $out, $out_re, " Output matches '$out_re'" ); } @@ -135,18 +132,18 @@ isa_ok( $Shell, $Default, " Object" ); __END__ -#### test separately, they have side effects +#### test seperately, they have side effects 'q' => qr/^$/, # no output! -'s save boxed' => do { my $re = CONFIG_BOXED; qr/$re/ }, -### this doens't write any output +'s save boxed' => do { my $re = CONFIG_BOXED; qr/$re/ }, +### this doens't write any output 'x --update_source' => qr/module tree/i, s edit s reconfigure -'c' => '_reports', -'i' => '_install', +'c' => '_reports', +'i' => '_install', 'u' => '_uninstall', 'z' => '_shell', ### might not have any out of date modules... 'o' => '_uptodate', - + diff --git a/gnu/usr.bin/perl/cpan/CPANPLUS/t/19_CPANPLUS-Dist.t b/gnu/usr.bin/perl/cpan/CPANPLUS/t/19_CPANPLUS-Dist.t index b551741eef6..cb0cd333050 100755 --- a/gnu/usr.bin/perl/cpan/CPANPLUS/t/19_CPANPLUS-Dist.t +++ b/gnu/usr.bin/perl/cpan/CPANPLUS/t/19_CPANPLUS-Dist.t @@ -1,6 +1,6 @@ ### make sure we can find our conf.pl file -BEGIN { - use FindBin; +BEGIN { + use FindBin; require "$FindBin::Bin/inc/conf.pl"; } @@ -21,7 +21,7 @@ BEGIN { require CPANPLUS::Dist; CPANPLUS::Dist->_add_dist_types( __PACKAGE__ ); - sub init { $_[0]->status->mk_accessors( + sub init { $_[0]->status->mk_accessors( qw[prepared created installed _prepare_args _install_args _create_args]); return $Init }; @@ -50,7 +50,7 @@ my $cb = CPANPLUS::Backend->new( $conf ); ### obsolete #my $Format = '_test'; my $Module = 'CPANPLUS::Dist::_Test'; -my $ModName = TEST_CONF_MODULE; +my $ModName = TEST_CONF_MODULE; my $ModPrereq = TEST_CONF_INST_MODULE; ### XXX this version doesn't exist, but we don't check for it either ### my $Prereq = { $ModPrereq => '1000' }; @@ -96,7 +96,7 @@ ok( $Mod, "Got module object" ); { local $CPANPLUS::Dist::_Test::Available = 0; ok( !$Module->format_available, - "Format availability turned off" ); + "Format availabillity turned off" ); { $conf->_set_build('sanity_check' => 0); @@ -108,9 +108,9 @@ ok( $Mod, "Got module object" ); } { $conf->_set_build('sanity_check' => 1); - + my $dist = $Module->new( module => $Mod ); - + ok( !$dist, "Dist not created with sanity check on" ); like( CPANPLUS::Error->stack_as_string, qr/Format '$Module' is not available/, @@ -122,7 +122,7 @@ ok( $Mod, "Got module object" ); { local $CPANPLUS::Dist::_Test::Init = 0; my $dist = $Module->new( module => $Mod ); - + ok( !$dist, "No dist created by failed init" ); like( CPANPLUS::Error->stack_as_string, qr/Dist initialization of '$Module' failed for/s, @@ -132,36 +132,36 @@ ok( $Mod, "Got module object" ); ### configure_requires tests { my $meta = META->( $Mod ); ok( $meta, "Reading 'configure_requires' from '$meta'" ); - + my $clone = $Mod->clone; ok( $clone, " Package cloned" ); ### set the new location to fetch from $clone->package( $meta ); - + my $file = $clone->fetch; ok( $file, " Meta file fetched" ); ok( -e $file, " File '$file' exits" ); - + my $dist = $Module->new( module => $Mod ); ok( $dist, " Dist object created" ); - - my $meth = 'find_configure_requires'; + + my $meth = 'find_configure_requires'; can_ok( $dist, $meth ); - + my $href = $dist->$meth( file => $file ); ok( $href, " '$meth' returned hashref" ); - + ok( scalar(keys(%$href)), " Contains entries" ); ok( $href->{ +TEST_CONF_PREREQ }, " Contains the right prereq" ); -} +} ### test _resolve prereqs, in a somewhat simulated set of circumstances { my $old_prereq = $conf->get_conf('prereqs'); - + my $map = { 0 => { 'Previous install failed' => [ @@ -199,6 +199,13 @@ ok( $Mod, "Got module object" ); " Dist installation failed recorded ok" ) }, ], + "Set dependency to be perl-core" => [ + sub { $cb->module_tree( $ModPrereq )->package( + 'perl-5.8.1.tar.gz' ); 'install' }, + sub { like( CPANPLUS::Error->stack_as_string, + qr/Prerequisite '$ModPrereq' is perl-core/s, + " Dist installation failed recorded ok" ) }, + ], 'Simple ignore' => [ sub { 'ignore' }, sub { ok( !$_[0]->status->prepared, @@ -222,10 +229,10 @@ ok( $Mod, "Got module object" ); 'Perl binary version too low' => [ sub { $cb->module_tree( $ModName ) ->status->prereqs({ PERL_CORE, 10000000000 }); '' }, - sub { like( CPANPLUS::Error->stack_as_string, + sub { like( CPANPLUS::Error->stack_as_string, qr/needs perl version/, " Perl version not high enough" ) }, - ], + ], }, 1 => { 'Simple create' => [ @@ -247,14 +254,6 @@ ok( $Mod, "Got module object" ); " Module status says installed" ) }, ], - "Set dependency to be perl-core" => [ - sub { $cb->module_tree( $ModPrereq )->package( - 'perl-5.8.1.tar.gz' ); 'install' }, - sub { like( CPANPLUS::Error->stack_as_string, - qr/Prerequisite '$ModPrereq' is perl-core/s, - " Dist installation failed recorded ok" ) }, - ], - 'Install from conf' => [ sub { $conf->set_conf(prereqs => PREREQ_INSTALL); '' }, sub { ok( $_[0]->status->prepared, @@ -316,10 +315,10 @@ ok( $Mod, "Got module object" ); 'Perl binary version sufficient' => [ sub { $cb->module_tree( $ModName ) ->status->prereqs({ PERL_CORE, 1 }); '' }, - sub { unlike( CPANPLUS::Error->stack_as_string, + sub { unlike( CPANPLUS::Error->stack_as_string, qr/needs perl version/, " Perl version sufficient" ) }, - ], + ], }, }; @@ -372,7 +371,7 @@ ok( $Mod, "Got module object" ); 0 => undef, 1 => undef, 2 => qr/have to resolve/, - }; + }; my $mod = CPANPLUS::Module::Fake->new( module => $$, @@ -382,37 +381,37 @@ ok( $Mod, "Got module object" ); ok( $mod, "Fake module created" ); is( $mod->version, 1, " Version set correctly" ); - + my $dist = $Module->new( module => $Mod ); - + ok( $dist, "Dist object created" ); isa_ok( $dist, $Module ); - - + + ### scope it for the locals { local $^W; # quell sub redefined warnings; - + ### is_uptodate will need to return false for this test local *CPANPLUS::Module::Fake::is_uptodate = sub { return }; local *CPANPLUS::Module::Fake::is_uptodate = sub { return }; - CPANPLUS::Error->flush; - - + CPANPLUS::Error->flush; + + ### it's satisfied while( my($ver, $re) = each %$map ) { - + my $rv = $dist->prereq_satisfied( version => $ver, modobj => $mod ); - - ok( 1, "Testing ver: $ver" ); + + ok( 1, "Testing ver: $ver" ); is( $rv, undef, " Return value as expected" ); - + if( $re ) { like( CPANPLUS::Error->stack_as_string, $re, " Error as expected" ); } - + CPANPLUS::Error->flush; } } diff --git a/gnu/usr.bin/perl/cpan/CPANPLUS/t/20_CPANPLUS-Dist-MM.t b/gnu/usr.bin/perl/cpan/CPANPLUS/t/20_CPANPLUS-Dist-MM.t index 5bba1371597..a203c88ffe3 100755 --- a/gnu/usr.bin/perl/cpan/CPANPLUS/t/20_CPANPLUS-Dist-MM.t +++ b/gnu/usr.bin/perl/cpan/CPANPLUS/t/20_CPANPLUS-Dist-MM.t @@ -1,6 +1,6 @@ ### make sure we can find our conf.pl file -BEGIN { - use FindBin; +BEGIN { + use FindBin; require "$FindBin::Bin/inc/conf.pl"; } @@ -103,7 +103,7 @@ ok( $Mod->extract, "Extracting module to ".$Mod->status->extract ); ok( $dist, "Dist created with target => " . TARGET_INIT ); ok( !$dist->status->prepared, " Prepare was not run" ); -} +} ok( $Mod->test, "Testing module" ); @@ -141,20 +141,20 @@ SKIP: { ### make sure no options are set in PERL5_MM_OPT, as they might ### change the installation target and therefor will 1. mess up ### the tests and 2. leave an installed copy of our test module - ### lying around. This addresses bug #29716: 20_CPANPLUS-Dist-MM.t - ### fails (and leaves test files installed) when EUMM options + ### lying around. This addresses bug #29716: 20_CPANPLUS-Dist-MM.t + ### fails (and leaves test files installed) when EUMM options ### include INSTALL_BASE - { local $ENV{'PERL5_MM_OPT'}; local $ENV{'PERL_MM_OPT'}; - + { local $ENV{'PERL5_MM_OPT'}; + ### add the new dir to the configuration too, so eu::installed tests ### work as they should $conf->set_conf( lib => [ TEST_CONF_INSTALL_DIR ] ); - - ok( $Mod->install( force => 1, - makemakerflags => 'PREFIX='.TEST_CONF_INSTALL_DIR, + + ok( $Mod->install( force => 1, + makemakerflags => 'PREFIX='.TEST_CONF_INSTALL_DIR, ), "Installing module" ); - } - + } + ok( $Mod->status->installed," Module installed according to status" ); @@ -164,8 +164,8 @@ SKIP: { ### #46890: ExtUtils::Installed + EU::MM PREFIX= don't always work ### well together skip( "ExtUtils::Installed issue #46890 prevents these tests from running reliably", 8 ); - - + + skip( "Old perl on cygwin detected " . "-- tests will fail due to known bugs", 8 ) if ON_OLD_CYGWIN; @@ -225,7 +225,7 @@ SKIP: { ### test exceptions in Dist::MM->create ### { ok( $Mod->status->mk_flush, "Old status info flushed" ); my $dist = INSTALLER_MM->new( module => $Mod ); - + ok( $dist, "New dist object made" ); ok(!$dist->prepare, " Dist->prepare failed" ); like( CPANPLUS::Error->stack_as_string, qr/No dir found to operate on/, @@ -268,7 +268,7 @@ SKIP: { ok( $dist->write_makefile_pl( force => 0 ), " Makefile.PL written" ); like( CPANPLUS::Error->stack_as_string, qr/Already created/, - " Prior existence noted" ); + " Prior existance noted" ); ### ok, unlink the makefile.pl, now really write one 1 while unlink $makefile; @@ -308,7 +308,7 @@ SKIP: { { my $unlink_sts = unlink($makefile_pl); 1 while unlink $makefile_pl; ok( $unlink_sts, "Deleting Makefile.PL"); - } + } ok( !-s $makefile_pl, " Makefile.PL deleted" ); ok( $dist->status->mk_flush,"Dist status flushed" ); ok( $dist->prepare, " Dist->prepare run again" ); @@ -339,7 +339,7 @@ SKIP: { ### now let's write a makefile.pl that just does 'die' { local $^W; - local *CPANPLUS::Dist::MM::write_makefile_pl = + local *CPANPLUS::Dist::MM::write_makefile_pl = __PACKAGE__->_custom_makefile_pl_sub( "exit 1;" ); ### there's no makefile.pl now, since the previous test failed @@ -360,8 +360,8 @@ SKIP: { { my $unlink_sts = unlink($makefile_pl); 1 while unlink $makefile_pl; ok( $unlink_sts, "Deleting Makefile.PL"); - } - + } + $dist->status->mk_flush; } @@ -370,21 +370,21 @@ SKIP: { my $env = ENV_CPANPLUS_IS_EXECUTING; my $sub = __PACKAGE__->_custom_makefile_pl_sub( "print qq[ENV=\$ENV{$env}\n]; exit 1;" ); - + my $clone = $Mod->clone; $clone->status->fetch( $Mod->status->fetch ); - + ok( $clone, 'Testing ENV settings $dist->prepare' ); ok( $clone->extract, ' Files extracted' ); ok( $clone->prepare, ' $mod->prepare worked first time' ); - + my $dist = $clone->status->dist; my $makefile_pl = MAKEFILE_PL->( $clone->status->extract ); ok( $sub->($dist), " Custom Makefile.PL written" ); ok( -e $makefile_pl, " File exists" ); - ### clear errors + ### clear errors CPANPLUS::Error->flush; my $rv = $dist->prepare( force => 1, verbose => 0 ); @@ -401,20 +401,20 @@ SKIP: { ### and the ENV var should no longer be set now ok( !$ENV{$env}, " ENV var now unset" ); -} +} sub _custom_makefile_pl_sub { my $pkg = shift; my $txt = shift or return; - + return sub { - my $dist = shift; + my $dist = shift; my $self = $dist->parent; my $fh = OPEN_FILE->( MAKEFILE_PL->($self->status->extract), '>' ); print $fh $txt; close $fh; - + return 1; } } diff --git a/gnu/usr.bin/perl/cpan/CPANPLUS/t/21_CPANPLUS-Dist-No-Build.t b/gnu/usr.bin/perl/cpan/CPANPLUS/t/21_CPANPLUS-Dist-No-Build.t index 10a2745d80d..55007ba5666 100755 --- a/gnu/usr.bin/perl/cpan/CPANPLUS/t/21_CPANPLUS-Dist-No-Build.t +++ b/gnu/usr.bin/perl/cpan/CPANPLUS/t/21_CPANPLUS-Dist-No-Build.t @@ -1,6 +1,6 @@ ### make sure we can find our conf.pl file -BEGIN { - use FindBin; +BEGIN { + use FindBin; require "$FindBin::Bin/inc/conf.pl"; } @@ -27,27 +27,27 @@ my $Inst = INSTALLER_BUILD; my $Mod = $CB->module_tree( 'Foo::Bar::MB::NOXS' ); -ok( $Mod, "Module object retrieved" ); +ok( $Mod, "Module object retrieved" ); ok( not grep { $_ eq $Inst } CPANPLUS::Dist->dist_types, " $Inst installer not returned" ); - -### fetch the file first + +### fetch the file first { my $where = $Mod->fetch; ok( -e $where, " Tarball '$where' exists" ); } - -### extract it, silence warnings/messages + +### extract it, silence warnings/messages { my $where = $Mod->extract; ok( -e $where, " Tarball extracted to '$where'" ); } -### check the installer type -{ is( $Mod->status->installer_type, $Inst, +### check the installer type +{ is( $Mod->status->installer_type, $Inst, "Proper installer type found: $Inst" ); my $href = $Mod->status->configure_requires; ok( scalar(keys(%$href)), " Dependencies recorded" ); - + ok( defined $href->{$Inst}, " Dependency on $Inst" ); cmp_ok( $href->{$Inst}, '>', 0, " Minimum version: $href->{$Inst}" ); @@ -55,7 +55,7 @@ ok( not grep { $_ eq $Inst } CPANPLUS::Dist->dist_types, my $err = CPANPLUS::Error->stack_as_string; like( $err, qr/$Inst/, " Message mentions $Inst" ); like( $err, qr/prerequisites list/, - " Message mentions adding prerequisites" ); + " Message mentions adding prerequisites" ); } ### now run the test, it should trigger the installation of the installer @@ -65,30 +65,30 @@ ok( not grep { $_ eq $Inst } CPANPLUS::Dist->dist_types, ### bootstrapping creates a call to $cb->module_tree('c::d::build')->install ### we need to intercept that call my $org_mt = CPANPLUS::Backend->can('module_tree'); - local *CPANPLUS::Backend::module_tree = sub { + local *CPANPLUS::Backend::module_tree = sub { my $self = shift; my $mod = shift; - + ### return a dummy object if this is the bootstrap call return CPANPLUS::Test::Module->new if $mod eq $Inst; - + ### otherwise do a regular call return $org_mt->( $self, $mod, @_ ); }; - + ### bootstrap install call will abort the ->create() call, so catch ### that here eval { $Mod->create( skiptest => 1) }; - + ok( $@, "Create call aborted at bootstrap phase" ); like( $@, qr/$Inst/, " Diagnostics confirmed" ); - + my $diag = CPANPLUS::Error->stack_as_string; like( $diag, qr/This module requires.*$Inst/, " Dependency on $Inst recorded" ); like( $diag, qr/Bootstrapping installer.*$Inst/, " Bootstrap notice recorded" ); - like( $diag, qr/Installer '$Inst' successfully bootstrapped/, + like( $diag, qr/Installer '$Inst' succesfully bootstrapped/, " Successful bootstrap recorded" ); } @@ -97,18 +97,18 @@ END { 1 while unlink output_file() } ### place holder package to serve as a module object for C::D::Build { package CPANPLUS::Test::Module; sub new { return bless {} } - sub install { + sub install { ### at load time we ignored C::D::Build. Reset the ignore here ### so a 'rescan' after the 'install' picks up C::D::Build CPANPLUS::Dist->_reset_dist_ignore; - return 1; + return 1; } } ### test package for cpanplus::dist::build { package CPANPLUS::Dist::Build; use base 'CPANPLUS::Dist::Base'; - + ### shortcut out of the installation procedure sub new { die __PACKAGE__ }; sub format_available { 1 } diff --git a/gnu/usr.bin/perl/cpan/CPANPLUS/t/25_CPANPLUS.t b/gnu/usr.bin/perl/cpan/CPANPLUS/t/25_CPANPLUS.t index b6723d35c64..9cbd15c7e3f 100755 --- a/gnu/usr.bin/perl/cpan/CPANPLUS/t/25_CPANPLUS.t +++ b/gnu/usr.bin/perl/cpan/CPANPLUS/t/25_CPANPLUS.t @@ -1,6 +1,6 @@ ### make sure we can find our conf.pl file -BEGIN { - use FindBin; +BEGIN { + use FindBin; require "$FindBin::Bin/inc/conf.pl"; } @@ -24,16 +24,16 @@ use_ok( $Class ); for my $meth ( qw[fetch get install] ) { my $sub = $Class->can( $meth ); ok( $sub, "$Class->can( $meth )" ); - + my %map = ( 0 => qr/failed/, 1 => qr/successful/, ); - + ok( 1, "Trying '$meth' in different configurations" ); - + while( my($rv, $re) = each %map ) { - + ### don't actually install, just test logic no warnings 'redefine'; local *CPANPLUS::Module::install = sub { $rv }; @@ -45,7 +45,7 @@ for my $meth ( qw[fetch get install] ) { is( $ok, $rv, " Expected RV: $rv" ); like( CPANPLUS::Error->stack_as_string, $re, " With expected diagnostic" ); - } + } ### does not take objects / references { CPANPLUS::Error->flush; @@ -74,15 +74,15 @@ for my $meth ( qw[fetch get install] ) { { ### test package for shell() method package CPANPLUS::Shell::Test; - + ### ->shell() looks in %INC use Module::Loaded qw[mark_as_loaded]; mark_as_loaded( __PACKAGE__ ); - sub new { bless {}, __PACKAGE__ }; + sub new { bless {}, __PACKAGE__ }; sub shell { $$ }; } - + my $rv = $sub->( 'Test' ); ok( $rv, " Shell started" ); is( $rv, $$, " Proper shell called" ); diff --git a/gnu/usr.bin/perl/cpan/CPANPLUS/t/30_CPANPLUS-Internals-Selfupdate.t b/gnu/usr.bin/perl/cpan/CPANPLUS/t/30_CPANPLUS-Internals-Selfupdate.t index 6347daa21cd..a816faa1766 100755 --- a/gnu/usr.bin/perl/cpan/CPANPLUS/t/30_CPANPLUS-Internals-Selfupdate.t +++ b/gnu/usr.bin/perl/cpan/CPANPLUS/t/30_CPANPLUS-Internals-Selfupdate.t @@ -1,6 +1,6 @@ ### make sure we can find our conf.pl file -BEGIN { - use FindBin; +BEGIN { + use FindBin; require "$FindBin::Bin/inc/conf.pl"; } @@ -35,7 +35,7 @@ my $Prereq = { $Dep => 0 }; } -### check specifically if our bundled shells dont trigger a +### check specifically if our bundled shells dont trigger a ### dependency (see #26077). ### do this _before_ changing the built in conf! { my $meth = 'modules_for_feature'; @@ -44,15 +44,15 @@ my $Prereq = { $Dep => 0 }; my $cur = $cobj->get_conf( $type ); for my $shell ( SHELL_DEFAULT, SHELL_CLASSIC ) { - ok( $cobj->set_conf( $type => $shell ), + ok( $cobj->set_conf( $type => $shell ), "Testing dependencies for '$shell'" ); my $rv = $CB->$Acc->$meth( $type => 1); ok( !$rv, " No dependencies for '$shell' -- bundled" ); - } - + } + for my $shell ( 'CPANPLUS::Test::Shell' ) { - ok( $cobj->set_conf( $type => $shell ), + ok( $cobj->set_conf( $type => $shell ), "Testing dependencies for '$shell'" ); my $rv = $CB->$Acc->$meth( $type => 1 ); @@ -62,7 +62,7 @@ my $Prereq = { $Dep => 0 }; is_deeply( $rv, { $shell => '0.0' }, " With the proper entries" ); } -} +} ### test the feature list { ### start with defining our OWN type of config, as not all mentioned @@ -75,7 +75,7 @@ my $Prereq = { $Dep => 0 }; } is_deeply( $Conf, $Class->_get_config, - "Config updated successfully" ); + "Config updated succesfully" ); my @cat = $CB->$Acc->list_categories; ok( scalar(@cat), "Category list returned" ); @@ -87,18 +87,18 @@ my $Prereq = { $Dep => 0 }; for my $feat (@feat) { my $meth = 'modules_for_feature'; my @mods = $CB->$Acc->$meth( $feat ); - + ok( $feat, "Testing feature '$feat'" ); ok( scalar( @mods ), " Module list returned" ); - + my $acc = 'is_installed_version_sufficient'; for my $mod (@mods) { isa_ok( $mod, "CPANPLUS::Module" ); isa_ok( $mod, $ModClass ); can_ok( $mod, $acc ); ok( $mod->$acc, " Module uptodate" ); - } - + } + ### check if we can get a hashref { my $href = $CB->$Acc->$meth( $feat, 1 ); ok( $href, "Got result as hash" ); @@ -106,7 +106,7 @@ my $Prereq = { $Dep => 0 }; is_deeply( $href, $Prereq, " With the proper entries" ); - } + } } ### see if we can get a list of modules to be updated @@ -124,7 +124,7 @@ my $Prereq = { $Dep => 0 }; cmp_ok( scalar(keys(%list)), '==', 1, "Got modules for '$cat' from '$meth'" ); - + my $aref = $list{$cat}; ok( $aref, " Got module list" ); cmp_ok( scalar(@$aref), '==', 1, @@ -136,22 +136,22 @@ my $Prereq = { $Dep => 0 }; ### find enabled features { my $meth = 'list_enabled_features'; - can_ok( $Class, $meth ); - + can_ok( $Class, $meth ); + my @list = $CB->$Acc->$meth; ok( scalar(@list), "Retrieved enabled features" ); is_deeply( [$Feat], \@list, " Proper features found" ); } - + ### find dependencies/core modules for my $meth ( qw[list_core_dependencies list_core_modules] ) { - can_ok( $Class, $meth ); - + can_ok( $Class, $meth ); + my @list = $CB->$Acc->$meth; ok( scalar(@list), "Retrieved modules" ); is( scalar(@list), 1, " 1 Found" ); - isa_ok( $list[0], $ModClass ); + isa_ok( $list[0], $ModClass ); is( $list[0]->name, $Dep, " Correct module found" ); @@ -163,7 +163,7 @@ my $Prereq = { $Dep => 0 }; " With the proper entries" ); } } - + ### now selfupdate ourselves { ### XXX just test the mechanics, make sure install returns true @@ -171,11 +171,11 @@ my $Prereq = { $Dep => 0 }; ### declare in a block to quelch 'sub redefined' warnings. { local *CPANPLUS::Selfupdate::Module::install = sub { 1 }; } local *CPANPLUS::Selfupdate::Module::install = sub { 1 }; - + my $meth = 'selfupdate'; can_ok( $Class, $meth ); - ok( $CB->$Acc->$meth( update => 'all'), + ok( $CB->$Acc->$meth( update => 'all'), " Selfupdate successful" ); } -} +} diff --git a/gnu/usr.bin/perl/cpan/CPANPLUS/t/40_CPANPLUS-Internals-Report.t b/gnu/usr.bin/perl/cpan/CPANPLUS/t/40_CPANPLUS-Internals-Report.t index a8823351d1e..ecce8a5b7cb 100755 --- a/gnu/usr.bin/perl/cpan/CPANPLUS/t/40_CPANPLUS-Internals-Report.t +++ b/gnu/usr.bin/perl/cpan/CPANPLUS/t/40_CPANPLUS-Internals-Report.t @@ -1,6 +1,6 @@ ### make sure we can find our conf.pl file -BEGIN { - use FindBin; +BEGIN { + use FindBin; require "$FindBin::Bin/inc/conf.pl"; } @@ -25,7 +25,7 @@ my $CB = CPANPLUS::Backend->new( $conf ); my $ModName = TEST_CONF_MODULE; my $ModPrereq = TEST_CONF_PREREQ; -### pick a high number, but not ~0 as possibly ~0 is unsigned, and we cause +### pick a high number, but not ~0 as possibly ~0 is unsigned, and we cause ### an overflow, as happens to version.pm 0.7203 among others. ### ANOTHER bug in version.pm, this time for 64bit: ### https://rt.cpan.org/Ticket/Display.html?id=45241 @@ -53,7 +53,7 @@ my $map = { check => 0, skiptests => 1, # did we skip the tests? - }, + }, missing_prereq => { buffer => missing_prereq_buffer(), failed => 1, @@ -87,7 +87,7 @@ my $map = { '/NA/', ], check => 0, - }, + }, perl_version_too_low_build1 => { buffer => perl_version_too_low_buffer_build(1), failed => 1, @@ -96,7 +96,7 @@ my $map = { '/NA/', ], check => 0, - }, + }, perl_version_too_low_build2 => { buffer => perl_version_too_low_buffer_build(2), failed => 1, @@ -105,7 +105,7 @@ my $map = { '/NA/', ], check => 0, - }, + }, prereq_versions_too_low => { ### set the prereq version incredibly high pre_hook => sub { @@ -119,14 +119,14 @@ my $map = { '/http://testers.cpan.org/', '/NA/', ], - check => 0, + check => 0, }, prereq_not_on_cpan => { pre_hook => sub { my $mod = shift; my $clone = $mod->clone; - $clone->status->prereqs( - { TEST_CONF_INVALID_MODULE, 0 } + $clone->status->prereqs( + { TEST_CONF_INVALID_MODULE, 0 } ); return $clone; }, @@ -135,14 +135,14 @@ my $map = { '/http://testers.cpan.org/', '/NA/', ], - check => 0, + check => 0, }, prereq_not_on_cpan_but_core => { pre_hook => sub { my $mod = shift; my $clone = $mod->clone; - $clone->status->prereqs( - { TEST_CONF_PREREQ, 0 } + $clone->status->prereqs( + { TEST_CONF_PREREQ, 0 } ); return $clone; }, @@ -151,11 +151,11 @@ my $map = { '/http://testers.cpan.org/', '/UNKNOWN/', ], - check => 0, + check => 0, }, }; -### test config settings +### test config settings { for my $opt ( qw[cpantest cpantest_mx] ) { my $warnings; local $SIG{__WARN__} = sub { $warnings .= "@_" }; @@ -167,7 +167,7 @@ my $map = { " Retrieved properly" ); ok( $conf->set_conf( $opt => $org ), " Option $opt set back to original" ); - ok( !$warnings, " No warnings" ); + ok( !$warnings, " No warnings" ); } } @@ -180,7 +180,7 @@ my $map = { ### test non-relevant tests ### my $cp = $Mod->clone; - $cp->module( ($^O eq 'beos' ? 'MSDOS' : 'Be') . '::' . $cp->module ); + $cp->module( $Mod->module . '::' . ($^O eq 'beos' ? 'MSDOS' : 'Be') ); ok(!RELEVANT_TEST_RESULT->($cp),"Test is irrelevant"); } @@ -219,15 +219,15 @@ my $map = { "Proper test fail stage found" ); } - ### test missing prereqs + ### test missing prereqs { my $str = q[Can't locate Foo/Bar.pm in @INC]; - + ### standard test { my @list = MISSING_PREREQS_LIST->( $str ); is( scalar(@list), 1, " List of missing prereqs found" ); is( $list[0], 'Foo::Bar', " Proper prereq found" ); } - + ### multiple mentions of same prereq { my @list = MISSING_PREREQS_LIST->( $str . $str ); @@ -256,14 +256,14 @@ my $map = { { my $prereqs = REPORT_MISSING_PREREQS->('foo','bar@example.com','Foo::Bar'); ok( $prereqs, "Test output generated" ); - like( $prereqs, qr/'foo \(bar\@example\.com\)'/, + like( $prereqs, qr/'foo \(bar\@example\.com\)'/, " Proper content found" ); like( $prereqs, qr/Foo::Bar/, " Proper content found" ); like( $prereqs, qr/prerequisi/, " Proper content found" ); like( $prereqs, qr/PREREQ_PM/, " Proper content found" ); } - { my $prereqs = REPORT_MISSING_PREREQS->(undef,undef,'Foo::Bar'); + { my $prereqs = REPORT_MISSING_PREREQS->(undef,undef,'Foo::Bar'); ok( $prereqs, "Test output generated" ); like( $prereqs, qr/Your Name/, " Proper content found" ); like( $prereqs, qr/Foo::Bar/, " Proper content found" ); @@ -291,15 +291,15 @@ my $map = { my @list = qw(foo bar); is_deeply( \@libs, \@list, " Proper content found" ); } - + { my $clone = $Mod->clone; my $prereqs = { $ModPrereq => $HighVersion }; - + $clone->status->prereqs( $prereqs ); my $str = REPORT_LOADED_PREREQS->( $clone ); - + like($str, qr/PREREQUISITES:/, "Listed loaded prerequisites" ); like($str, qr/\! $ModPrereq\s+\S+\s+\S+/, " Proper content found" ); @@ -308,7 +308,7 @@ my $map = { { my $clone = $Mod->clone; my $str = REPORT_TOOLCHAIN_VERSIONS->( $clone ); - + like($str, qr/toolchain/, "Correct message in report" ); use Cwd; like($str, qr/Cwd\s+\Q$Cwd::VERSION\E/, @@ -317,10 +317,10 @@ my $map = { } ### callback tests -{ ### as reported in bug 13086, this callback returned the wrong item +{ ### as reported in bug 13086, this callback returned the wrong item ### from the list: - ### $self->_callbacks->munge_test_report->($Mod, $message, $grade); - my $rv = $CB->_callbacks->munge_test_report->( 1..4 ); + ### $self->_callbacks->munge_test_report->($Mod, $message, $grade); + my $rv = $CB->_callbacks->munge_test_report->( 1..4 ); is( $rv, 2, "Default 'munge_test_report' callback OK" ); } @@ -334,14 +334,14 @@ SKIP: { unless $CB->_have_query_report_modules(verbose => 0); - SKIP: { + SKIP: { my $mod = $CB->module_tree( TEST_CONF_PREREQ ); # is released to CPAN ok( $mod, "Module retrieved" ); - + ### so we're not pinned down to this specific version of perl my @list = $mod->fetch_report( all_versions => 1 ); skip "Possibly no net connection, or server down", 7 unless @list; - + my $href = $list[0]; ok( scalar(@list), "Fetched test report" ); is( ref $href, ref {}, " Return value has hashrefs" ); @@ -389,7 +389,7 @@ SKIP: { : $Mod; my $file = do { - ### so T::R does not try to resolve our maildomain, which can + ### so T::R does not try to resolve our maildomain, which can ### lead to large timeouts for *every* invocation in T::R < 1.51_01 ### see: http://code.google.com/p/test-reporter/issues/detail?id=15 local $ENV{MAILDOMAIN} ||= 'example.com'; @@ -477,7 +477,7 @@ BEGIN failed--compilation aborted at Makefile.PL line 1. BEGIN failed--compilation aborted at Makefile.PL line 1. -- cannot continue ]; -} +} sub perl_version_too_low_buffer_build { my $type = shift; @@ -493,7 +493,7 @@ ERROR: version: Prerequisite version isn't installed ERRORS/WARNINGS FOUND IN PREREQUISITES. You may wish to install the versions of the modules indicated above before proceeding with this installation. ] if($type == 2); -} +} # Local variables: # c-indentation-style: bsd diff --git a/gnu/usr.bin/perl/cpan/CPANPLUS/t/inc/conf.pl b/gnu/usr.bin/perl/cpan/CPANPLUS/t/inc/conf.pl index 4cce0efcb43..ca6473157cd 100644 --- a/gnu/usr.bin/perl/cpan/CPANPLUS/t/inc/conf.pl +++ b/gnu/usr.bin/perl/cpan/CPANPLUS/t/inc/conf.pl @@ -2,9 +2,9 @@ ### So reset it here explicitly my ($old_env_path, $old_env_perl5lib); BEGIN { - use FindBin; + use FindBin; use File::Spec; - + ### paths to our own 'lib' and 'inc' dirs ### include them, relative from t/ my @paths = map { "$FindBin::Bin/$_" } qw[../lib inc]; @@ -12,21 +12,21 @@ BEGIN { ### absolute'ify the paths in @INC; my @rel2abs = map { File::Spec->rel2abs( $_ ) } grep { not File::Spec->file_name_is_absolute( $_ ) } @INC; - + ### use require to make devel::cover happy require lib; - for ( @paths, @rel2abs ) { - my $l = 'lib'; - $l->import( $_ ) + for ( @paths, @rel2abs ) { + my $l = 'lib'; + $l->import( $_ ) } use Config; ### and add them to the environment, so shellouts get them $old_env_perl5lib = $ENV{'PERL5LIB'}; - $ENV{'PERL5LIB'} = join $Config{'path_sep'}, + $ENV{'PERL5LIB'} = join $Config{'path_sep'}, grep { defined } $ENV{'PERL5LIB'}, @paths, @rel2abs; - + ### add our own path to the front of $ENV{PATH}, so that cpanp-run-perl ### and friends get picked up $old_env_path = $ENV{PATH}; @@ -42,10 +42,10 @@ BEGIN { ### Fix up the path to perl, as we're about to chdir ### but only under perlcore, or if the path contains delimiters, ### meaning it's relative, but not looked up in your $PATH - $^X = File::Spec->rel2abs( $^X ) + $^X = File::Spec->rel2abs( $^X ) if $ENV{PERL_CORE} or ( $^X =~ m|[/\\]| ); - ### chdir to our own test dir, so we know all files are relative + ### chdir to our own test dir, so we know all files are relative ### to this point, no matter whether run from perlcore tests or ### regular CPAN installs chdir "$FindBin::Bin" if -d "$FindBin::Bin" @@ -53,7 +53,7 @@ BEGIN { BEGIN { use IPC::Cmd; - + ### Win32 has issues with redirecting FD's properly in IPC::Run: ### Can't redirect fd #4 on Win32 at IPC/Run.pm line 2801 $IPC::Cmd::USE_IPC_RUN = 0 if $^O eq 'MSWin32'; @@ -94,7 +94,7 @@ use File::Basename qw[basename]; my $Env = 'PERL5_CPANPLUS_TEST_VERBOSE'; # prereq has to be in our package file && core! -use constant TEST_CONF_PREREQ => 'Cwd'; +use constant TEST_CONF_PREREQ => 'Cwd'; use constant TEST_CONF_MODULE => 'Foo::Bar::EU::NOXS'; use constant TEST_CONF_MODULE_SUB => 'Foo::Bar::EU::NOXS::Sub'; use constant TEST_CONF_AUTHOR => 'EUNOXS'; @@ -104,7 +104,7 @@ use constant TEST_CONF_MIRROR_DIR => 'dummy-localmirror'; use constant TEST_CONF_CPAN_DIR => 'dummy-CPAN'; use constant TEST_CONF_CPANPLUS_DIR => 'dummy-cpanplus'; use constant TEST_CONF_INSTALL_DIR => File::Spec->rel2abs( - File::Spec->catdir( + File::Spec->catdir( TEST_CONF_CPANPLUS_DIR, 'install' ) @@ -118,41 +118,36 @@ sub dummy_cpan_dir { ### Convert to an absolute file specification my $abs_test_dir = File::Spec->rel2abs($test_dir); - - ### According to John M: the hosts path needs to be in UNIX format. + + ### According to John M: the hosts path needs to be in UNIX format. ### File::Spec::Unix->rel2abs does not work at all on VMS $abs_test_dir = VMS::Filespec::unixify( $abs_test_dir ) if $^O eq 'VMS'; return $abs_test_dir; } -sub gimme_conf { +sub gimme_conf { ### don't load any other configs than the heuristic one ### during tests. They might hold broken/incorrect data ### for our test suite. Bug [perl #43629] showed this. - local $ENV{PERL5_CPANPLUS_HOME} = ''; - my $conf = CPANPLUS::Configure->new( load_configs => 0 ); my $dummy_cpan = dummy_cpan_dir(); - - $conf->set_conf( hosts => [ { + + $conf->set_conf( hosts => [ { path => $dummy_cpan, scheme => 'file', - } ], + } ], ); $conf->set_conf( base => File::Spec->rel2abs(TEST_CONF_CPANPLUS_DIR)); $conf->set_conf( dist_type => '' ); $conf->set_conf( signature => 0 ); - $conf->set_conf( allow_unknown_prereqs => 1 ); # just to make sure, eh $conf->set_conf( verbose => 1 ) if $ENV{ $Env }; - + ### never use a pager in the test suite $conf->set_program( pager => '' ); - $conf->set_conf( enable_custom_sources => 0 ); - ### dmq tells us that we should run with /nologo ### if using nmake, as it's very noisy otherwise. { my $make = $conf->get_program('make'); @@ -170,7 +165,7 @@ sub gimme_conf { ### cpanp-run-perl installed the same amount of 'uplevels' ### as the /tmp/foo prefix, we'll pull in the wrong script ### by accident. - ### Since we set the path to cpanp-run-perl explicitly + ### Since we set the path to cpanp-run-perl explicitily ### at the top of this script, it's best to update the config ### ourselves with a path lookup, rather than rely on its ### heuristics. Thanks to David Wheeler, Josh Jore and Vincent @@ -181,16 +176,16 @@ sub gimme_conf { $conf->set_conf( source_engine => $ENV{CPANPLUS_SOURCE_ENGINE} ) if $ENV{CPANPLUS_SOURCE_ENGINE}; - + _clean_test_dir( [ - $conf->get_conf('base'), + $conf->get_conf('base'), TEST_CONF_MIRROR_DIR, # TEST_INSTALL_DIR_LIB, # TEST_INSTALL_DIR_BIN, -# TEST_INSTALL_DIR_MAN1, +# TEST_INSTALL_DIR_MAN1, # TEST_INSTALL_DIR_MAN3, ], ( $ENV{PERL_CORE} ? 0 : 1 ) ); - + return $conf; }; @@ -199,47 +194,47 @@ sub gimme_conf { my $file = ".".basename($0).".output"; sub output_handle { return $fh if $fh; - + $fh = FileHandle->new(">$file") or warn "Could not open output file '$file': $!"; - + $fh->autoflush(1); return $fh; } - + sub output_file { return $file } - - - + + + ### redirect output from msg() and error() output to file unless( $ENV{$Env} ) { - + print "# To run tests in verbose mode, set ". "\$ENV{$Env} = 1\n" unless $ENV{PERL_CORE}; - + 1 while unlink $file; # just in case - + $CPANPLUS::Error::ERROR_FH = $CPANPLUS::Error::ERROR_FH = output_handle(); - + $CPANPLUS::Error::MSG_FH = $CPANPLUS::Error::MSG_FH = output_handle(); - - } + + } } ### clean these files if we're under perl core -END { +END { if ( $ENV{PERL_CORE} ) { close output_handle(); 1 while unlink output_file(); _clean_test_dir( [ - gimme_conf->get_conf('base'), + gimme_conf->get_conf('base'), TEST_CONF_MIRROR_DIR, # TEST_INSTALL_DIR_LIB, # TEST_INSTALL_DIR_BIN, - # TEST_INSTALL_DIR_MAN1, + # TEST_INSTALL_DIR_MAN1, # TEST_INSTALL_DIR_MAN3, ], 0 ); # DO NOT be verbose under perl core -- makes tests fail } @@ -258,47 +253,47 @@ sub _clean_test_dir { my $dh; opendir $dh, $dir or die "Could not open basedir '$dir': $!"; - while( my $file = readdir $dh ) { + while( my $file = readdir $dh ) { next if $file =~ /^\./; # skip dot files - + my $path = File::Spec->catfile( $dir, $file ); - + ### directory, rmtree it if( -d $path ) { ### John Malmberg reports yet another VMS issue: - ### A directory name on VMS in VMS format ends with .dir + ### A directory name on VMS in VMS format ends with .dir ### when it is referenced as a file. ### In UNIX format traditionally PERL on VMS does not remove the ### '.dir', however the VMS C library conversion routines do - ### remove the '.dir' and the VMS C library routines can not + ### remove the '.dir' and the VMS C library routines can not ### handle the '.dir' being present on UNIX format filenames. - ### So code doing the fixup has on VMS has to be able to handle - ### both UNIX format names and VMS format names. - + ### So code doing the fixup has on VMS has to be able to handle + ### both UNIX format names and VMS format names. + ### XXX See http://www.xray.mpe.mpg.de/ ### mailing-lists/perl5-porters/2007-10/msg00064.html ### for details -- the below regex could use some touchups - ### according to John. M. + ### according to John. M. $file =~ s/\.dir$//i if $^O eq 'VMS'; - + my $dirpath = File::Spec->catdir( $dir, $file ); print "# Deleting directory '$dirpath'\n" if $verbose; eval { rmtree( $dirpath ) }; - warn "Could not delete '$dirpath' while cleaning up '$dir'" + warn "Could not delete '$dirpath' while cleaning up '$dir'" if $@; - + ### regular file } else { print "# Deleting file '$path'\n" if $verbose; 1 while unlink $path; - } - } - + } + } + close $dh; } - + return 1; } 1; |