Re: [IDEA] Drop into the debugger on failure

2004-07-09 Thread Andrew Pimlott
On Fri, Jul 09, 2004 at 11:00:28AM -0400, Michael G Schwern wrote: > wrap *Test::Builder::diag, pre => sub { > $_[1] = color('red') . $_[1]; > $_[-2] =~ s/$/color 'reset'/e; > }; Glancing at the Hook::LexWrap, I see it's possible to simulate an "around" wrapper by calling the original f

Re: [IDEA] Drop into the debugger on failure

2004-07-09 Thread Fergal Daly
On Fri, Jul 09, 2004 at 11:00:28AM -0400, Michael G Schwern wrote: > Never underestimate The Damian. For a moment I though I had. > #!/usr/bin/perl -w > > use Hook::LexWrap; > use Test::Builder; > use Term::ANSIColor; > > wrap *Test::Builder::diag, pre => sub { > $_[1] = color('red') . $_

Re: [IDEA] Drop into the debugger on failure

2004-07-09 Thread Michael G Schwern
On Fri, Jul 09, 2004 at 10:40:54AM +0100, Fergal Daly wrote: > Is there a LexWrap equivalent of > > use Test::Builder::Vapour::Override; > > sub diag { > my ($self, $diag) = @_; > $self->SUPER::diag(colour_me($diag)); > } > > ? It seems that LexWrap wrappers can't do this as they can't chang

Re: [IDEA] Drop into the debugger on failure

2004-07-09 Thread Fergal Daly
On Thu, Jul 08, 2004 at 08:40:54PM -0400, Michael G Schwern wrote: > On Thu, Jul 08, 2004 at 11:53:52PM +0100, Fergal Daly wrote: > > The main point was that the OO way works right now, > > So does event hooks. Hooks are things you can hang stuff off of, but > they're also used to snare things th

Re: [IDEA] Drop into the debugger on failure

2004-07-08 Thread Michael G Schwern
On Thu, Jul 08, 2004 at 11:53:52PM +0100, Fergal Daly wrote: > The main point was that the OO way works right now, So does event hooks. Hooks are things you can hang stuff off of, but they're also used to snare things that might not want to be snared. In other words... use Test::Builder

Re: [IDEA] Drop into the debugger on failure

2004-07-08 Thread Fergal Daly
On Thu, Jul 08, 2004 at 04:37:06PM -0400, Michael G Schwern wrote: > With inheritence, only one variant can be used at a time. > > With event subscribers, lots of variants can be used at a time. > > Consider what happens when you want to use Test::AutoDebug and a hypothetical > module which color

Re: [IDEA] Drop into the debugger on failure

2004-07-08 Thread Michael G Schwern
On Thu, Jul 08, 2004 at 08:59:38PM +0100, Fergal Daly wrote: > On Thu, Jul 08, 2004 at 01:59:35PM -0400, Michael G Schwern wrote: > > Likely you'd control if you wanted this behavior with > > HARNESS_PERL_SWITCHES=-MTest::AutoDebug > > > > This can be implemented, currently, by adding a post hook

Re: [IDEA] Drop into the debugger on failure

2004-07-08 Thread Fergal Daly
On Thu, Jul 08, 2004 at 01:59:35PM -0400, Michael G Schwern wrote: > Likely you'd control if you wanted this behavior with > HARNESS_PERL_SWITCHES=-MTest::AutoDebug > > This can be implemented, currently, by adding a post hook onto > Test::Builder->ok() with Hook::LexWrap or Sub::Uplevel. I'm c

[IDEA] Drop into the debugger on failure

2004-07-08 Thread Michael G Schwern
What happens now: 1) Run tests 2) Test fails 3) Look at diagnostics 4a) If its enough information, fix the bug 4b) If not, run test in the debugger 5b) Continue to the point where the test failed 6b) Gather necessary info 7b) Fix the bug I want to eliminate 4b and 5b from this process. On