My opinion:  those is_deeply() tests should probably not pass.  While on the surface 
it may appear
that they should, I would argue that this is a case where the programmer writing the 
tests needs
to know enough about the system he or she is building to create tests that accurately 
reflect how
the code will be used.

This is fine:

  isa_ok($str2, ref $str1, '... and the object');

This is (almost) not fine:

  is($str2, $str1, '... and the strings are equal');

However, the latter (and is_deeply()) should work *If and Only If* that comparison is 
part of the
documented interface.  If it's not documented, I don't want an explicit test for 
behavior that
might change from the standpoint of the person using the code.  Of course, I don't 
mind testing
internals that might change:  people using the code won't be mucking with the 
internals.

The problem, of course, is that this implies that the exact behavior of is_deeply() 
should change
depending upon whether or not a particular use of code is documented.  This is not 
what I mean.  I
suspect that we have a case where there is no clear cut answer, but the programmers 
writing tests
need to know the pros and cons of different approaches.

I hope that made sense.

Cheers,
Ovid

=====
Silence is Evil            http://users.easystreet.com/ovid/philosophy/indexdecency.htm
Ovid                       http://www.perlmonks.org/index.pl?node_id=17000
Web Programming with Perl  http://users.easystreet.com/ovid/cgi_course/

__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

Reply via email to