From db1929094fd06e835fb6a1f46cda7ce018a1f852 Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Wed, 27 Aug 2014 13:24:18 -0300 Subject: [PATCH] Bug 6536: QA Follow-up for fixing a unit test under Perl 5.18 The last test on the first series, fails randomly on Perl 5.18: not ok 12 - Third query makes no difference # Failed test 'Third query makes no difference' # at t/db_dependent/Breeding.t line 104. # got: '' # expected: '1' # Looks like you failed 1 test of 12. not ok 1 - _build_query This change makes tests pass. Please consider if this needs to be fixed (i.e. sort order matters) or the test needs to be rewritten. Signed-off-by: Marcel de Rooy I agree with adding the sort. (The need for doing this in Perl 5.18 is another topic.) Signed-off-by: Tomas Cohen Arazi --- C4/Breeding.pm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/C4/Breeding.pm b/C4/Breeding.pm index fa3af82475..f9dfdee562 100644 --- a/C4/Breeding.pm +++ b/C4/Breeding.pm @@ -249,7 +249,9 @@ sub _build_query { my $zquery=''; my $squery=''; my $nterms=0; - foreach my $k ( keys %$pars ) { + foreach my $k ( sort keys %$pars ) { + #note that the sort keys forces an identical result under Perl 5.18 + #one of the unit tests is based on that assumption if( ( my $val=$pars->{$k} ) && $qry_build->{$k} ) { $qry_build->{$k} =~ s/#term/$val/g; $zquery .= $qry_build->{$k}; -- 2.39.5