Description: make sure tests succeed with key randomization in perl5.18
Origin: https://build.opensuse.org/package/view_file/Publishing:TeXLive/texlive/biber-dev.patch?expand=1
Author: Werner Fink
Last-Update: 2013-08-30
---
 lib/Biber/LaTeX/Recode.pm |   22 +++++++++++-----------
 t/full.t                  |   12 ++++++++++--
 t/remote-files.t          |   14 ++++++++------
 t/tool-bltxml.t           |   24 ++++++++++++------------
 4 files changed, 41 insertions(+), 31 deletions(-)

--- biber-norb.git.orig/lib/Biber/LaTeX/Recode.pm
+++ biber-norb.git/lib/Biber/LaTeX/Recode.pm
@@ -130,21 +130,21 @@
 
       # Now populate the regexps
       if ($type eq 'accents') {
-        $remaps->{$set}{$type}{re} = '[' . join('', keys %{$remaps->{$set}{$type}{map}}) . ']';
+        $remaps->{$set}{$type}{re} = '[' . join('', sort keys %{$remaps->{$set}{$type}{map}}) . ']';
         $remaps->{$set}{$type}{re} = qr/$remaps->{$set}{$type}{re}/;
-        $r_remaps->{$set}{$type}{re} = '[' . join('', keys %{$r_remaps->{$set}{$type}{map}}) . ']';
+        $r_remaps->{$set}{$type}{re} = '[' . join('', sort keys %{$r_remaps->{$set}{$type}{map}}) . ']';
         $r_remaps->{$set}{$type}{re} = qr/$r_remaps->{$set}{$type}{re}/;
       }
       elsif ($type eq 'superscripts') {
-        $remaps->{$set}{$type}{re} = join('|', map { /[\+\-\)\(]/ ? '\\' . $_ : $_ } keys %{$remaps->{$set}{$type}{map}});
+        $remaps->{$set}{$type}{re} = join('|', map { /[\+\-\)\(]/ ? '\\' . $_ : $_ } sort keys %{$remaps->{$set}{$type}{map}});
         $remaps->{$set}{$type}{re} = qr|$remaps->{$set}{$type}{re}|;
-        $r_remaps->{$set}{$type}{re} = join('|', map { /[\+\-\)\(]/ ? '\\' . $_ : $_ } keys %{$r_remaps->{$set}{$type}{map}});
+        $r_remaps->{$set}{$type}{re} = join('|', map { /[\+\-\)\(]/ ? '\\' . $_ : $_ } sort keys %{$r_remaps->{$set}{$type}{map}});
         $r_remaps->{$set}{$type}{re} = qr|$r_remaps->{$set}{$type}{re}|;
       }
       else {
-        $remaps->{$set}{$type}{re} = join('|', keys %{$remaps->{$set}{$type}{map}});
+        $remaps->{$set}{$type}{re} = join('|', sort keys %{$remaps->{$set}{$type}{map}});
         $remaps->{$set}{$type}{re} = qr|$remaps->{$set}{$type}{re}|;
-        $r_remaps->{$set}{$type}{re} = join('|', keys %{$r_remaps->{$set}{$type}{map}});
+        $r_remaps->{$set}{$type}{re} = join('|', sort keys %{$r_remaps->{$set}{$type}{map}});
         $r_remaps->{$set}{$type}{re} = qr|$r_remaps->{$set}{$type}{re}|;
       }
     }
@@ -192,7 +192,7 @@
 
     my $mainmap;
 
