File: 04io.t

package info (click to toggle)
libhttp-request-ascgi-perl 0.5-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 92 kB
  • ctags: 10
  • sloc: perl: 430; makefile: 46
file content (28 lines) | stat: -rw-r--r-- 549 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!perl

use Test::More tests => 3;

use strict;
use warnings;

use IO::File;
use HTTP::Request;
use HTTP::Request::AsCGI;

my $r = HTTP::Request->new( POST => 'http://www.host.com/');
$r->content('STDIN');
$r->content_length(5);
$r->content_type('text/plain');

my $c = HTTP::Request::AsCGI->new($r);
$c->stderr(IO::File->new_tmpfile);
$c->setup;

print STDOUT 'STDOUT';
print STDERR 'STDERR';

$c->restore;

is( $c->stdin->getline,  'STDIN',  'STDIN' );
is( $c->stdout->getline, 'STDOUT', 'STDOUT' );
is( $c->stderr->getline, 'STDERR', 'STDERR' );