more useful options | |
PerlMonks |
Re: Quieting Test::Moreby kcott (Archbishop) |
on Jul 04, 2017 at 08:03 UTC ( [id://1194138]=note: print w/replies, xml ) | Need Help?? |
G'day stevieb, "... is there a way to flag it to say "don't say anything, except for my debug print statements"?" You can do this with a combination of diag statements, SKIP: blocks, and a DEBUG flag. Here's a very simple, and highly contrived, example (pm_1194120.t):
Without the debug flag being set, here's verbose, non-verbose, and no STDOUT output (timing information elided):
Here's the same commands, with the debug flag set:
While that last one does exactly what you ask (i.e. nothing but debug statement output); consider whether you really want to throw away STDOUT (it's only a few lines and could provide useful feedback). Obviously, there's a huge number of variations on that theme. You could have more than one debug flag and they certainly don't need to be environmental variables. I've separated the diag statements from the tests, but there could be a mixture; and, not everything needs to be in a SKIP: block. See also: prove (for a variety of other options, '-b' is one I usually need); and Test::More (in particular, the Diagnostics, Conditional tests, and Test control sections). — Ken
In Section
Seekers of Perl Wisdom
|
|