On Tue, Sep 09, 2003 at 08:50:06PM +0100, Fergal Daly wrote:
> It says it looks inside listrefs and hashrefs. That's all. 

> Objects are not listrefs and hashrefs. They are sometimes made *from*
> such, but they are not such.

I think many people would disagree with you here but that's irrelevant
because...

> The fact the is_deeply currently looks inside them is a bug.

The AUTHOR INTENDED IT TO and so it is not a bug. If you don't believe me
and you want to ignore Michael's previous mail on it then look at the
source code where you will see

            if( UNIVERSAL::isa($e1, 'ARRAY') and
                UNIVERSAL::isa($e2, 'ARRAY') )
            {
                $ok = eq_array($e1, $e2);
            }

If he didn't want to descend into objects he would have written ref($e1) eq
"ARRAY" but he didn't, he used a technique that VERY DELIBERATELY means
"check the base datastructure _even_ if it's an object".

It couldn't be much clearer that the test failure you expect from is_deeply
has never been there and was _never_ supposed to be there.

It's not a bug it's a feature, a feature that I and others have used. It's
a feature you didn't know about and you don't want and that's fine.

That just means you need a different function like

is_deeply_except_for_blessed_references

That is also a useful function and it's quite easily achievable using
Test::Deep.

If you think the author, his very deliberately written code and 1
reasonable interpretation of the documentation are all wrong then there is
no point in continuing.

If however you accept that the is_deeply in your mind is not the is_deeply
in the author's mind or in the code then I hope we can both agree that 
descending into some blessed refs but not others leads to pitfalls and
gotchas for the test writer.

We both think that is_deeply passes things it should fail and therefore we
both want a "stricter" is_deeply(). My idea of stricter requires a tiny
change, your's requires a rather large change,

F


--------------------------------------------------------------------
mail2web - Check your email from the web at
http://mail2web.com/ .


Reply via email to