Yeah, that would be useful. You also could build up a temporary hash and compare that... something like:
my %clean = %$hashref1;
delete @clean{qw( key1 key2 )};
eq_hash( \%clean, $hashref2, 'partial hash comparison' );
I dunno how Schwern would react to wanting ignorable keys... it kinda breaks the pattern of 'result, 'expected', 'test name'.
Another approach is to add a new function. Test::More is built around Test::Builder, and it's pretty easy to add new features. Of course, I'm a *little* biased. :)
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.