Fwd: [Chicago-talk] HTML::Tree progress

Leland Johnson easyasy2k at gmail.com
Sat Sep 25 04:07:24 CDT 2004


Okay, after uh, 37 minutes of coding and talking with Sean, it looks
like Test::Deep should not be used either. Here's Sean's explanation:


Me:
not ok 2 - $c is a true clone of $t
# 
# Failed test (clonei.t at line 17)
# Comparing hash keys of $data
# Missing: '_body', '_head', '_pos'
(see footnote #1)

Sean:
OK, those shouldn't count. They're internal attributes.
that's why $t->same_as($c) would ignore them.

Me:
okay, so they are internal attributes of the _object_ that aren't
related to HTML.

Sean:
right. Those specifically are about parser state.

Me:
so the clone is in a different state. can you kinda explain that?
would be good for the next email I'm writing.

Sean:
well, the thing is this: You can't copy the state of the parser,
because the parser involves XS. And anyway, it'd come down to copying
a filehandle, so no point. Instead, ->clone just copies the tree
structure and external attributes (i.e., everything you'd see if you
did ->as_HTML).


So, the points both Test::More::is_deeply (half the time) and
Test::Deep::cmp_deeply are failing on are just internal variables that
HTML::TreeBuilder uses that have no effect on output html, etc.

This solves the problem of using Test::Deep (for now - it might come
up later again) and its 3 dependencies, one of which is Scalar::Util,
which could of introduced some kind of irony, but I'm too tried right
now.

I've committed what the author says to be correct tests, though I'm
not sure exactly what the new tests are testing. If clone works? If
is_same works? Both?



1 - Code to generate that output can be had at
http://protoplasmic.org/random/phalanx_chicago/clonei_bad.t

On Sat, 25 Sep 2004 02:56:46 -0500, Leland Johnson <easyasy2k at gmail.com> wrote:
> Okay, here clonei.t alternates between failing #2 and eating 10mB of
> memory a second after doing #1.
> 
> Test::More in its docs says it is not tested with circular references,
> so that is more than likely the problem. I'll be emailing Schwern
> about it, per Sean's request.
> 
> The real solution seems to be changing it to use Test::Deep, which
> I'll be trying yet tonight. We should ask Andy what to do here, since
> adding a dependency on a testing module is mighty inconvenient for
> some. (WWW::Mechanize skips some tests if some modules are not found,
> and includes another in its package)
> 
> I also manged to have building.t fail one test. See the updated
> http://phalanx.kwiki.org/index.cgi?HTMLTreeTrunkOnFire page for that.
> 
> 
> 
> 
> On Fri, 24 Sep 2004 21:40:47 -0500, Shawn Carroll
> <shawn.c.carroll at gmail.com> wrote:
> > I am committing clonei.t with a failing test.  $c and $t fail a
> > is_deeply test.  The code of the clone method shows that this isn't
> > _really_ supported for Tree objs....  Thoughts?
> >
> > --Shawn
> >
> >
> >
> > --
> > shawn.c.carroll at gmail.com
> > Perl Programmer
> > Soccer Referee
> > _______________________________________________
> > Chicago-talk mailing list
> > Chicago-talk at mail.pm.org
> > http://mail.pm.org/mailman/listinfo/chicago-talk
> >
> 
> 
> --
> Leland Johnson
> http://protoplasmic.org
> 



-- 
Leland Johnson
http://protoplasmic.org


More information about the Chicago-talk mailing list