In article <[EMAIL PROTECTED]>, Demerphq
<[EMAIL PROTECTED]> wrote:
> On 7/1/05, Michael G Schwern <[EMAIL PROTECTED]> wrote:
> > After talking with Ovid some in the kitchen I'm of the opinion that
> > is_deeply() is currently doing the right thing and that these tests cannot
> > go. Largely it comes down to the Principle of Least Surprise.
>
> I cant agree with this analysis. If you go down this route surprise abounds.
> (From my earlier post)
>
> is_deeply($x,$y); #ok
>
> $x->[0]{a}=1;
> $y->[0]{a}=1;
>
> is_deeply($x,$y); #Surprise!
>
> Thats a MUCH bigger surprise IMO. And a fatal one for anybody really
> relying on is_deeply.
I don't see why the result of that second test is surprising, and
even if it is, that it matters that you were surprised. I don't
a priori expect that the same operations on two data structures
that have the same values will make them also end up with the same
values.
Right now is_deeply acts like the other things in Test::More. I
think things would be more confusing if it did things differently.
I don't want is_deeply to tell me if things will be the same in the
future, but if they have the same values when I test them. In your
example they start off looking the same, then change. is_deeply
catches that.
If you want to do it in a different way and think about the data
structure in a way that Test::More doesn't, don't use is_deeply. :)
--
brian d foy, [EMAIL PROTECTED]