|Do you know where your variables are?|
I have yet to be convinced about the use of Test::More and it's brethren.
I've seen signs of people using these modules within the code being tested. That means that it either has to be removed for "production purposes" or disabled. If it is removed, then you risk its removal changing the nature of the code. If it is disabled, then it means that the production version carries the weight of the testcode. Neither is satisfactory IMO.
Using it the way you showed above, seperate from the real code, just used to simplify the validation of results makes some sense, but I'm still not sure.
My other basic qualm is that it tends to render the testcases to a series of individually descrete steps. Essentially unit tests of a very fine grain. I prefer my testcases to be more realistic, by which I mean, I like them to be as close as is practical to a real world usage of the code under test. This tends to do somewhat more than just exercising the API under test, in that it also tends to highlight design issues. If the API has been design such that it is awkward to use, this tends to become obvious. We've all encountered APIs that may look great on paper, from the designers perspective, but that force the coder to jump through hoops in order to use them in the real world. (Anyone used Java?:).
Coding the testcase as a realistic 'caller application' has the benefits of:
I can see the benefit of using the Test::* group to provide easy notification of where & why the overall testcase fails, but I still have qualms about their more abstract effects upon the testcases.
From my breif exploratory visits to the Test::* group of modules, none that I have seen, yet satisfy these criteria.
I still don't have a satisfactory way of ensuring that my module-embedded testcases are not loaded into memory when the module is used. I have a very hooky method, but it has many flaws. If anyone has any suggestions on how to do this I'd love to hear them.
Examine what is said, not who speaks."Efficiency is intelligent laziness." -David Dunham
"When I'm working on a problem, I never think about beauty. I think only how to solve the problem. But when I have finished, if the solution is not beautiful, I know it is wrong." -Richard Buckminster Fuller
If I understand your problem, I can solve it! Of course, the same can be said for you.