Re: using examples as tests + Devel::Cover

2006-09-12 Thread Gabor Szabo

On 9/11/06, David Golden [EMAIL PROTECTED] wrote:

They probably need to be run in the same process.  What about using
Test::Output or IO::Capture to capture the output (and keep it from
Test::Harness) and just running the code with do code.pl?


Thanks, this was a good idea though the main problem I had is
that I chdir-ed to the 'sample' directory before running the
sample scripts.
Devel::Cover did not like this.


Gabor


Re: using examples as tests + Devel::Cover

2006-09-12 Thread Paul Johnson
On Tue, Sep 12, 2006 at 12:36:49PM +0300, Gabor Szabo wrote:
 On 9/11/06, David Golden [EMAIL PROTECTED] wrote:
 They probably need to be run in the same process.  What about using
 Test::Output or IO::Capture to capture the output (and keep it from
 Test::Harness) and just running the code with do code.pl?
 
 Thanks, this was a good idea though the main problem I had is
 that I chdir-ed to the 'sample' directory before running the
 sample scripts.
 Devel::Cover did not like this.

Any idea why?  Something to to with relative paths in @INC perhaps?

Devel::Cover itself also does things to turn programs into tests, and to
generate and check against golden results.  You might find something there
useful.  But then again, probably not.

(This is also the reason CPANTS thinks Devel::Cover has no tests.)

-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net


using examples as tests + Devel::Cover

2006-09-11 Thread Gabor Szabo

In a module I have just started to maintain there were 0 tests
but there were several exampes with their expected output.

As I would like to keep the examples and I would like to have tests
but I don't want to duplicate this code I added a test t/sample.t
that would run each one of the example files and compare its
output to the expected output.

(system code out 2err)...

So far I have encountered only one problem with this, when I run
./Build testcover I don't get the coverage report from these
example scripts.

So what do you think about using examples as tests?
How could I convince Devel::Cover to collect coverage
information from these tests as well?

Gabor
ps. specifically I am talking about this module:
http://search.cpan.org/dist/Spreadsheet-ParseExcel/


Re: using examples as tests + Devel::Cover

2006-09-11 Thread David Golden

Gabor Szabo wrote:


(system code out 2err)...

So far I have encountered only one problem with this, when I run
./Build testcover I don't get the coverage report from these
example scripts.

So what do you think about using examples as tests?
How could I convince Devel::Cover to collect coverage
information from these tests as well?


They probably need to be run in the same process.  What about using 
Test::Output or IO::Capture to capture the output (and keep it from 
Test::Harness) and just running the code with do code.pl?


Regards,
David Golden