Front page | perl.module-authors |
Postings from January 2010
Re: Comparing hashes
From: Geoffrey Leach
January 18, 2010 08:01
Re: Comparing hashes
Message ID: email@example.com
Hmmmm ... that bruse on my forehead is getting larger ... :-)
Thanks for the reply. And my appologies for getting confused about my
So let me restate the problem.
In order to verify the correctness of internal data structures, the
test in question:
\@exspec, 'Spec gets built correctly' );
uses is_deeply() to compare a 'gold' version of the array @exspec with
the constructed instance, obtained by the (internal) function
This succeeds (so far) on 5.10.x and all but one (so far) 5.8.x. I
thinks there's a success on 5.11.x as well.
What I meant by "having dealt with the problem" was that the problem
exposed by the failing test, namely:
Failed test 'Spec gets built correctly'
at t/03-options_text.t line 107.
Structures begin differing at:
$got-> = '--foo'
$expected-> = '--tar'
I my testing (5.10.x), when I saw a similar problem, I resolved it
by organizing my 'gold' structure to match the computed version.
Having gotten everything to work for 5.10.x, I was assuming that
failures in 5.6.x had something to do with the internal organiation of
the data structure (hence my reference to "unsupported feature"). The
5.8.1 failure came along later.
Looks like I need to have another look at the generation.
Thanks for the help.
On 01/17/2010 05:33:33 PM, firstname.lastname@example.org wrote:
> From a quick glance at the first error, it involves using
> is_deeply to compare arrays of arrays, not hashes. So
> it's not clear "how Perl organizes the hash" gets involved.
> You also have a failure on perl 5.8.1 that looks very similar,
> so 5.6.2 is less of a suspect.
> You need to explain certain aspects of the problem more
> completely to allow someone to help you, particularly:
> "what's generated at run time: it comes out different"
> "dealt with this problem" (what problem?)
> "getting it just right" (what's it?)
> "using an unsupported feature" (which feature is that?)
> On Jan 17, 2010, at 4:31 PM, Geoffrey Leach wrote:
> > I'm dealing with an error report from cpantesters for Getopt::Auto.
> > The problem arrises out of using Test::More::is_deeply to compare a
> > hash with what's generated at run time: it comes out different.
> > I've delt with this problem in my own testing, and have spent some
> > time
> > getting it 'just right'. I suspect the problem arrises out of how
> > organizes the hash. The version with the problem is perl-5.6.2.
> > versions pass. Given that I'm using an unsupported feature, things
> > well come unglued in the future.
> > So, are there any suggestions? Test::Deep? 'use Perl 5.8.0'?
> > Thanks.