more ebcdic testsuite fixups (from Peter Prymmer)
[p5sagit/p5-mst-13.2.git] / t / lib / dumper.t
index 9130d1c..0ac2696 100755 (executable)
@@ -9,6 +9,8 @@ BEGIN {
 }
 
 use Data::Dumper;
+use Config;
+my $Is_ebcdic = defined($Config{'ebcdic'}) && $Config{'ebcdic'} eq 'define';
 
 $Data::Dumper::Pad = "#";
 my $TMAX;
@@ -22,6 +24,14 @@ sub TEST {
   ++$TNUM;
   $t =~ s/([A-Z]+)\(0x[0-9a-f]+\)/$1(0xdeadbeef)/g
       if ($WANT =~ /deadbeef/);
+  if ($Is_ebcdic) {
+      # these data need massaging with non ascii character sets
+      # because of hashing order differences
+      $WANT = join("\n",sort(split(/\n/,$WANT)));
+      $WANT =~ s/\,$//mg;
+      $t    = join("\n",sort(split(/\n/,$t)));
+      $t    =~ s/\,$//mg;
+  }
   print( ($t eq $WANT and not $@) ? "ok $TNUM\n"
        : "not ok $TNUM\n--Expected--\n$WANT\n--Got--\n$@$t\n");
 
@@ -33,6 +43,13 @@ sub TEST {
   ++$TNUM;
   $t =~ s/([A-Z]+)\(0x[0-9a-f]+\)/$1(0xdeadbeef)/g
       if ($WANT =~ /deadbeef/);
+  if ($Is_ebcdic) {
+      # here too there are hashing order differences
+      $WANT = join("\n",sort(split(/\n/,$WANT)));
+      $WANT =~ s/\,$//mg;
+      $t    = join("\n",sort(split(/\n/,$t)));
+      $t    =~ s/\,$//mg;
+  }
   print( ($t eq $WANT and not $@) ? "ok $TNUM\n"
        : "not ok $TNUM\n--Expected--\n$WANT\n--Got--\n$@$t\n");
 }