On Tue, Jan 13, 2004 at 04:35:21PM +0100, Elizabeth Mattijsen wrote: > In the end I came up with this code. It's pretty simple andstraightforward and maybe would be nice to include with Test::More.
I definitely have a use for that but basing it on test numbers seems a bit dodgy as a small tweak here or there (especially with looped tests) can throw the numbers out completely.
I think it's a good idea to give all tests unique names. I try to do this bu I don't always succeed. It would be nice to be able to base the todos on the name rather than the number. So say you're testing out your new addition function and for some reason it's pretty good so far but has trouble with 2 and 2
my %todo =( "add 2 + 2" => "Put 2 and 2 together and gets 5" );
foreach my $i (0..100) { foreach my $j (0..100) { todo_some( \%todo, sub{is(my_add($i, $j), $i + $j, "add $i + $j")} ); } }
now I don't have to worry about changing the loop bounds or adding tests before the loop,
Maybe the first parameter of "todo_some" should also accept a code reference to a subroutine which, given the other parameters, is supposed to give the TODO reason? That would make it even more flexible, I would think.
Liz