in reply to Do you consider these different or the same?
- What is the purpose of Test::More::is_deeply?
- What, then, should its semantics be?
My answer to the first is that is_deeply's purpose is to make it easy to test complex observed values by comparing them with given expected values.
My answer to the second, then, is that is_deeply should consider the observed and expected values to be equivalent if both have the same structure and subvalues, ignoring sharing. (Remember, I am talking semantics here, not implementation.)
Why ignore sharing? Because it rarely matters in tests. By ignoring it we make the common case easier for testers, who frequently hand-roll expected values. This goes back to the purpose of is_deeply; convenience matters.
As to your questions, then, here is how I answer. In the first case, $ar1 and $ar2 are equivalent. Both have the same structure and subvalues – [{},{}]. In the second case, they are not equivalent; [{a=>'foo'},{a=>'foo'}] differs from [{a=>'foo'},{}].
Cheers,
Tom
Tom Moertel : Blog / Talks / CPAN / LectroTest / PXSL / Coffee / Movie Rating Decoder
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Do you consider these different or the same? (eq)
by tye (Sage) on Jul 02, 2005 at 02:44 UTC |