File: 090.14838.t

package info (click to toggle)
libcgi-simple-perl 1.282-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 604 kB
  • sloc: perl: 1,885; makefile: 2
file content (41 lines) | stat: -rw-r--r-- 850 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
29
30
31
32
33
34
35
36
37
38
39
40
41
use strict;
use Test::More;
Test::More->builder->no_ending( 1 );
use Config;
use CGI::Simple;

$| = 1;

BEGIN {
  if ( !$Config{d_fork} ) {
    plan skip_all => "fork not available on this platform";
  }

  eval "use HTTP::Request::Common";
  plan skip_all => "HTTP::Request::Common not available"
   if $@;

  plan tests => 1;
}

my $req = HTTP::Request::Common::POST(
  '/dummy_location',
  Content_Type => 'form-data',
  Content      => [ test_file => ["t/090.14838.t"], ]
);

# Useful in simulating an upload.
$ENV{REQUEST_METHOD} = 'POST';
$ENV{CONTENT_TYPE}   = $req->header( 'Content-type' );
$ENV{CONTENT_LENGTH} = $req->content_length;
if ( open( CHILD, "|-" ) ) {
  print CHILD $req->content;
  close CHILD;
  exit 0;
}

$CGI::Simple::DISABLE_UPLOADS = 0;

my $q = CGI::Simple->new;
is $q->cgi_error, undef, "CGI::Simple can handle this";