Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re^2: How to Test Output from the Standard Output

by Khen1950fx (Canon)
on Jun 10, 2010 at 10:18 UTC ( #843989=note: print w/ replies, xml ) Need Help??


in reply to Re: How to Test Output from the Standard Output
in thread How to Test Output from the Standard Output

Test::Output is interesting, but I had to make a few adjustments to get it to work. I took Grandfather's script, added a test from Test::Output.

package Test_Package; use strict; sub testing { print "okay"; }; 1; use strict; use Test::Output; use Test::More tests => 4; my $log; open my $logFile, '>', \$log; my $oldStdOut = select $logFile; Test_Package->testing(\$log); select $oldStdOut; close $logFile; stdout_is {print "okay"} "okay", "STDOUT okay"; is('okay', 'okay'); is($log, 'okay'); is($log, 'okay', 'testing okay');


Comment on Re^2: How to Test Output from the Standard Output
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://843989]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (5)
As of 2014-09-18 06:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (108 votes), past polls