-    foreach my $type (keys %{$remaps->{$scheme_d}}) {
+    foreach my $type (sort keys %{$remaps->{$scheme_d}}) {
       my $map = $remaps->{$scheme_d}{$type}{map};
       my $re = $remaps->{$scheme_d}{$type}{re};
       if ($type eq 'negatedsymbols') {
@@ -217,7 +217,7 @@
     # special cases such as '\={\i}' -> '\={i}' -> "i\x{304}"
     $text =~ s/(\\(?:$d_re|$a_re)){\\i}/$1\{i\}/g;
 
-    foreach my $type (keys %{$remaps->{$scheme_d}}) {
+    foreach my $type (sort keys %{$remaps->{$scheme_d}}) {
       my $map = $remaps->{$scheme_d}{$type}{map};
       my $re = $remaps->{$scheme_d}{$type}{re};
       next unless $re;
@@ -269,7 +269,7 @@
 sub latex_encode {
   my $text = shift;
 
-  foreach my $type (keys %{$r_remaps->{$scheme_e}}) {
+  foreach my $type (sort keys %{$r_remaps->{$scheme_e}}) {
     my $map = $r_remaps->{$scheme_e}{$type}{map};
     my $re = $r_remaps->{$scheme_e}{$type}{re};
       if ($type eq 'negatedsymbols') {
@@ -286,7 +286,7 @@
     }
   }
 
-  foreach my $type (keys %{$r_remaps->{$scheme_e}}) {
+  foreach my $type (sort keys %{$r_remaps->{$scheme_e}}) {
     my $map = $r_remaps->{$scheme_e}{$type}{map};
     my $re = $r_remaps->{$scheme_e}{$type}{re};
     if ($type eq 'accents') {
@@ -318,7 +318,7 @@
     }
   }
 
-  foreach my $type (keys %{$r_remaps->{$scheme_e}}) {
+  foreach my $type (sort keys %{$r_remaps->{$scheme_e}}) {
     my $map = $r_remaps->{$scheme_e}{$type}{map};
     my $re = $r_remaps->{$scheme_e}{$type}{re};
     if ($type eq 'wordmacros') {
--- biber-norb.git.orig/t/full.t
+++ biber-norb.git/t/full.t
@@ -4,13 +4,22 @@
 use utf8;
 no warnings 'utf8';
 
-use Test::More tests => 5;
+use Test::More;
+
+if ($ENV{BIBER_DEV_TESTS}) {
+  plan tests => 5;
+}
+else {
+  plan skip_all => 'BIBER_DEV_TESTS not set';
+}
+
 use IPC::Run3;
 use IPC::Cmd qw( can_run );
 use File::Temp;
 use File::Compare;
 use File::Which;
 
+
 my $perl = which('perl');
 
 my $tmpfile = File::Temp->new();
@@ -26,4 +35,3 @@
 like($stdout, qr|WARN - Duplicate entry key: 'F1' in file 't/tdata/full\.bib', skipping \.\.\.|ms, 'Testing duplicate/case key warnings - 1');
 like($stdout, qr|WARN - Possible typo \(case mismatch\) between datasource keys: 'f1' and 'F1' in file 't/tdata/full\.bib'|ms, 'Testing duplicate/case key warnings - 2');
 like($stdout, qr|WARN - Possible typo \(case mismatch\) between citation and datasource keys: 'C1' and 'c1' in file 't/tdata/full\.bib'|ms, 'Testing duplicate/case key warnings - 3');
-
--- biber-norb.git.orig/t/remote-files.t
+++ biber-norb.git/t/remote-files.t
@@ -4,16 +4,20 @@
 use utf8;
 no warnings 'utf8' ;
 
-use Test::More tests => 3;
+use Test::More;
+
+if ($ENV{BIBER_DEV_TESTS}) {
+  plan tests => 3;
+}
+else {
+  plan skip_all => 'BIBER_DEV_TESTS not set';
+}
 
 use Biber;
 use Biber::Output::bbl;
 use Log::Log4perl;
 chdir("t/tdata") ;
 
-SKIP: {
-        skip "BIBER_SKIP_DEV_TESTS env var is set, skipping remote tests", 3 if $ENV{BIBER_SKIP_DEV_TESTS};
-
 # Set up Biber object
 my $biber = Biber->new(noconf => 1);
 my $LEVEL = 'ERROR';
@@ -140,5 +144,3 @@
 is( $out->get_output_entry('citeulike:8283461', $main), $cu1, 'Fetch from citeulike') ;
 is( $out->get_output_entry('AbdelbarH98', $main), $dl1, 'Fetch from plain bib download') ;
 is( $out->get_output_entry('jung_alchemical_????', $main), $ssl, 'HTTPS test') ;
-
-}
--- biber-norb.git.orig/t/tool-bltxml.t
+++ biber-norb.git/t/tool-bltxml.t
@@ -57,57 +57,57 @@
 
 <bltx:entries xmlns:bltx="http://biblatex-biber.sourceforge.net/biblatexml">
   <bltx:entry id="i3Š" entrytype="unpublished">
-    <bltx:author form="uniform" lang="lang">
+    <bltx:author>
       <bltx:person>
         <bltx:last>
-          <bltx:namepart initial="a">aaa</bltx:namepart>
+          <bltx:namepart initial="A">AAA</bltx:namepart>
         </bltx:last>
       </bltx:person>
       <bltx:person>
         <bltx:last>
-          <bltx:namepart initial="b">bbb</bltx:namepart>
+          <bltx:namepart initial="B">BBB</bltx:namepart>
         </bltx:last>
       </bltx:person>
       <bltx:person>
         <bltx:last>
-          <bltx:namepart initial="c">ccc</bltx:namepart>
+          <bltx:namepart initial="C">CCC</bltx:namepart>
         </bltx:last>
       </bltx:person>
       <bltx:person>
         <bltx:last>
-          <bltx:namepart initial="d">ddd</bltx:namepart>
+          <bltx:namepart initial="D">DDD</bltx:namepart>
         </bltx:last>
       </bltx:person>
       <bltx:person>
         <bltx:last>
-          <bltx:namepart initial="e">eee</bltx:namepart>
+          <bltx:namepart initial="E">EEE</bltx:namepart>
         </bltx:last>
       </bltx:person>
     </bltx:author>
-    <bltx:author>
+    <bltx:author form="uniform" lang="lang">
       <bltx:person>
         <bltx:last>
-          <bltx:namepart initial="A">AAA</bltx:namepart>
+          <bltx:namepart initial="a">aaa</bltx:namepart>
         </bltx:last>
       </bltx:person>
       <bltx:person>
         <bltx:last>
-          <bltx:namepart initial="B">BBB</bltx:namepart>
+          <bltx:namepart initial="b">bbb</bltx:namepart>
         </bltx:last>
       </bltx:person>
       <bltx:person>
         <bltx:last>
-          <bltx:namepart initial="C">CCC</bltx:namepart>
+          <bltx:namepart initial="c">ccc</bltx:namepart>
         </bltx:last>
       </bltx:person>
       <bltx:person>
         <bltx:last>
-          <bltx:namepart initial="D">DDD</bltx:namepart>
+          <bltx:namepart initial="d">ddd</bltx:namepart>
         </bltx:last>
       </bltx:person>
       <bltx:person>
         <bltx:last>
-          <bltx:namepart initial="E">EEE</bltx:namepart>
+          <bltx:namepart initial="e">eee</bltx:namepart>
         </bltx:last>
       </bltx:person>
     </bltx:author>
