NAME

Test::Output - Utilities to test STDOUT and STDERR messages.

VERSION

Version 0.01

SYNOPSIS

use Test::More tests => 4;
use Test::Output;

sub writer {
  print "Write out.\n";
  print STDERR "Error out.\n";
}

output_is(
          \&writer,
          "Write out.\n",
          "Error out.\n",
          'Test STDOUT & STDERR'
        );

stdout_is(\&writer,"Write out.\n",'Test STDOUT');

stderr_is(sub { print "This is STDOUT\n"; writer(); },
          "Error out.\n",'Test STDERR');

DESCRIPTION

Test::Output provides functions to test date sent to both STDOUT and STDERR.

Test::Output ties STDOUT and STDERR using Test::Output::Tie.

All functions are exported.

output_is

output_is( $coderef, $expected_stdout, $expected_stderr, 'comment' );

output_is() compares the output of $coderef to $expected_stdout and $expected_stderr, and fails if they do not match.

stdout_is

stderr_is( $coderef, $expected, 'comment' );

stdout_is() is similar to output_is() except that it only compares $expected to STDOUT captured from $codref.

stderr_is

stderr_is( $coderef, $expected, 'comment' );

stderr_is() is similar to output_is(), and stdout_is() except that it only compares $expected to STDERR captured from $codref.

AUTHOR

Shawn Sorichetti, <ssoriche@coloredblocks.net>

BUGS

Please report any bugs or feature requests to bug-test-output@rt.cpan.org, or through the web interface at http://rt.cpan.org. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

ACKNOWLEDGEMENTS

Thanks to chromatic whose TieOut.pm was the basis for capturing output.

COPYRIGHT & LICENSE

Copyright 2005 Shawn Sorichetti, All Rights Reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.