Perl Test::More, get stdout

Posted by Mike on Stack Overflow See other posts from Stack Overflow or by Mike
Published on 2010-05-21T18:14:07Z Indexed on 2010/05/21 18:20 UTC
Read the original article Hit count: 429

Filed under:
|

Is there a way inside a Perl test case using Test::More to get the program's stdout

For instance, if I do

use Test::More;

ok(foo());

#in the code I am testing

sub foo() {
 print "hello"
}

"hello" will not be visible. I would like to see it.

edit

I know I can use diag(), however this would not work if the print is inside the code I am testing

© Stack Overflow or respective owner

Related posts about perl

Related posts about testing