On Tue, 9 Apr 2002, Adrian Howard wrote:

> Any comments before I throw it at CPAN? Sound vaguely sane?

throws_ok can take either a class name or a Regexp ref as an argument to 
compare against.  With earlier versions of perl you can't use the qr// 
operator, so you can't pass regex.  Maybe it would be possible to take a 
leaf out of Test::Builder's book for this:

   # Check if it looks like '/foo/'
    elsif( my($re, $opts) = $regex =~ m{^ /(.*)/ (\w*) $ }sx ) {
        $usable_regex = "(?$opts)$re";
    }

So that I can write...

throws_ok { $this->method } "/^not inited/";

....and have it always work.

Of course, before you can use Test::Exception on perl5.004 I'll have to 
get round to fixing the bugs (http://rt.cpan.org/NoAuth/Bug.html?id=456) 
in Test::Builder::Tester...

Later.

Mark.

-- 
s''  Mark Fowler                                     London.pm   Bath.pm
     http://www.twoshortplanks.com/              [EMAIL PROTECTED]
';use Term'Cap;$t=Tgetent Term'Cap{};print$t->Tputs(cl);for$w(split/  +/
){for(0..30){$|=print$t->Tgoto(cm,$_,$y)." $w";select$k,$k,$k,.03}$y+=2}

Reply via email to