From 465e625ca6ab942b46dfb0cee05618d89f47aae2 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 Content-Type: text/plain; charset=utf-8 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.) --- C4/Breeding.pm | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/C4/Breeding.pm b/C4/Breeding.pm index fa3af82..f9dfdee 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}; -- 1.7.7.6