Re: Testing What Was Printed

2005-02-14 Thread James E Keenan
David H. Adler wrote: A question: is there any reason that you made this an OO module but still show calls to the methods as functions rather than methods on the object? I.e. why Cverify_number_lines($capture) rather than C$capture-verify_number_lines ? This would also remove the need to

Re: Testing What Was Printed

2005-02-13 Thread Michael G Schwern
On Sat, Feb 12, 2005 at 11:30:56PM -0500, David A. Golden wrote: stdout_is { print scalar caller; } scalar caller; That's a good warning on code blocks, and worth documenting for a module like this, but I'm not sure it's going to be a big issue in writing test

Re: Testing What Was Printed

2005-02-12 Thread Adrian Howard
On 11 Feb 2005, at 19:52, Shawn Sorichetti wrote: [snip] I've started working on Test::Output that is based on Schwern's TieOut module that comes with Test::More. I'm hoping to have it released on CPAN later tonight. Test::Output is a self contained so that it can be included with other

Re: Testing What Was Printed

2005-02-12 Thread David A. Golden
Michael G Schwern wrote: On Fri, Feb 11, 2005 at 07:30:24AM -0500, David Golden wrote: stdout_is { fcn() } $string, comment; # exact stdout_like{ fcn() } qr/regex/, comment; # regex match stdout_count { fcn() } qr/regex/, $count, comment; # number of matches stdout_found { fcn() }

Re: Testing What Was Printed

2005-02-12 Thread Michael G Schwern
On Sat, Feb 12, 2005 at 12:47:56PM -0500, David A. Golden wrote: The trouble with this interface is sometimes you want to collect a bunch of output from a bunch of different functions together. That's why I suggested that it be prototyped to take a code block: stdout_is { fcn1();

Re: Testing What Was Printed

2005-02-12 Thread David A. Golden
Michael G Schwern wrote: On Sat, Feb 12, 2005 at 12:47:56PM -0500, David A. Golden wrote: The trouble with this interface is sometimes you want to collect a bunch of output from a bunch of different functions together. That's why I suggested that it be prototyped to take a code block: stdout_is {

Re: Testing What Was Printed

2005-02-11 Thread James E Keenan
David Cantrell wrote: Jim Keenan wrote: Using the standard Test::More framework, is it possible to test whether what was printed to a filehandle matches a predetermined string or list of strings? Would IO::Capture be of help here? And here are the fruits of my application of IO::Capture: a

Re: Testing What Was Printed

2005-02-11 Thread David Golden
My $0.02: Very nice integration of IO::Capture. I think this is very promising, but all the start(), stop() calls seem overly repetitive to me. What about refactoring it into a set of test functions that handle it for the user automatically? Just quickly off the cuff, what about a test module

Re: Testing What Was Printed

2005-02-11 Thread James E Keenan
David Golden wrote: My $0.02: Very nice integration of IO::Capture. I think this is very promising, but all the start(), stop() calls seem overly repetitive to me. Agreed. What about refactoring it into a set of test functions that handle it for the user automatically? Just quickly off the

Re: Testing What Was Printed

2005-02-11 Thread Michael G Schwern
On Fri, Feb 11, 2005 at 07:30:24AM -0500, David Golden wrote: Very nice integration of IO::Capture. I think this is very promising, but all the start(), stop() calls seem overly repetitive to me. What about refactoring it into a set of test functions that handle it for the user

Re: Testing What Was Printed

2005-02-11 Thread Shawn Sorichetti
On Feb 11, 2005, at 2:44 PM, Michael G Schwern wrote: On Fri, Feb 11, 2005 at 07:30:24AM -0500, David Golden wrote: Very nice integration of IO::Capture. I think this is very promising, but all the start(), stop() calls seem overly repetitive to me. What about refactoring it into a set of test

Re: Testing What Was Printed

2005-02-11 Thread Tels
-BEGIN PGP SIGNED MESSAGE- Moin, On Friday 11 February 2005 21:08, David H. Adler wrote: On Thu, Feb 10, 2005 at 09:28:30PM -0500, James E Keenan wrote: And here are the fruits of my application of IO::Capture: a module with three subroutines which have proven useful in the project

Re: Testing What Was Printed

2005-02-11 Thread James E Keenan
David H. Adler wrote: A question: is there any reason that you made this an OO module but still show calls to the methods as functions rather than methods on the object? An answer: It was a quick hack based on my first day's experience with IO::Capture::Stdout. Its original rationale was

Re: Testing What Was Printed

2005-02-11 Thread James E Keenan
Shawn Sorichetti wrote: I've started working on Test::Output that is based on Schwern's TieOut module that comes with Test::More. I'm hoping to have it released on CPAN later tonight. Test::Output is a self contained so that it can be included with other modules, and no prereqs. Right now it

Re: Testing What Was Printed

2005-02-11 Thread James E Keenan
Tels wrote: On Friday 11 February 2005 21:08, David H. Adler wrote: Just askin'. :-) In similiar line of thought: Why verify_number_lines instead of the (much shorter :) lines? Speaking source code is something I like, but it shouldn't gabble on :) Oh, and why TestAuxiliary and not

Testing What Was Printed

2005-02-08 Thread Jim Keenan
Using the standard Test::More framework, is it possible to test whether what was printed to a filehandle matches a predetermined string or list of strings? Consider the following: use Test::More tests = 1; is(get_data_count([1..39]), 39, should be 39 items); sub

Re: Testing What Was Printed

2005-02-08 Thread David Cantrell
Jim Keenan wrote: Using the standard Test::More framework, is it possible to test whether what was printed to a filehandle matches a predetermined string or list of strings? Would IO::Capture be of help here? -- David Cantrell

Re: Testing What Was Printed

2005-02-08 Thread James E Keenan
David Cantrell wrote: Jim Keenan wrote: Using the standard Test::More framework, is it possible to test whether what was printed to a filehandle matches a predetermined string or list of strings? Would IO::Capture be of help here? Looks promising. Hope to find time today to try it out and report

Re: Testing What Was Printed

2005-02-08 Thread Michael G Schwern
On Mon, Feb 07, 2005 at 12:46:51PM -0800, Jim Keenan wrote: Using the standard Test::More framework, is it possible to test whether what was printed to a filehandle matches a predetermined string or list of strings? Any number of existing modules can be used which capture the output of a