Andy Armstrongs asks:
my @tests = (
{ name => 'test 1', foo => 'bar' },
{ name => 'test 2', foo => 'bok' },
);
for my $test ( @tests ) {
# setup and then
is $wok->spindle, $test->{foo}, "yup";
}
> Does it count that as two or one?
As one, unless you tell it about the loop like so:
# setup and then
is $wok->spindle, $test->{foo}, "yup"; ## TESTCOUNT * 2
No advanced AI yet, I'm afraid. :) It does require a good
amount of careful setup in the beginning. But you can do things like
this:
for my $test ( @tests ) {
run_simple_tests($test); ## TESTCOUNT * 2
}
... where "run_simple tests" contains a bunch of other tests, and it
knows to count all of those twice when invoked at this line.
Michael G Schwern asks:
> What's wrong with no_plan? Why go through backflips to
> automate counting the tests when you can just not count
> them? Seems needlessly officious.
I seldom run the whole test suite at once, but only parts I care about
at the moment, so it's nice to have Test::More tell me that 18/64 tests
failed. It's also nice to see how far along we are with a running tally,
when I check back in on the running tests.
> * count_tests() is not a method, it's a function. It should either
> be a class method or just export it
True enough: I'll probably just export it, although it's a fairly
generic name.
> * Why does count_tests() take a reference? A hash will
> do perfectly well.
You mean passing in the raw keys and values? Ick.
> * Lord I hate tabs.
Not touching that one. Instead, I'll just go on editing my BSD-licensed,
git controlled, Postgres application with tabs, using emacs on my Linux
KDE laptop, pausing to play a game on my PlayStation. :)
Thanks,
--
Greg Sabino Mullane [EMAIL PROTECTED]
End Point Corporation
PGP Key: 0x14964AC8 200709281441
http://biglumber.com/x/web?pk=2529DF6AB8F79407E94445B4BC9B906714964AC8
signature.asc
Description: This is a digitally signed message part
