Re: Munging output when running warning tests

2008-05-08 Thread nadim khemir
Thank you for explaining the thoughts behind $trap. Cheers, Nadim.

Re: Munging output when running warning tests

2008-05-04 Thread Eirik Berg Hanssen
Jonathan Rockway <[EMAIL PROTECTED]> writes: > I think the most sane interface would be: > > my $trap = trap { ... }; > is $trap->foo, 'foo'; > is $trap->bar, 'bar'; Test::Trap already provides: trap { ... }; is $trap->foo, 'foo'; # for certain values of foo is $trap->bar, 'bar'; # ... a

Re: Munging output when running warning tests

2008-05-04 Thread Aristotle Pagaltzis
* Jonathan Rockway <[EMAIL PROTECTED]> [2008-05-03 21:15]: > You said you're trying to emulate $@, but $@ can be changed out > from under you rather easily, so instead of: > > eval { foo() }; > if($@){ error } > > The defensive programmer will write: > > my $result = eval { foo() }; > if

Re: Munging output when running warning tests

2008-05-03 Thread Jonathan Rockway
* On Fri, May 02 2008, Eirik Berg Hanssen wrote: > nadim khemir <[EMAIL PROTECTED]> writes: > >> On Friday 02 May 2008 01.24.00 Eirik Berg Hanssen wrote: >>> use Test::More tests => 1; >>> use Test::Trap; >>> trap { warn "1\n2\n3" }; >>> $trap->warn_like(0, qr/1\n2\n3/); >> >> Ah! I like this. How

Re: Munging output when running warning tests

2008-05-02 Thread Eirik Berg Hanssen
nadim khemir <[EMAIL PROTECTED]> writes: > On Friday 02 May 2008 01.24.00 Eirik Berg Hanssen wrote: >> use Test::More tests => 1; >> use Test::Trap; >> trap { warn "1\n2\n3" }; >> $trap->warn_like(0, qr/1\n2\n3/); > > Ah! I like this. How did I miss this module?? Perhaps I just haven't been _qu

Re: Munging output when running warning tests

2008-05-02 Thread nadim khemir
On Friday 02 May 2008 01.24.00 Eirik Berg Hanssen wrote: > use Test::More tests => 1; > use Test::Trap; > trap { warn "1\n2\n3" }; > $trap->warn_like(0, qr/1\n2\n3/); Ah! I like this. How did I miss this module?? is it possible to have trap{} return an object/sub/whatever that is created by the

Re: Munging output when running warning tests

2008-05-01 Thread Eirik Berg Hanssen
nadim khemir <[EMAIL PROTECTED]> writes: > Thanks to your help (and trying to reproduce the error in simpler code) I > have > found an error in my testing and in the silly I used to fix it. Ah. Cool. :) > Note that: > > warning_like > { > warn "1\n2\n3" ; > } qr/1\n2\n3/ ; > > still doesn

Re: Munging output when running warning tests

2008-05-01 Thread nadim khemir
On Thursday 01 May 2008 20.06.52 Eirik Berg Hanssen wrote: > What precisely must "something()" be? I tried the following: > So. Where do I look? Here is the (simplified) code that would generate the warning I thought was a problem (read below) my ($search_regex, $replacement_regex) = (qr/

Re: Munging output when running warning tests

2008-05-01 Thread Aristotle Pagaltzis
* nadim khemir <[EMAIL PROTECTED]> [2008-05-01 18:25]: > On Tuesday 29 April 2008 19.52.08 Aristotle Pagaltzis wrote: > > If the warning is normal, how about disabling it? If a warning > > does not signify a problem, there is absolutely no point in > > having perl emit one anyway. > > It's a perl

Re: Munging output when running warning tests

2008-05-01 Thread Eirik Berg Hanssen
nadim khemir <[EMAIL PROTECTED]> writes: > warning_like > { > something() ; > } qr'Use of uninitialized value in substitution iterator' ; > > > I get the warning on the terminal which is boring when one works with a > module > but worse when zealots (that would be Gabor) report

Re: Munging output when running warning tests

2008-05-01 Thread nadim khemir
On Tuesday 29 April 2008 19.52.08 Aristotle Pagaltzis wrote: > If the warning is normal, how about disabling it? If a warning > does not signify a problem, there is absolutely no point in > having perl emit one anyway. It's a perl warning (in an eval) not something I output. Cheers, Nadim.

Re: Munging output when running warning tests

2008-04-29 Thread Aristotle Pagaltzis
* nadim khemir <[EMAIL PROTECTED]> [2008-04-27 14:00]: > Since I didn't remember that the warnings were normal, I had to > dig a bit to find that out. If the warning is normal, how about disabling it? If a warning does not signify a problem, there is absolutely no point in having perl emit one any

Re: Munging output when running warning tests

2008-04-28 Thread nadim khemir
On Tuesday 29 April 2008 03.24.48 Michael G Schwern wrote: > > BTW: Test::Warn suck a bit because it doesn't check the warning you emit > > but the _first_ line of the warning you emit (hmm, time for a patch > > maybe). > > All the warnings_* functions take an array ref of warnings. You can't test

Re: Munging output when running warning tests

2008-04-28 Thread Michael G Schwern
nadim khemir wrote: I have had a problems with output when running tests, this happends, IE, when perl output a warning. warning_like { something() ; } qr'Use of uninitialized value in substitution iterator' ; I get the warning on the terminal which is boring when one

Munging output when running warning tests

2008-04-27 Thread nadim khemir
Hi, I have had a problems with output when running tests, this happends, IE, when perl output a warning. warning_like { something() ; } qr'Use of uninitialized value in substitution iterator' ; I get the warning on the terminal which is boring when one works with a mod