This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Update Digest-MD5 to CPAN version 2.40
[perl5.git] / cpan / Digest-MD5 / t / files.t
index 9da8895..64ad801 100644 (file)
@@ -1,3 +1,10 @@
+BEGIN {
+       if ($ENV{PERL_CORE}) {
+               chdir 't' if -d 't';
+               @INC = '../lib';
+        }
+}
+
 print "1..3\n";
 
 use strict;
@@ -8,26 +15,19 @@ use Digest::MD5 qw(md5 md5_hex md5_base64);
 # (You'll need to have Perl 5.7.3 or later, to have the Encode installed.)
 # (And remember that under the Perl core distribution you should
 #  also have the $ENV{PERL_CORE} set to a true value.)
-# Similarly, to update MacOS section, run with $ENV{MAC_MD5SUM} set.
 
 my $EXPECT;
 if (ord "A" == 193) { # EBCDIC
     $EXPECT = <<EOT;
 11e8028ee426273db6b6db270a8bb38c  README
-6e556382813f67120863f4f91b7fcdc2  MD5.xs
+c13b305ff761095dea11ea1e74e5c7ec  MD5.xs
 276da0aa4e9a08b7fe09430c9c5690aa  rfc1321.txt
 EOT
-} elsif ("\n" eq "\015") { # MacOS
-    $EXPECT = <<EOT;
-c95549c6c5e1e1c078b27042f1dc850f  README
-7aa380c810bc7c1a0bec22cf32bc50d4  MD5.xs
-754b9db19f79dbc4992f7166eb0f37ce  rfc1321.txt
-EOT
 } else {
     # This is the output of: 'md5sum README MD5.xs rfc1321.txt'
     $EXPECT = <<EOT;
 c95549c6c5e1e1c078b27042f1dc850f  README
-7aa380c810bc7c1a0bec22cf32bc50d4  MD5.xs
+4ae6c261478df35a192cc1bdffd5211f  MD5.xs
 754b9db19f79dbc4992f7166eb0f37ce  rfc1321.txt
 EOT
 }
@@ -54,6 +54,13 @@ for (split /^/, $EXPECT) {
             print "ok ", ++$testno, " # Skip: PERL_CORE\n";
             next;
         }
+         use File::Spec;
+        my @path = qw(ext Digest-MD5);
+        my $path = File::Spec->updir;
+        while (@path) {
+          $path = File::Spec->catdir($path, shift @path);
+        }
+        $file = File::Spec->catfile($path, $file);
      }
 #     print "# file = $file\n";
      unless (-f $file) {
@@ -67,13 +74,6 @@ for (split /^/, $EXPECT) {
         print md5_hex($data), "  $base\n";
         next;
      }
-     if ($ENV{MAC_MD5SUM}) {
-         require Encode;
-        my $data = cat_file($file);    
-        Encode::from_to($data, 'latin1', 'MacRoman');
-        print md5_hex($data), "  $base\n";
-        next;
-     }
      my $md5bin = pack("H*", $md5hex);
      my $md5b64;
      if ($B64) {