3b730138feb6526172565ca65c8872265923e7a6
[catagits/HTTP-Request-AsCGI.git] / t / 04io.t
1 #!perl
2
3 use Test::More tests => 3;
4
5 use strict;
6 use warnings;
7
8 use IO::File;
9 use HTTP::Request;
10 use HTTP::Request::AsCGI;
11
12 my $r = HTTP::Request->new( POST => 'http://www.host.com/');
13 $r->content('STDIN');
14 $r->content_length(5);
15 $r->content_type('text/plain');
16
17 my $c = HTTP::Request::AsCGI->new(
18     request => $r,
19     stderr  => IO::File->new_tmpfile
20 );
21
22 $c->setup;
23
24 print STDOUT 'STDOUT';
25 print STDERR 'STDERR';
26
27 $c->restore;
28
29 is( $c->stdin->getline,  'STDIN',  'STDIN' );
30 is( $c->stdout->getline, 'STDOUT', 'STDOUT' );
31 is( $c->stderr->getline, 'STDERR', 'STDERR' );