2008/5/12 Ovid <[EMAIL PROTECTED]>: > --- Smylers <[EMAIL PROTECTED]> wrote: > >> If you believe that (until the TODO is done) foo will consistently >> return 3, and you wish to be alerted if it suddenly starts returning >> 4, >> then surely you can do that with a non-TODO test which checks for its >> being 3? > > Sure you can do that: > > my $result; > TODO: { > local $TODO = 'some message'; > $result = foobar(); > is $result, '7', '... and foobar() should pass'; > } > is $result, '3', '... not really 3, but just for a TODO test ...'; > > That's terribly clumsy, more difficult to understand, and is just > waiting for programmers to not pay attention and wipe out the TODO and > just leave the bogus test.
Yes but the code above makes no effort to solve the problem nicely. It could have been done like this TODO: { local $TODO = 'some message'; is my $result = foobar() , '7', '... and foobar() should pass'; until_fixed( sub { is $result, '3', '... not really 3, but just for a TODO test ...'; } ); } where until_fixed looks like sub until_fixed { my $tests = shift; my $pack = caller; my $todo = "${pack}::TODO"; { no strict 'refs'; fail("not in TODO") unless defined ${$todo}; # maybe die, I dunno local ${$todo} = undef; &$tests(); } } Which does not suffer from the problems you list above. I almost posted this a few hours ago but then decided not to since I'm not sure I like the thread at all. I'm posting it now because while I'm not a huge fan of the idea itself, the problems you list are due to a lazy interpretation of the idea (just to be clear, I'm not calling you lazy, I'm just saying that you didn't put much effort into the implementation, presumably because you dislike the idea to start with), > And, because the final 'is' isn't wrapped in TODO, you're making an > assertion of what the code is actually doing, even though you *know* > that what it's doing is wrong. This is not something I'd recommend :) This one is true but then the whole point of this thread is to make assertions for things that shouldn't be true - which is kinda why I don't like it myself, F > > Cheers, > Ovid > > -- > Buy the book - http://www.oreilly.com/catalog/perlhks/ > Perl and CGI - http://users.easystreet.com/ovid/cgi_course/ > Personal blog - http://publius-ovidius.livejournal.com/ > Tech blog - http://use.perl.org/~Ovid/journal/ >