On Wed, Nov 27, 2002 at 10:35:33PM +0000, Mark Fowler wrote: > <plug>See also Acme::Test::Buffy (lame example testing module), and > Test::Builder::Tester for help testing Test::Binary.</plug>
We found that for testing Test::Builder objects, it was handy to do things like: *orig_ok = \&Test::Builder::ok; sub fail_ok { my ($self, $test, $name) = @_; orig_ok($self,!$test, $name); } { # ensure new test passes correctly my_is 'foo', 'foo', "Foo same"; my_is 'bar', 'bar', "Bar same"; } { # ensure new test fails correctly local *Test::Builder::ok = \&fail_ok; my_is 'foo', 'bar', "Foo not same as bar"; my_is 'bar', 'foo', "Bar not same as foo"; } It's not quite as useful as Test::Builder::Tester, in that you can't ensure that the diag() output is correct, but it's a nice 'first pass' at how to ensure tests fail, without your tests failing. Tony