Author: kane
Date: Tue May 22 06:34:50 2007
New Revision: 9582

Modified:
   CPANPLUS-Dist-Build/trunk/   (props changed)
   CPANPLUS-Dist-Build/trunk/Makefile.PL
   CPANPLUS-Dist-Build/trunk/t/01_CPANPLUS-Dist-Build-Constants.t
   CPANPLUS-Dist-Build/trunk/t/02_CPANPLUS-Dist-Build.t
   CPANPLUS-Dist-Build/trunk/t/inc/conf.pl

Log:
 [EMAIL PROTECTED]:  kane | 2007-05-22 13:40:30 +0200
 * more test compliancy with perl core


Modified: CPANPLUS-Dist-Build/trunk/Makefile.PL
==============================================================================
--- CPANPLUS-Dist-Build/trunk/Makefile.PL       (original)
+++ CPANPLUS-Dist-Build/trunk/Makefile.PL       Tue May 22 06:34:50 2007
@@ -5,7 +5,7 @@
     NAME            => 'CPANPLUS::Dist::Build',
     VERSION_FROM    => 'lib/CPANPLUS/Dist/Build.pm', # finds $VERSION
     dist            => { COMPRESS => 'gzip -9f', SUFFIX => 'gz' },
-    clean           => { FILES => 't/dummy-cpanplus' },
+    clean           => { FILES => 't/dummy-cpanplus t/dummy-perl/lib/perl5' },
     PREREQ_PM       => { 
                         'Test::More'                => 0, 
                         'CPANPLUS'                  => '0.80',
@@ -20,3 +20,5 @@
     AUTHOR          => 'Jos Boumans <kane[at]cpan.org>, Ken Williams <[EMAIL 
PROTECTED]>',
     ABSTRACT        => 'CPANPLUS plugin to install packages that use Build.PL',
 );     
+
+

Modified: CPANPLUS-Dist-Build/trunk/t/01_CPANPLUS-Dist-Build-Constants.t
==============================================================================
--- CPANPLUS-Dist-Build/trunk/t/01_CPANPLUS-Dist-Build-Constants.t      
(original)
+++ CPANPLUS-Dist-Build/trunk/t/01_CPANPLUS-Dist-Build-Constants.t      Tue May 
22 06:34:50 2007
@@ -1,3 +1,11 @@
+### make sure we can find our conf.pl file
+BEGIN { 
+    use FindBin; 
+    require "$FindBin::Bin/inc/conf.pl";
+}
+
+
+
 BEGIN { chdir 't' if -d 't' };
 
 ### this is to make devel::cover happy ###

Modified: CPANPLUS-Dist-Build/trunk/t/02_CPANPLUS-Dist-Build.t
==============================================================================
--- CPANPLUS-Dist-Build/trunk/t/02_CPANPLUS-Dist-Build.t        (original)
+++ CPANPLUS-Dist-Build/trunk/t/02_CPANPLUS-Dist-Build.t        Tue May 22 
06:34:50 2007
@@ -194,7 +194,12 @@
     ### since we're die'ing in the Build.PL, do a local *STDERR,
     ### so we dont spam the result through the test -- this is expected
     ### behaviour after all.
-    my $rv = do { local *STDERR; $clone->prepare( force => 1 ) };
+    ### also quell the warning for print() on unopened fh...
+    my $rv = do { 
+                local $^W;
+                local *STDERR; 
+                $clone->prepare( force => 1 ) 
+            };
     ok( !$rv,                   '   $mod->prepare failed' );
 
     my $re = quotemeta( $build_pl );
@@ -209,7 +214,8 @@
 sub find_module {
   my $module = shift;
 
-  # Don't add the .pm yet, in case it's a packlist or something like 
ExtUtils::xsubpp.
+  ### Don't add the .pm yet, in case it's a packlist or something 
+  ### like ExtUtils::xsubpp.
   my $file = File::Spec->catfile( split m/::/, $module );
   my $candidate;
   foreach (@INC) {

Modified: CPANPLUS-Dist-Build/trunk/t/inc/conf.pl
==============================================================================
--- CPANPLUS-Dist-Build/trunk/t/inc/conf.pl     (original)
+++ CPANPLUS-Dist-Build/trunk/t/inc/conf.pl     Tue May 22 06:34:50 2007
@@ -62,6 +62,52 @@
     $Locale::Maketext::Lexicon::VERSION = 0;
 }
 
+### clean up files for PERLCORE mostly -- make clean isn't invoked
+### there... otoh, we should clean up after ourselves anyway.
+END {
+    ### 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";
+
+    ### XXX hardcoded
+    _clean_test_dir( [qw|dummy-perl dummy-cpanplus| ] );
+}
+
+### whenever we start a new script, we want to clean out our
+### old files from the test '.cpanplus' dir..
+sub _clean_test_dir {
+    my $dirs    = shift || [];
+    my $verbose = shift || 0;
+
+    for my $dir ( @$dirs ) {
+
+        my $dh;
+        opendir $dh, $dir or die "Could not open basedir '$dir': $!";
+        while( my $file = readdir $dh ) { 
+            next if $file =~ /^\./;  # skip dot files
+            
+            my $path = File::Spec->catfile( $dir, $file );
+            
+            ### directory, rmtree it
+            if( -d $path ) {
+                print "Deleting directory '$path'\n" if $verbose;
+                eval { rmtree( $path ) };
+                warn "Could not delete '$path' while cleaning up '$dir'" if $@;
+           
+            ### regular file
+            } else {
+                print "Deleting file '$path'\n" if $verbose;
+                1 while unlink $path;
+            }            
+        }       
+    
+        close $dh;
+    }
+    
+    return 1;
+}
+
 1;
 
 __END__

Reply via email to