File: cgiupload.t

package info (click to toggle)
libapache2-mod-perl2 2.0.13-2
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 12,016 kB
  • sloc: perl: 97,771; ansic: 14,493; makefile: 51; sh: 18
file content (38 lines) | stat: -rw-r--r-- 1,073 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
# please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*-
use strict;
use warnings FATAL => 'all';

use Apache::Test;
use Apache::TestUtil;
use Apache::TestRequest;
use Apache2::Build ();

use File::Spec::Functions qw(catfile);

my $build = Apache2::Build->build_config;
plan tests => 2, need need_lwp(), need need_min_module_version('CGI', 3.08),
    {"MP_COMPAT_1X is disabled" => $build->{MP_COMPAT_1X}};

my $location = "/TestModules__cgiupload";

my $filename;
my $pod = 'pod/perlfunc.pod';

for (@INC) {
    if (-e "$_/$pod") {
        $filename = "$_/$pod";
        last;
    }
}

$filename ||= catfile Apache::Test::vars('serverroot'), "..", 'Makefile';

for (1,2) {
    t_client_log_warn_is_expected(4)
        if $] < 5.008 && require CGI && $CGI::VERSION < 3.06;
    my $str = UPLOAD_BODY $location, filename => $filename;
    my $body_len = length $str;
    my $file_len = -s $filename;
    t_debug "body_len=$body_len, file_len=$file_len";
    ok $body_len == $file_len;
}