I'm embarking on writing a test suite for the HTML renderer used by PerlMonks Editor. I could check the rendered HTML by performing string matches against the expected result, but this is HTML and that is a fragile way of performing the checking.
I could use a module such as HTML::Diff which provides semantic differencing between two chunks of HTML, but that introduces an extra dependency that is only required for testing.
I could "repackage" key pieces of HTML::Diff to do the work I need, but that could be a lot of work and may be dodgy with respect to licencing.
My inclination at the moment is to go the small dependency but possibly fragile route of pretty much just directly comparing output with expected output. Is there a better solution that I have overlooked?
DWIM is Perl's answer to Gödel
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.